Class HttpClientRequest
java.lang.Object
io.helidon.webclient.api.ClientRequestBase<HttpClientRequest, HttpClientResponse>
io.helidon.webclient.api.HttpClientRequest
- All Implemented Interfaces:
ClientRequest<HttpClientRequest>, FullClientRequest<HttpClientRequest>
Client request of any client that support HTTP protocol.
This allows configuration of a request, such as setting headers, query parameters etc.
Terminating methods are
ClientRequestBase.submit(Object) (and its variants), and ClientRequestBase.request() (and its variants).-
Nested Class Summary
Nested classes/interfaces inherited from interface ClientRequest
ClientRequest.OutputStreamHandlerModifier and TypeInterfaceDescriptionstatic interfaceHandle output stream. -
Field Summary
Fields inherited from class ClientRequestBase
PROXY_CONNECTION, USER_AGENT_HEADER -
Method Summary
Modifier and TypeMethodDescriptionprotected HttpClientResponsedoOutputStream(ClientRequest.OutputStreamHandler outputStreamConsumer) Submit a request entity provided through an output stream.protected HttpClientResponseSubmit a request entity.protocolId(String protocol) Use an explicit version of HTTP by defining its ALPN protocol ID.Methods inherited from class ClientRequestBase
additionalHeaders, address, address, clearConnection, clearSelectedProxyRoute, clientConfig, connection, connection, crossesRedirectOriginBoundary, followRedirects, followRedirects, fragment, header, headers, headers, headers, invokeServices, invokeServices, invokeServices, keepAlive, keepAlive, maxRedirects, maxRedirects, mediaContext, method, outputStream, path, pathParam, pathParams, properties, property, proxy, proxy, queryParam, readContinueTimeout, readContinueTimeout, readTimeout, readTimeout, request, requestId, requestWithoutRouteCleanup, resolvedUri, resolveUri, sanitizeRedirectSensitiveHeaders, selectedProxyRoute, selectedProxyRoute, sendExpectContinue, sendExpectContinue, skipUriEncoding, skipUriEncoding, sni, sni, submit, tls, tls, uri, uri, uri, uriModifier and TypeMethodDescriptionprotected voidAppend additional headers before sending the request.address()Address of the connection, if configured.address(SocketAddress socketAddress) Socket address to use.final voidClear an internally supplied connection without changing other request state.voidClear retained route state after the current top-level request invocation, or when it no longer matches a finalized request target.protected HttpClientConfigAssociated client configuration.Possible explicit connection to use (such as when using a proxy).connection(ClientConnection connection) This method is for explicit connection use by this request.protected final booleancrossesRedirectOriginBoundary(ClientUri requestUri) Whether a redirect from this request to the provided URI would cross, or has already crossed, an origin boundary.booleanWhether to follow redirects.followRedirects(boolean followRedirects) Whether to follow redirects.fragment(UriFragment fragment) Set fragment of the URI.Set an HTTP header.headers()Get a (mutable) instance of outgoing headers.Configure headers.headers(Consumer<ClientRequestHeaders> headersConsumer) Update headers.protected WebClientServiceResponseinvokeServices(WebClient webClient, WebClientService.TransportChain httpCallChain, CompletableFuture<WebClientServiceRequest> whenSent, CompletableFuture<WebClientServiceResponse> whenComplete, ClientUri usedUri) Invoke configured client services and publish applicable transport response context before they unwind.protected WebClientServiceResponseinvokeServices(WebClientService.Chain httpCallChain, CompletableFuture<WebClientServiceRequest> whenSent, CompletableFuture<WebClientServiceResponse> whenComplete, ClientUri usedUri) Invoke configured client services.protected WebClientServiceResponseinvokeServices(WebClientService.WireProtocolChain httpCallChain, CompletableFuture<WebClientServiceRequest> whenSent, CompletableFuture<WebClientServiceResponse> whenComplete, ClientUri usedUri) Invoke configured client services.booleanWhether to use keep-alive connection (if relevant for the used HTTP version).keepAlive(boolean keepAlive) Whether to use keep alive with this request.intMaximal number of redirects to follow.maxRedirects(int maxRedirects) Max number of the followed redirects.protected MediaContextMedia context configured for this request.method()HTTP method to be invoked.outputStream(ClientRequest.OutputStreamHandler outputStreamConsumer) Handle output stream and submit the request.Configure path to call.Replace a placeholder in URI with an actual value.Replace a placeholder in URI with an actual value.Properties configured by a user or by other components.Add a property to be used by this request.proxy()Proxy configuration (may be no-proxy).Proxy configuration for this specific request.queryParam(String name, String... values) Add query parameter.Read 100-Continue timeout.readContinueTimeout(Duration readContinueTimeout) Read 100-Continue timeout for this request.Read timeout.readTimeout(Duration readTimeout) Read timeout for this request.request()Request without an entity.Request ID.protected final HttpClientResponseSubmit an internal request that participates in the enclosing top-level request's selected route.Resolved URI that will be used to invoke this request.protected ClientUriresolveUri(ClientUri toResolve) Resolve possible templated URI definition against the providedClientUri, extracting possible query information into the provided writable query.protected final voidsanitizeRedirectSensitiveHeaders(ClientUri requestUri, ClientRequestHeaders requestHeaders) Remove headers that must not cross redirect trust boundaries.Effective proxy route already selected during the current top-level request invocation.voidselectedProxyRoute(ProxyRoute proxyRoute) Retain an effective proxy route while handing a request between protocol implementations in the current top-level request invocation.Whether Expect 100-Continue header is sent to verify server availability before sending an entity.sendExpectContinue(boolean sendExpectContinue) Whether Expect 100-Continue header is sent to verify server availability before sending an entity.booleanWhether to skip URI encoding.skipUriEncoding(boolean skip) Disable uri encoding.sni()Request-level SNI configuration.Configure client-side TLS SNI for this request.Submit an entity.tls()TLS configuration (may be disabled - e.g.TLS configuration for this specific request.uri()URI of this request.Configure request URI.Configure URI.Configure URI.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ClientRequest
accept, accept, contentType, fragment, header, header, outputStream, request, request, requestEntity, requestEntity, sni, submit, submitModifier and TypeMethodDescriptiondefault HttpClientRequestAccepted media types.default HttpClientRequestaccept(HttpMediaType... accepted) Accepted media types.default HttpClientRequestcontentType(MediaType contentType) Sets the content type of the request.default HttpClientRequestSet fragment of the URI.default HttpClientRequestheader(HeaderName name, String... values) Set an HTTP header.default HttpClientRequestheader(HeaderName name, List<String> values) Set an HTTP header with multiple values.default <T> ClientResponseTyped<T> outputStream(ClientRequest.OutputStreamHandler outputStreamConsumer, Class<T> requestedType) Handle output stream and request a specific type.default <E> ClientResponseTyped<E> request(GenericType<E> type) Request without sending an entity.default <E> ClientResponseTyped<E> Request without sending an entity.default <E> ErequestEntity(GenericType<E> type) Request entity without sending a request entity, asking for entity only.default <E> ErequestEntity(Class<E> type) Request entity without sending a request entity, asking for entity only.default HttpClientRequestsni(Consumer<SniConfig.Builder> sni) Configure client-side TLS SNI for this request.default <E> ClientResponseTyped<E> submit(Object entity, GenericType<E> requestedType) Submit an entity and request a specific type.default <E> ClientResponseTyped<E> Submit an entity and request a specific type.
-
Method Details
-
protocolId
Use an explicit version of HTTP by defining its ALPN protocol ID. Constants are defined on each version specific client. For example to use HTTP/2,h2is the protocol ID. For TLS, we will attempt onlyh2negotiation, for plaintext requests, we will either attempt an upgrade from HTTP/1.1, or use prior knowledge according to HTTP/2 protocol configuration. This method is a no-op when called on a version specific HTTP client.- Parameters:
protocol- HTTP protocol ID to use- Returns:
- updated request
-
doSubmit
Description copied from class:ClientRequestBaseSubmit a request entity.- Specified by:
doSubmitin classClientRequestBase<HttpClientRequest, HttpClientResponse>- Parameters:
entity- request entity- Returns:
- HTTP client response
-
doOutputStream
Description copied from class:ClientRequestBaseSubmit a request entity provided through an output stream.- Specified by:
doOutputStreamin classClientRequestBase<HttpClientRequest, HttpClientResponse>- Parameters:
outputStreamConsumer- output stream handler- Returns:
- HTTP client response
-