Top Inners Fields Constructors Methods
io.undertow.client.http

pack-priv Class HttpClientConnection

extends AbstractAttachable
implements Closeable, ClientConnection
Class Inheritance
All Implemented Interfaces
io.undertow.client.ClientConnection, java.nio.channels.Channel, java.io.Closeable, java.lang.AutoCloseable
Imports
io.undertow.UndertowLogger, .UndertowOptions, io.undertow.client.ClientCallback, .ClientConnection, .ClientExchange, .ClientRequest, .ClientResponse, .ClientStatistics, .UndertowClientMessages, io.undertow.client.http2.Http2ClearClientProvider, .Http2ClientConnection, io.undertow.conduits.ByteActivityCallback, .BytesReceivedStreamSourceConduit, .BytesSentStreamSinkConduit, .ChunkedStreamSinkConduit, .ChunkedStreamSourceConduit, .ConduitListener, .FinishableStreamSourceConduit, .FixedLengthStreamSourceConduit, .ReadTimeoutStreamSourceConduit, .WriteTimeoutStreamSinkConduit, io.undertow.protocols.http2.Http2Channel, io.undertow.server.Connectors, io.undertow.server.protocol.http.HttpContinue, .HttpOpenListener, io.undertow.util.AbstractAttachable, .ConnectionUtils, .Headers, .HttpString, .Methods, .PooledAdaptor, .Protocols, .StatusCodes, org.jboss.logging.Logger, org.xnio.ChannelExceptionHandler, .ChannelListener, .ChannelListeners, .IoUtils, .Option, .OptionMap, .Options, .StreamConnection, .XnioIoThread, .XnioWorker, io.undertow.connector.ByteBufferPool, .PooledByteBuffer, org.xnio.channels.StreamSourceChannel, org.xnio.conduits.ConduitStreamSinkChannel, .ConduitStreamSourceChannel, .PushBackStreamSourceConduit, .StreamSinkConduit, .StreamSourceConduit, org.xnio.ssl.SslConnection, java.io.Closeable, .IOException, java.net.SocketAddress, java.nio.ByteBuffer, java.nio.channels.ClosedChannelException, java.util.ArrayDeque, .Deque, .List, .Locale, java.util.concurrent.CopyOnWriteArrayList

Author
David M. Lloyd

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv class
private class

Field Summary

Modifier and TypeField and Description
private final ByteBufferPool
private final HttpClientConnection.ClientReadListener
private final ClientStatistics
private static final int
private static final int
private final List<ChannelListener<ClientConnection>>
private final ChannelListener.SimpleSetter<HttpClientConnection>
private final StreamConnection
private HttpClientExchange
private ClientConnection
http2Delegate

The actual connection if this has been upgraded to h2c

private boolean
private boolean
private static final Logger
private final OptionMap
private final StreamSinkConduit
private final Deque<HttpClientExchange>
private HttpResponseBuilder
private PooledByteBuffer
private final PushBackStreamSourceConduit
private int
private int
public final ConduitListener<StreamSinkConduit>
public final ConduitListener<StreamSourceConduit>
private int
private static final int
private static final int
private int

Constructor Summary

AccessConstructor and Description
pack-priv
HttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool)

Method Summary

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

Implements io.undertow.client.ClientConnection.addCloseListener.

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

public void
close()

Implements java.io.Closeable.close, java.nio.channels.Channel.close.

Closes this stream and releases any system resources associated with it.

protected void
public void
exchangeDone()

Notification that the current request is finished

public ByteBufferPool
public ChannelListener.Setter<? extends HttpClientConnection>
pack-priv StreamConnection
public XnioIoThread
public SocketAddress
public <A extends SocketAddress> A
public <T> T
public SocketAddress
public <A extends SocketAddress> A
public ClientStatistics
public XnioWorker
private void
private void
private void
initiateRequest(HttpClientExchange httpClientExchange)

public boolean
public boolean
isOpen()

Implements io.undertow.client.ClientConnection.isOpen.

Tells whether or not this channel is open.

public boolean
public boolean
public boolean
public StreamConnection
performUpgrade()

Implements io.undertow.client.ClientConnection.performUpgrade.

Upgrade the connection, if the underlying protocol supports it.

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

Implements io.undertow.client.ClientConnection.sendRequest.

Sends a client request.

