Class Http2ClientImpl
java.lang.Object
io.helidon.webclient.http2.Http2ClientImpl
- All Implemented Interfaces:
RuntimeType.Api<Http2ClientConfig>, HttpClient<Http2ClientRequest>, ReleasableResource, Http2Client, HttpClientSpi
Implementation of HTTP2 client.
-
Nested Class Summary
Nested classes/interfaces inherited from interface HttpClientSpi
HttpClientSpi.SupportLevelModifier and TypeInterfaceDescriptionstatic enumHow does the provider support the request. -
Field Summary
Fields inherited from interface Http2Client
PROTOCOL, PROTOCOL_IDModifier and TypeFieldDescriptionstatic final Protocol<Http2Client, Http2ClientProtocolConfig> Protocol to use to obtain an instance of http/2 specific client fromWebClient.client(io.helidon.webclient.spi.Protocol).static final StringHTTP/2 protocol ID, as used by ALPN. -
Method Summary
Modifier and TypeMethodDescriptionclientRequest(FullClientRequest<?> clientRequest, ClientUri clientUri) Create a client request based on the provided HTTP request that is for the version of this client.voidGracefully close all opened client specific connections.Create a request for a method.The prototype as it was received when creating this runtime object instance.voidresponseReceived(WebClientProtocolResponse response) Notification invoked after the WebClient receives a transport response, regardless of the protocol that produced it.supports(FullClientRequest<?> clientRequest, ClientUri clientUri) Return whether this HTTP version can handle the provided request.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface HttpClient
delete, delete, get, get, head, head, options, options, patch, patch, post, post, put, put, trace, traceModifier and TypeMethodDescriptiondefault Http2ClientRequestdelete()Shortcut for delete method with default path.default Http2ClientRequestShortcut for delete method with a path.default Http2ClientRequestget()Shortcut for get method with default path.default Http2ClientRequestShortcut for get method with a path.default Http2ClientRequesthead()Shortcut for head method with default path.default Http2ClientRequestShortcut for head method with a path.default Http2ClientRequestoptions()Shortcut for options method with default path.default Http2ClientRequestShortcut for options method with a path.default Http2ClientRequestpatch()Shortcut for patch method with default path.default Http2ClientRequestShortcut for patch method with a path.default Http2ClientRequestpost()Shortcut for post method with default path.default Http2ClientRequestShortcut for post method with a path.default Http2ClientRequestput()Shortcut for put method with default path.default Http2ClientRequestShortcut for put method with a path.default Http2ClientRequesttrace()Shortcut for trace method with default path.default Http2ClientRequestShortcut for trace method with a path.Methods inherited from interface HttpClientSpi
isTcpModifier and TypeMethodDescriptiondefault booleanisTcp()For TCP based protocols, we can do ALPN negotiation, obtain a connection, and then let the client handle the protocol.Methods inherited from interface ReleasableResource
releaseResourceModifier and TypeMethodDescriptiondefault voidReleases the resource, and if this resource is re-usable, enabled reuse.
-
Method Details
-
method
Description copied from interface:HttpClientCreate a request for a method.- Specified by:
methodin interfaceHttpClient<Http2ClientRequest>- Parameters:
method- HTTP method- Returns:
- a new request (not thread safe)
-
prototype
Description copied from interface:RuntimeType.ApiThe prototype as it was received when creating this runtime object instance.- Specified by:
prototypein interfaceRuntimeType.Api<Http2ClientConfig>- Returns:
- prototype object used to create this instance
-
supports
Description copied from interface:HttpClientSpiReturn whether this HTTP version can handle the provided request.Examples:
- HTTP/1.1 always returns
HttpClientSpi.SupportLevel.COMPATIBLE, as it is the fallback protocol of all other protocols - A protocol with a reusable connection returns
HttpClientSpi.SupportLevel.SUPPORTED - A dynamically discovered protocol can move between
HttpClientSpi.SupportLevel.NOT_SUPPORTEDandHttpClientSpi.SupportLevel.SUPPORTEDas endpoint information becomes available or expires
- An explicit protocol id is configured for the request -
HttpClientRequest.protocolId(String) - There is no fallback protocol enabled, in such a case, we use the one with highest priority - see
WebClientConfig.BuilderBase.addProtocolPreference(String) - The client dynamically learns that another protocol is viable for the endpoint
- This protocol version already handled a request to such an endpoint and has the connection available
- Specified by:
supportsin interfaceHttpClientSpi- Parameters:
clientRequest- HTTP requestclientUri- URI to invoke- Returns:
- support level for this protocol and request
- HTTP/1.1 always returns
-
responseReceived
Description copied from interface:HttpClientSpiNotification invoked after the WebClient receives a transport response, regardless of the protocol that produced it.An implementation may inspect response metadata relevant to its protocol. For example, it may learn about an alternative service from an
Alt-Svcresponse header received over another protocol.- Specified by:
responseReceivedin interfaceHttpClientSpi- Parameters:
response- received protocol response
-
clientRequest
Description copied from interface:HttpClientSpiCreate a client request based on the provided HTTP request that is for the version of this client.- Specified by:
clientRequestin interfaceHttpClientSpi- Parameters:
clientRequest- request configurationclientUri- URI to invoke (resolved)- Returns:
- a new request
-
closeResource
public void closeResource()Description copied from interface:HttpClientGracefully close all opened client specific connections.- Specified by:
closeResourcein interfaceHttpClient<Http2ClientRequest>- Specified by:
closeResourcein interfaceReleasableResource
-