Top Description Inners Methods
io.undertow.client

public Interface ClientConnection

extends Channel
Known Direct Implementers
io.undertow.client.ajp.AjpClientConnection, io.undertow.client.http.HttpClientConnection, io.undertow.client.http2.Http2ClientConnection
Imports
io.undertow.UndertowMessages, org.xnio.ChannelListener, .Option, .StreamConnection, .XnioIoThread, .XnioWorker, io.undertow.connector.ByteBufferPool, java.io.IOException, java.net.SocketAddress, java.nio.channels.Channel, java.util.concurrent.TimeUnit

A client connection. This can be used to send requests, or to upgrade the connection.

In general these objects are not thread safe, they should only be used by the IO thread that is responsible for the connection. As a result this client does not provide a mechanism to perform blocking IO, it is designed for async operation only.

Author
Stuart Douglas

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Method Summary

Modifier and TypeMethod and Description
public void
addCloseListener(ChannelListener<ClientConnection>
The close listener
listener
)

Adds a close listener, than will be invoked with the connection is closed

public ByteBufferPool

Returns:

The buffer pool used by the client
getBufferPool
()

public ChannelListener.Setter<? extends ClientConnection>
public XnioIoThread
public SocketAddress
public <A extends SocketAddress> A
public <T> T
getOption(Option<T> option)

public SocketAddress
public <A extends SocketAddress> A
public ClientStatistics

Returns:

the statistics information, or null if statistics are not supported or disabled
getStatistics
()

public XnioWorker
public boolean

Returns:

true if this client supports multiplexing
isMultiplexingSupported
()

public boolean
isOpen()

Redeclares java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

public default boolean

Returns:

true if the underlying protocol supports sending a ping
isPingSupported
()

public boolean

Returns:

true if this connection support server push
isPushSupported
()

public boolean
public boolean
public StreamConnection

Returns:

The resulting StreamConnection
performUpgrade
()

Upgrade the connection, if the underlying protocol supports it.

public default void
sendPing(ClientConnection.PingListener listener, long timeout, TimeUnit timeUnit)

public void
sendRequest(final ClientRequest
The request to send.
request
,
final ClientCallback<ClientExchange> clientCallback)

Sends a client request.

public <T> T
setOption(Option<T> option, T value)

public boolean
Inherited from java.nio.channels.Channel:
close

Method Detail

addCloseListenerback to summary
public void addCloseListener(ChannelListener<ClientConnection> listener)

Adds a close listener, than will be invoked with the connection is closed

Parameters
listener:ChannelListener<ClientConnection>

The close listener

getBufferPoolback to summary
public ByteBufferPool getBufferPool()
Returns:ByteBufferPool

The buffer pool used by the client

getCloseSetterback to summary
public ChannelListener.Setter<? extends ClientConnection> getCloseSetter()
getIoThreadback to summary
public XnioIoThread getIoThread()
getLocalAddressback to summary
public SocketAddress getLocalAddress()
getLocalAddressback to summary
public <A extends SocketAddress> A getLocalAddress(Class<A> type)
getOptionback to summary
public <T> T getOption(Option<T> option) throws IOException
getPeerAddressback to summary
public SocketAddress getPeerAddress()
getPeerAddressback to summary
public <A extends SocketAddress> A getPeerAddress(Class<A> type)
getStatisticsback to summary
public ClientStatistics getStatistics()
Returns:ClientStatistics

the statistics information, or null if statistics are not supported or disabled

getWorkerback to summary
public XnioWorker getWorker()
isMultiplexingSupportedback to summary
public boolean isMultiplexingSupported()
Returns:boolean

true if this client supports multiplexing

isOpenback to summary
public boolean isOpen()

Redeclares java.nio.channels.Channel.isOpen.

Doc from java.nio.channels.Channel.isOpen.

Tells whether or not this channel is open.

Returns:boolean

true if, and only if, this channel is open

isPingSupportedback to summary
public default boolean isPingSupported()
Returns:boolean

true if the underlying protocol supports sending a ping

isPushSupportedback to summary
public boolean isPushSupported()
Returns:boolean

true if this connection support server push

isUpgradedback to summary
public boolean isUpgraded()
isUpgradeSupportedback to summary
public boolean isUpgradeSupported()
performUpgradeback to summary
public StreamConnection performUpgrade() throws IOException

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.

Returns:StreamConnection

The resulting StreamConnection

sendPingback to summary
public default void sendPing(ClientConnection.PingListener listener, long timeout, TimeUnit timeUnit)
sendRequestback to summary
public void sendRequest(final ClientRequest request, final ClientCallback<ClientExchange> clientCallback)

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 the ClientExchange

If 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.

Parameters
request:ClientRequest

The request to send.

setOptionback to summary
public <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
supportsOptionback to summary
public boolean supportsOption(Option<?> option)
io.undertow.client back to summary

public Interface ClientConnection.PingListener


Method Summary

Modifier and TypeMethod and Description
public void
public void

Method Detail

acknowledgedback to summary
public void acknowledged()
failedback to summary
public void failed(IOException e)