public <T> T
public boolean
Inherited from io.undertow.util.AbstractAttachable:
addToAttachmentListcreateAttachmentMapgetAttachmentgetAttachmentListputAttachmentremoveAttachment

Field Detail

bufferPoolback to summary
private final ByteBufferPool bufferPool
clientReadListenerback to summary
private final HttpClientConnection.ClientReadListener clientReadListener
clientStatisticsback to summary
private final ClientStatistics clientStatistics
CLOSE_REQback to summary
private static final int CLOSE_REQ
CLOSEDback to summary
private static final int CLOSED
closeListenersback to summary
private final List<ChannelListener<ClientConnection>> closeListeners
closeSetterback to summary
private final ChannelListener.SimpleSetter<HttpClientConnection> closeSetter
connectionback to summary
private final StreamConnection connection
currentRequestback to summary
private HttpClientExchange currentRequest
http2Delegateback to summary
private ClientConnection http2Delegate

The actual connection if this has been upgraded to h2c

http2Triedback to summary
private boolean http2Tried
http2UpgradeReceivedback to summary
private boolean http2UpgradeReceived
logback to summary
private static final Logger log
optionsback to summary
private final OptionMap options
originalSinkConduitback to summary
private final StreamSinkConduit originalSinkConduit
pendingQueueback to summary
private final Deque<HttpClientExchange> pendingQueue
pendingResponseback to summary
private HttpResponseBuilder pendingResponse
pooledBufferback to summary
private PooledByteBuffer pooledBuffer
pushBackStreamSourceConduitback to summary
private final PushBackStreamSourceConduit pushBackStreamSourceConduit
readback to summary
private int read
requestCountback to summary
private int requestCount
requestFinishListenerback to summary
public final ConduitListener<StreamSinkConduit> requestFinishListener
responseFinishedListenerback to summary
public final ConduitListener<StreamSourceConduit> responseFinishedListener
stateback to summary
private int state
UPGRADE_REQUESTEDback to summary
private static final int UPGRADE_REQUESTED
UPGRADEDback to summary
private static final int UPGRADED
writtenback to summary
private int written

Constructor Detail

HttpClientConnectionback to summary
pack-priv HttpClientConnection(final StreamConnection connection, final OptionMap options, final ByteBufferPool bufferPool)

Method Detail

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

Implements io.undertow.client.ClientConnection.addCloseListener.

Doc from io.undertow.client.ClientConnection.addCloseListener.

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

Parameters
listener:ChannelListener<ClientConnection>

The close listener

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements java.io.Closeable.close, java.nio.channels.Channel.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Exceptions
IOException:
if an I/O error occurs
doHttp2Upgradeback to summary
protected void doHttp2Upgrade()
exchangeDoneback to summary
public void exchangeDone()

Notification that the current request is finished

getBufferPoolback to summary
public ByteBufferPool getBufferPool()

Implements io.undertow.client.ClientConnection.getBufferPool.

Returns:ByteBufferPool

Doc from io.undertow.client.ClientConnection.getBufferPool.

The buffer pool used by the client

Annotations
@Override
getCloseSetterback to summary
public ChannelListener.Setter<? extends HttpClientConnection> getCloseSetter()

Implements io.undertow.client.ClientConnection.getCloseSetter.

Annotations
@Override
getConnectionback to summary
pack-priv StreamConnection getConnection()
getIoThreadback to summary
public XnioIoThread getIoThread()

Implements io.undertow.client.ClientConnection.getIoThread.

Annotations
@Override
getLocalAddressback to summary
public SocketAddress getLocalAddress()

Implements io.undertow.client.ClientConnection.getLocalAddress.

Annotations
@Override
getLocalAddressback to summary
public <A extends SocketAddress> A getLocalAddress(Class<A> type)

Implements io.undertow.client.ClientConnection.getLocalAddress.

Annotations
@Override
getOptionback to summary
public <T> T getOption(Option<T> option) throws IOException

Implements io.undertow.client.ClientConnection.getOption.

Annotations
@Override
getPeerAddressback to summary
public SocketAddress getPeerAddress()

Implements io.undertow.client.ClientConnection.getPeerAddress.

Annotations
@Override
getPeerAddressback to summary
public <A extends SocketAddress> A getPeerAddress(Class<A> type)

