public class BufferingClientHttpRequestFactory extends AbstractClientHttpRequestFactoryWrapper
ClientHttpRequestFactory
that buffers
all outgoing and incoming streams in memory.
Using this wrapper allows for multiple reads of the
Constructor and Description |
---|
BufferingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory)
Create a buffering wrapper for the given
ClientHttpRequestFactory . |
Modifier and Type | Method and Description |
---|---|
protected ClientHttpRequest |
createRequest(URI uri,
HttpMethod httpMethod,
ClientHttpRequestFactory requestFactory)
Create a new
ClientHttpRequest for the specified URI and HTTP method by using the
passed-on request factory. |
protected boolean |
shouldBuffer(URI uri,
HttpMethod httpMethod)
Indicates whether the request/response exchange for the given URI and method
should be buffered in memory.
|
createRequest
public BufferingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory)
ClientHttpRequestFactory
.requestFactory
- the target request factory to wrapprotected ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod, ClientHttpRequestFactory requestFactory) throws IOException
AbstractClientHttpRequestFactoryWrapper
ClientHttpRequest
for the specified URI and HTTP method by using the
passed-on request factory.
Called from AbstractClientHttpRequestFactoryWrapper.createRequest(URI, HttpMethod)
.
createRequest
in class AbstractClientHttpRequestFactoryWrapper
uri
- the URI to create a request forhttpMethod
- the HTTP method to executerequestFactory
- the wrapped request factoryIOException
- in case of I/O errorsprotected boolean shouldBuffer(URI uri, HttpMethod httpMethod)
The default implementation returns true
for all URIs and methods.
Subclasses can override this method to change this behavior.
uri
- the URIhttpMethod
- the methodtrue
if the exchange should be buffered; false
otherwise