public class HttpClient extends Object implements NettyConnector<HttpClientResponse,HttpClientRequest>
| Modifier and Type | Field and Description |
|---|---|
static String |
USER_AGENT |
| Modifier | Constructor and Description |
|---|---|
protected |
HttpClient(HttpClientOptions options) |
public static final String USER_AGENT
protected HttpClient(HttpClientOptions options)
public static HttpClient create()
public static HttpClient create(java.util.function.Consumer<? super HttpClientOptions> options)
optionspublic static HttpClient create(String address)
public static HttpClient create(String address, int port)
public static HttpClient create(int port)
public final Mono<HttpClientResponse> delete(String url, java.util.function.Function<? super HttpClientRequest,? extends Publisher<Void>> handler)
url - the target remote URLhandler - the Function to invoke on open channelMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> delete(String url)
url - the target remote URLMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> get(String url, java.util.function.Function<? super HttpClientRequest,? extends Publisher<Void>> handler)
url - the target remote URLhandler - the Function to invoke on open channelMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> get(String url)
url - the target remote URLMono of the HttpServerResponse ready to consume for
responsepublic Mono<HttpClientResponse> newHandler(java.util.function.BiFunction<? super HttpClientResponse,? super HttpClientRequest,? extends Publisher<Void>> ioHandler)
newHandler in interface Connector<ByteBuf,ByteBuf,HttpClientResponse,HttpClientRequest>public final Mono<HttpClientResponse> patch(String url, java.util.function.Function<? super HttpClientRequest,? extends Publisher<Void>> handler)
url - the target remote URLhandler - the Function to invoke on open channelMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> patch(String url)
url - the target remote URLMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> post(String url, java.util.function.Function<? super HttpClientRequest,? extends Publisher<Void>> handler)
url - the target remote URLhandler - the Function to invoke on open channelMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> put(String url, java.util.function.Function<? super HttpClientRequest,? extends Publisher<Void>> handler)
url - the target remote URLhandler - the Function to invoke on open channelMono of the HttpServerResponse ready to consume for
responsepublic Mono<HttpClientResponse> request(HttpMethod method, String url, java.util.function.Function<? super HttpClientRequest,? extends Publisher<Void>> handler)
method - the HTTP method to sendurl - the target remote URLhandler - the Function to invoke on opened TCP connectionMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> ws(String url)
url - the target remote URLMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> ws(String url, java.util.function.Consumer<? super HttpHeaders> headerBuilder)
url - the target remote URLheaderBuilder - the header Consumer to invoke before sending websocket
handshakeMono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> ws(String url, String subprotocols)
The negotiated subprotocol can be accessed through the HttpClientResponse
by switching to websocket (using any of the receiveWebSocket
methods) and using WebsocketInbound.selectedSubprotocol().
To send data through the websocket, use HttpClientResponse.receiveWebsocket(BiFunction)
and then use the function's WebsocketOutbound.
url - the target remote URLsubprotocols - the subprotocol(s) to negotiate, comma-separated, or null if not relevant.Mono of the HttpServerResponse ready to consume for
responsepublic final Mono<HttpClientResponse> ws(String url, java.util.function.Consumer<? super HttpHeaders> headerBuilder, String subprotocols)
The negotiated subprotocol can be accessed through the HttpClientResponse
by switching to websocket (using any of the receiveWebSocket
methods) and using WebsocketInbound.selectedSubprotocol().
To send data through the websocket, use HttpClientResponse.receiveWebsocket(BiFunction)
and then use the function's WebsocketOutbound.
url - the target remote URLheaderBuilder - the header Consumer to invoke before sending websocket
handshakesubprotocols - the subprotocol(s) to negotiate, comma-separated, or null if not relevant.Mono of the HttpServerResponse ready to consume for
response