Package io.undertow.client.http2
Class Http2ClientConnection
java.lang.Object
io.undertow.client.http2.Http2ClientConnection
- All Implemented Interfaces:
ClientConnection
,Closeable
,AutoCloseable
,Channel
- Author:
- Stuart Douglas
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.undertow.client.ClientConnection
ClientConnection.PingListener
-
Constructor Summary
ConstructorsConstructorDescriptionHttp2ClientConnection
(Http2Channel http2Channel, boolean initialUpgradeRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) Http2ClientConnection
(Http2Channel http2Channel, ClientCallback<ClientExchange> upgradeReadyCallback, ClientRequest clientRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCloseListener
(org.xnio.ChannelListener<ClientConnection> listener) Adds a close listener, than will be invoked with the connection is closedvoid
close()
org.xnio.ChannelListener.Setter<? extends ClientConnection>
org.xnio.XnioIoThread
<A extends SocketAddress>
AgetLocalAddress
(Class<A> type) <T> T
getOption
(org.xnio.Option<T> option) <A extends SocketAddress>
AgetPeerAddress
(Class<A> type) org.xnio.XnioWorker
boolean
boolean
isOpen()
boolean
boolean
boolean
boolean
org.xnio.StreamConnection
Upgrade the connection, if the underlying protocol supports it.void
sendPing
(ClientConnection.PingListener listener, long timeout, TimeUnit timeUnit) void
sendRequest
(ClientRequest request, ClientCallback<ClientExchange> clientCallback) Sends a client request.<T> T
setOption
(org.xnio.Option<T> option, T value) boolean
supportsOption
(org.xnio.Option<?> option)
-
Constructor Details
-
Http2ClientConnection
public Http2ClientConnection(Http2Channel http2Channel, boolean initialUpgradeRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure) -
Http2ClientConnection
public Http2ClientConnection(Http2Channel http2Channel, ClientCallback<ClientExchange> upgradeReadyCallback, ClientRequest clientRequest, String defaultHost, ClientStatistics clientStatistics, boolean secure)
-
-
Method Details
-
sendRequest
Description copied from interface:ClientConnection
Sends a client request. The request object should not be modified after it has been submitted to the connection.Request objects can be queued. Once the request is in a state that it is ready to be sent the
clientCallback
is invoked to provide the caller with theClientExchange
If
ClientConnection.isMultiplexingSupported()
returns true then multiple requests may be active at the same time, and a later request may complete before an earlier one.Note that the request header may not be written out until after the callback has been invoked. This allows the client to write out a header with a gathering write if the request contains content.
- Specified by:
sendRequest
in interfaceClientConnection
- Parameters:
request
- The request to send.
-
performUpgrade
Description copied from interface:ClientConnection
Upgrade the connection, if the underlying protocol supports it. This should only be called after an upgrade request has been submitted and the target server has accepted the upgrade.- Specified by:
performUpgrade
in interfaceClientConnection
- Returns:
- The resulting StreamConnection
- Throws:
IOException
-
getBufferPool
- Specified by:
getBufferPool
in interfaceClientConnection
- Returns:
- The buffer pool used by the client
-
getPeerAddress
- Specified by:
getPeerAddress
in interfaceClientConnection
-
getPeerAddress
- Specified by:
getPeerAddress
in interfaceClientConnection
-
getCloseSetter
- Specified by:
getCloseSetter
in interfaceClientConnection
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceClientConnection
-
getLocalAddress
- Specified by:
getLocalAddress
in interfaceClientConnection
-
getWorker
public org.xnio.XnioWorker getWorker()- Specified by:
getWorker
in interfaceClientConnection
-
getIoThread
public org.xnio.XnioIoThread getIoThread()- Specified by:
getIoThread
in interfaceClientConnection
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceChannel
- Specified by:
isOpen
in interfaceClientConnection
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChannel
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
supportsOption
public boolean supportsOption(org.xnio.Option<?> option) - Specified by:
supportsOption
in interfaceClientConnection
-
getOption
- Specified by:
getOption
in interfaceClientConnection
- Throws:
IOException
-
setOption
public <T> T setOption(org.xnio.Option<T> option, T value) throws IllegalArgumentException, IOException - Specified by:
setOption
in interfaceClientConnection
- Throws:
IllegalArgumentException
IOException
-
isUpgraded
public boolean isUpgraded()- Specified by:
isUpgraded
in interfaceClientConnection
-
isPushSupported
public boolean isPushSupported()- Specified by:
isPushSupported
in interfaceClientConnection
- Returns:
true
if this connection support server push
-
isMultiplexingSupported
public boolean isMultiplexingSupported()- Specified by:
isMultiplexingSupported
in interfaceClientConnection
- Returns:
true
if this client supports multiplexing
-
getStatistics
- Specified by:
getStatistics
in interfaceClientConnection
- Returns:
- the statistics information, or
null
if statistics are not supported or disabled
-
isUpgradeSupported
public boolean isUpgradeSupported()- Specified by:
isUpgradeSupported
in interfaceClientConnection
-
addCloseListener
Description copied from interface:ClientConnection
Adds a close listener, than will be invoked with the connection is closed- Specified by:
addCloseListener
in interfaceClientConnection
- Parameters:
listener
- The close listener
-
isPingSupported
public boolean isPingSupported()- Specified by:
isPingSupported
in interfaceClientConnection
- Returns:
true
if the underlying protocol supports sending a ping
-
sendPing
- Specified by:
sendPing
in interfaceClientConnection
-