org.springframework.http.client
Class InterceptingClientHttpRequestFactory

java.lang.Object
  extended by org.springframework.http.client.InterceptingClientHttpRequestFactory
All Implemented Interfaces:
ClientHttpRequestFactory

public class InterceptingClientHttpRequestFactory
extends Object
implements ClientHttpRequestFactory

Wrapper for a ClientHttpRequestFactory that has support for ClientHttpRequestInterceptors.

Since:
3.1
Author:
Arjen Poutsma

Constructor Summary
InterceptingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory, ClientHttpRequestInterceptor[] interceptors)
          Creates a new instance of the InterceptingClientHttpRequestFactory with the given parameters.
 
Method Summary
 ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod)
          Create a new ClientHttpRequest for the specified URI and HTTP method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InterceptingClientHttpRequestFactory

public InterceptingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory,
                                            ClientHttpRequestInterceptor[] interceptors)
Creates a new instance of the InterceptingClientHttpRequestFactory with the given parameters.

Parameters:
requestFactory - the request factory to wrap
interceptors - the interceptors that are to be applied. Can be null.
Method Detail

createRequest

public ClientHttpRequest createRequest(URI uri,
                                       HttpMethod httpMethod)
                                throws IOException
Description copied from interface: ClientHttpRequestFactory
Create a new ClientHttpRequest for the specified URI and HTTP method.

The returned request can be written to, and then executed by calling ClientHttpRequest.execute().

Specified by:
createRequest in interface ClientHttpRequestFactory
Parameters:
uri - the URI to create a request for
httpMethod - the HTTP method to execute
Returns:
the created request
Throws:
IOException - in case of I/O errors