@FunctionalInterface public interface ClientHttpRequestInterceptor
RestTemplate
, as to modify the outgoing ClientHttpRequest
and/or the incoming ClientHttpResponse
.
The main entry point for interceptors is intercept(HttpRequest, byte[], ClientHttpRequestExecution)
.
Modifier and Type | Method and Description |
---|---|
ClientHttpResponse |
intercept(HttpRequest request,
byte[] body,
ClientHttpRequestExecution execution)
Intercept the given request, and return a response.
|
ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException
ClientHttpRequestExecution
allows
the interceptor to pass on the request and response to the next entity in the chain.
A typical implementation of this method would follow the following pattern:
ClientHttpRequestExecution.execute(org.springframework.http.HttpRequest, byte[])
,request
- the request, containing method, URI, and headersbody
- the body of the requestexecution
- the request executionIOException
- in case of I/O errors