org.springframework.http.client

Interface ClientHttpRequestInterceptor

    • Method Detail

      • intercept

        ClientHttpResponse intercept(HttpRequest request,
                                     byte[] body,
                                     ClientHttpRequestExecution execution)
                              throws java.io.IOException
        Intercept the given request, and return a response. The given 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:

        1. Examine the request and body
        2. Optionally wrap the request to filter HTTP attributes.
        3. Optionally modify the body of the request.
        4. Either
        5. Optionally wrap the response to filter HTTP attributes.
        Parameters:
        request - the request, containing method, URI, and headers
        body - the body of the request
        execution - the request execution
        Returns:
        the response
        Throws:
        java.io.IOException - in case of I/O errors