Implements io.undertow.client.ClientConnection.getPeerAddress.

Annotations
@Override
getStatisticsback to summary
public ClientStatistics getStatistics()

Implements io.undertow.client.ClientConnection.getStatistics.

Returns:ClientStatistics

Doc from io.undertow.client.ClientConnection.getStatistics.

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

Annotations
@Override
getWorkerback to summary
public XnioWorker getWorker()

Implements io.undertow.client.ClientConnection.getWorker.

Annotations
@Override
handleErrorback to summary
private void handleError(Throwable exception)
handleErrorback to summary
private void handleError(IOException exception)
initiateRequestback to summary
private void initiateRequest(HttpClientExchange httpClientExchange)
isMultiplexingSupportedback to summary
public boolean isMultiplexingSupported()

Implements io.undertow.client.ClientConnection.isMultiplexingSupported.

Returns:boolean

Doc from io.undertow.client.ClientConnection.isMultiplexingSupported.

true if this client supports multiplexing

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements io.undertow.client.ClientConnection.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

Annotations
@Override
isPushSupportedback to summary
public boolean isPushSupported()

Implements io.undertow.client.ClientConnection.isPushSupported.

Returns:boolean

Doc from io.undertow.client.ClientConnection.isPushSupported.

true if this connection support server push

Annotations
@Override
isUpgradedback to summary
public boolean isUpgraded()

Implements io.undertow.client.ClientConnection.isUpgraded.

Annotations
@Override
isUpgradeSupportedback to summary
public boolean isUpgradeSupported()

Implements io.undertow.client.ClientConnection.isUpgradeSupported.

Annotations
@Override
performUpgradeback to summary
public StreamConnection performUpgrade() throws IOException

Implements io.undertow.client.ClientConnection.performUpgrade.

Doc from io.undertow.client.ClientConnection.performUpgrade.

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

prepareResponseChannelback to summary
private void prepareResponseChannel(ClientResponse response, ClientExchange exchange)
requestDataSentback to summary
public void requestDataSent()
sendRequestback to summary
public void sendRequest(final ClientRequest request, final ClientCallback<ClientExchange> clientCallback)

Implements io.undertow.client.ClientConnection.sendRequest.

Doc from io.undertow.client.ClientConnection.sendRequest.

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.

Annotations
@Override
setOptionback to summary
public <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException

Implements io.undertow.client.ClientConnection.setOption.

Annotations
@Override
supportsOptionback to summary
public boolean supportsOption(Option<?> option)

Implements io.undertow.client.ClientConnection.supportsOption.

Annotations
@Override
io.undertow.client.http back to summary

pack-priv Class HttpClientConnection.ClientReadListener

extends Object
implements ChannelListener<StreamSourceChannel>
Class Inheritance
  • java.lang.Object
  • io.undertow.client.http.HttpClientConnection.ClientReadListener
All Implemented Interfaces
org.xnio.ChannelListener, java.util.EventListener

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
handleEvent(StreamSourceChannel
the channel event
channel
)

Implements org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClientReadListenerback to summary
pack-priv ClientReadListener()

Method Detail

handleEventback to summary
public void handleEvent(StreamSourceChannel channel)

Implements org.xnio.ChannelListener.handleEvent.

Doc from org.xnio.ChannelListener.handleEvent.

Handle the event on this channel.

Parameters
channel:StreamSourceChannel

the channel event

io.undertow.client.http back to summary

private Class HttpClientConnection.ClientStatisticsImpl

extends Object
implements ClientStatistics
Class Inheritance
  • java.lang.Object
  • io.undertow.client.http.HttpClientConnection.ClientStatisticsImpl
All Implemented Interfaces
io.undertow.client.ClientStatistics

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public long
public long
public long
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ClientStatisticsImplback to summary
private ClientStatisticsImpl()

Method Detail

getReadback to summary
public long getRead()

Implements io.undertow.client.ClientStatistics.getRead.

Annotations
@Override
getRequestsback to summary
public long getRequests()

Implements io.undertow.client.ClientStatistics.getRequests.

Annotations
@Override
getWrittenback to summary
public long getWritten()

Implements io.undertow.client.ClientStatistics.getWritten.

Annotations
@Override
resetback to summary
public void reset()

Implements io.undertow.client.ClientStatistics.reset.

Annotations
@Override