类 BufferingClientHttpRequestFactory
- java.lang.Object
- org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper
- org.springframework.http.client.BufferingClientHttpRequestFactory
- 所有已实现的接口:
ClientHttpRequestFactory
public class BufferingClientHttpRequestFactory extends AbstractClientHttpRequestFactoryWrapper
Wrapper for aClientHttpRequestFactorythat buffers all outgoing and incoming streams in memory.Using this wrapper allows for multiple reads of the response body.
- 从以下版本开始:
- 3.1
- 作者:
- Arjen Poutsma
构造器概要
构造器 构造器 说明 BufferingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory)Create a buffering wrapper for the givenClientHttpRequestFactory.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected ClientHttpRequestcreateRequest(URI uri, HttpMethod httpMethod, ClientHttpRequestFactory requestFactory)Create a newClientHttpRequestfor the specified URI and HTTP method by using the passed-on request factory.protected booleanshouldBuffer(URI uri, HttpMethod httpMethod)Indicates whether the request/response exchange for the given URI and method should be buffered in memory.从类继承的方法 org.springframework.http.client.AbstractClientHttpRequestFactoryWrapper
createRequest
构造器详细资料
BufferingClientHttpRequestFactory
public BufferingClientHttpRequestFactory(ClientHttpRequestFactory requestFactory)
Create a buffering wrapper for the givenClientHttpRequestFactory.- 参数:
requestFactory- the target request factory to wrap
方法详细资料
createRequest
protected ClientHttpRequest createRequest(URI uri, HttpMethod httpMethod, ClientHttpRequestFactory requestFactory) throws IOException
Create a newClientHttpRequestfor the specified URI and HTTP method by using the passed-on request factory.Called from
AbstractClientHttpRequestFactoryWrapper.createRequest(URI, HttpMethod).- 指定者:
createRequest在类中AbstractClientHttpRequestFactoryWrapper- 参数:
uri- the URI to create a request forhttpMethod- the HTTP method to executerequestFactory- the wrapped request factory- 返回:
- the created request
- 抛出:
IOException- in case of I/O errors
shouldBuffer
protected boolean shouldBuffer(URI uri, HttpMethod httpMethod)
Indicates whether the request/response exchange for the given URI and method should be buffered in memory.The default implementation returns
truefor all URIs and methods. Subclasses can override this method to change this behavior.- 参数:
uri- the URIhttpMethod- the method- 返回:
trueif the exchange should be buffered;falseotherwise