类 HttpComponentsClientHttpConnector
java.lang.Object
cn.taketoday.http.client.reactive.HttpComponentsClientHttpConnector
- 所有已实现的接口:
ClientHttpConnector,Closeable,AutoCloseable
public class HttpComponentsClientHttpConnector
extends Object
implements ClientHttpConnector, Closeable
ClientHttpConnector implementation for the Apache HttpComponents HttpClient 5.x.- 从以下版本开始:
- 4.0
- 作者:
- Martin Tarjányi, Arjen Poutsma
- 另请参阅:
-
嵌套类概要
嵌套类修饰符和类型类说明private static classCallback that invoked when a response is received.private static classCallback that invoked when a request is executed. -
字段概要
字段修饰符和类型字段说明private final CloseableHttpAsyncClientprivate final BiFunction<HttpMethod,URI, ? extends HttpClientContext> private cn.taketoday.core.io.buffer.DataBufferFactory -
构造器概要
构造器构造器说明Default constructor that creates and starts a new instance ofCloseableHttpAsyncClient.Constructor with a pre-configuredCloseableHttpAsyncClientinstance.HttpComponentsClientHttpConnector(CloseableHttpAsyncClient client, BiFunction<HttpMethod, URI, ? extends HttpClientContext> contextProvider) Constructor with a pre-configuredCloseableHttpAsyncClientinstance and aHttpClientContextsupplier lambda which is called before each request and passed to the client. -
方法概要
修饰符和类型方法说明voidclose()reactor.core.publisher.Mono<ClientHttpResponse>connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, reactor.core.publisher.Mono<Void>> requestCallback) Connect to the origin server using the givenHttpMethodandURIand apply the givenrequestCallbackwhen the HTTP request of the underlying API can be initialized and written to.private reactor.core.publisher.Mono<ClientHttpResponse>execute(HttpComponentsClientHttpRequest request, HttpClientContext context) voidsetBufferFactory(cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory) Set the buffer factory to use.
-
字段详细资料
-
client
-
contextProvider
-
dataBufferFactory
private cn.taketoday.core.io.buffer.DataBufferFactory dataBufferFactory
-
-
构造器详细资料
-
HttpComponentsClientHttpConnector
public HttpComponentsClientHttpConnector()Default constructor that creates and starts a new instance ofCloseableHttpAsyncClient. -
HttpComponentsClientHttpConnector
Constructor with a pre-configuredCloseableHttpAsyncClientinstance.- 参数:
client- the client to use
-
HttpComponentsClientHttpConnector
public HttpComponentsClientHttpConnector(CloseableHttpAsyncClient client, BiFunction<HttpMethod, URI, ? extends HttpClientContext> contextProvider) Constructor with a pre-configuredCloseableHttpAsyncClientinstance and aHttpClientContextsupplier lambda which is called before each request and passed to the client.- 参数:
client- the client to usecontextProvider- aHttpClientContextsupplier
-
-
方法详细资料
-
setBufferFactory
public void setBufferFactory(cn.taketoday.core.io.buffer.DataBufferFactory bufferFactory) Set the buffer factory to use. -
connect
public reactor.core.publisher.Mono<ClientHttpResponse> connect(HttpMethod method, URI uri, Function<? super ClientHttpRequest, reactor.core.publisher.Mono<Void>> requestCallback) 从接口复制的说明:ClientHttpConnectorConnect to the origin server using the givenHttpMethodandURIand apply the givenrequestCallbackwhen the HTTP request of the underlying API can be initialized and written to.- 指定者:
connect在接口中ClientHttpConnector- 参数:
method- the HTTP request methoduri- the HTTP request URIrequestCallback- a function that prepares and writes to the request, returning a publisher that signals when it's done writing. Implementations can return aMono<Void>by callingReactiveHttpOutputMessage.writeWith(org.reactivestreams.Publisher<? extends cn.taketoday.core.io.buffer.DataBuffer>)orReactiveHttpOutputMessage.setComplete().- 返回:
- publisher for the
ClientHttpResponse
-
execute
private reactor.core.publisher.Mono<ClientHttpResponse> execute(HttpComponentsClientHttpRequest request, HttpClientContext context) -
close
- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 抛出:
IOException
-