Package org.apache.juneau.rest.client
Interface RestCallInterceptor
- All Known Implementing Classes:
BasicRestCallInterceptor
public interface RestCallInterceptor
Used to intercept http connection responses to allow modification of that response before processing and for
listening for call lifecycle events.
The BasicRestCallInterceptor
is provided as an adapter class for implementing this interface.
Note that the RestClient
class itself implements this interface so you can achieve the same results by
overriding the methods on the client class as well.
Example:
See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
onClose
(RestRequest req, RestResponse res) Called when the response body is consumed.void
onConnect
(RestRequest req, RestResponse res) Called immediately after an HTTP response has been received.void
onInit
(RestRequest req) Called immediately afterRestRequest
object is created and all headers/query/form-data has been copied from the client to the request object.
-
Method Details
-
onInit
Called immediately afterRestRequest
object is created and all headers/query/form-data has been copied from the client to the request object.- Parameters:
req
- The HTTP request object.- Throws:
Exception
- Any exception can be thrown.
If not aRestCallException
orRuntimeException
, will be wrapped in aRestCallException
.
-
onConnect
Called immediately after an HTTP response has been received.- Parameters:
req
- The HTTP request object.res
- The HTTP response object.- Throws:
Exception
- Any exception can be thrown.
If not aRestCallException
orRuntimeException
, will be wrapped in aRestCallException
.
-
onClose
Called when the response body is consumed.- Parameters:
req
- The request object.res
- The response object.- Throws:
RestCallException
- Error occurred during call.Exception
- Any exception can be thrown.
If not aRestCallException
orRuntimeException
, will be wrapped in aRestCallException
.
-