public class Http2ServerConnection extends ServerConnection
ServerConnection.CloseListener
Constructor and Description |
---|
Http2ServerConnection(Http2Channel channel, Http2DataStreamSinkChannel sinkChannel, org.xnio.OptionMap undertowOptions, int bufferSize, HttpHandler rootHandler) Channel that is used when the request is already half closed |
Http2ServerConnection(Http2Channel channel, Http2StreamSourceChannel requestChannel, org.xnio.OptionMap undertowOptions, int bufferSize, HttpHandler rootHandler) |
Modifier and Type | Method and Description |
---|---|
void | addCloseListener(ServerConnection.CloseListener listener) Adds a close listener, than will be invoked with the connection is closed |
<T> void | addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value) Add a value to a list-typed attachment key. |
void | close() |
protected void | exchangeComplete(HttpServerExchange exchange) Invoked when the exchange is complete. |
<T> T | getAttachment(AttachmentKey<T> key) Get an attachment value. |
<T> List<T> | getAttachmentList(AttachmentKey<? extends List<T>> key) Gets a list attachment value. |
org.xnio.Pool<ByteBuffer> | getBufferPool() |
int | getBufferSize() |
ByteBufferPool | getByteBufferPool() |
org.xnio.ChannelListener.Setter<? extends org.xnio.channels.ConnectedChannel> | getCloseSetter() |
org.xnio.XnioIoThread | getIoThread() |
SocketAddress | getLocalAddress() |
<A extends SocketAddress> | getLocalAddress(Class<A> type) |
<T> T | getOption(org.xnio.Option<T> option) |
SocketAddress | getPeerAddress() Returns the actual address of the remote connection. |
<A extends SocketAddress> | getPeerAddress(Class<A> type) Returns the actual address of the remote connection. |
protected org.xnio.conduits.ConduitStreamSinkChannel | getSinkChannel() |
protected org.xnio.conduits.StreamSinkConduit | getSinkConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSinkConduit conduit) Gets the sink conduit that should be used for this request. |
protected org.xnio.conduits.ConduitStreamSourceChannel | getSourceChannel() |
SSLSession | getSslSession() Gets the SSLSession of the underlying connection, or null if SSL is not in use. |
SSLSessionInfo | getSslSessionInfo() Gets SSL information about the connection. |
String | getTransportProtocol() Returns a string representation describing the protocol used to transmit messages on this connection. |
org.xnio.OptionMap | getUndertowOptions() |
org.xnio.XnioWorker | getWorker() |
protected boolean | isConnectSupported() |
boolean | isContinueResponseSupported() |
boolean | isOpen() |
boolean | isPushSupported() |
boolean | isRequestTrailerFieldsSupported() |
protected boolean | isUpgradeSupported() |
protected void | maxEntitySizeUpdated(HttpServerExchange exchange) Callback that is invoked if the max entity size is updated. |
boolean | pushResource(String path, HttpString method, HeaderMap requestHeaders) Attempts to push a resource if this connection supports server push. |
boolean | pushResource(String path, HttpString method, HeaderMap requestHeaders, HttpHandler handler) Attempts to push a resource if this connection supports server push. |
<T> T | putAttachment(AttachmentKey<T> key, T value) Set an attachment value. |
<T> T | removeAttachment(AttachmentKey<T> key) Remove an attachment, returning its previous value. |
HttpServerExchange | sendOutOfBandResponse(HttpServerExchange exchange) Sends an out of band response, such as a HTTP 100-continue response. |
protected void | setConnectListener(HttpUpgradeListener connectListener) |
<T> T | setOption(org.xnio.Option<T> option, T value) |
void | setSslSessionInfo(SSLSessionInfo sessionInfo) Sets the current SSL information. |
protected void | setUpgradeListener(HttpUpgradeListener upgradeListener) |
boolean | supportsOption(org.xnio.Option<?> option) |
void | terminateRequestChannel(HttpServerExchange exchange) Invoked when the exchange is complete, and there is still data in the request channel. |
protected org.xnio.StreamConnection | upgradeChannel() Upgrade the connection, if allowed |
createAttachmentMap
public Http2ServerConnection(Http2Channel channel, Http2StreamSourceChannel requestChannel, org.xnio.OptionMap undertowOptions, int bufferSize, HttpHandler rootHandler)
public Http2ServerConnection(Http2Channel channel, Http2DataStreamSinkChannel sinkChannel, org.xnio.OptionMap undertowOptions, int bufferSize, HttpHandler rootHandler)
channel
- undertowOptions
- bufferSize
- rootHandler
- public org.xnio.Pool<ByteBuffer> getBufferPool()
getBufferPool
in class ServerConnection
public SSLSession getSslSession()
ServerConnection
ServerConnection.getSslSessionInfo()
should be used instead, as it takes into account other information potentially provided by load balancers that terminate SSLgetSslSession
in class ServerConnection
public ByteBufferPool getByteBufferPool()
getByteBufferPool
in class ServerConnection
public org.xnio.XnioWorker getWorker()
getWorker
in interface org.xnio.channels.CloseableChannel
getWorker
in class ServerConnection
public org.xnio.XnioIoThread getIoThread()
getIoThread
in interface org.xnio.channels.CloseableChannel
getIoThread
in class ServerConnection
public HttpServerExchange sendOutOfBandResponse(HttpServerExchange exchange)
ServerConnection
sendOutOfBandResponse
in class ServerConnection
exchange
- The current exchangepublic boolean isContinueResponseSupported()
isContinueResponseSupported
in class ServerConnection
true
if this connection supports sending a 100-continue responsepublic void terminateRequestChannel(HttpServerExchange exchange)
ServerConnection
terminateRequestChannel
in class ServerConnection
exchange
- The current exchange.public boolean isOpen()
isOpen
in interface Channel
isOpen
in class ServerConnection
public boolean supportsOption(org.xnio.Option<?> option)
supportsOption
in interface org.xnio.channels.Configurable
supportsOption
in class ServerConnection
public <T> T getOption(org.xnio.Option<T> option) throws IOException
getOption
in interface org.xnio.channels.Configurable
getOption
in class ServerConnection
IOException
public <T> T setOption(org.xnio.Option<T> option, T value) throws IllegalArgumentException, IOException
setOption
in interface org.xnio.channels.Configurable
setOption
in class ServerConnection
IllegalArgumentException
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface org.xnio.channels.CloseableChannel
close
in class ServerConnection
IOException
public SocketAddress getPeerAddress()
ServerConnection
getPeerAddress
in interface org.xnio.channels.ConnectedChannel
getPeerAddress
in class ServerConnection
public <A extends SocketAddress> A getPeerAddress(Class<A> type)
ServerConnection
getPeerAddress
in interface org.xnio.channels.ConnectedChannel
getPeerAddress
in class ServerConnection
A
- The address typetype
- The type of address to returnpublic org.xnio.ChannelListener.Setter<? extends org.xnio.channels.ConnectedChannel> getCloseSetter()
public SocketAddress getLocalAddress()
getLocalAddress
in interface org.xnio.channels.BoundChannel
getLocalAddress
in class ServerConnection
public <A extends SocketAddress> A getLocalAddress(Class<A> type)
getLocalAddress
in interface org.xnio.channels.BoundChannel
getLocalAddress
in class ServerConnection
public org.xnio.OptionMap getUndertowOptions()
getUndertowOptions
in class ServerConnection
public int getBufferSize()
getBufferSize
in class ServerConnection
public SSLSessionInfo getSslSessionInfo()
ServerConnection
getSslSessionInfo
in class ServerConnection
public void setSslSessionInfo(SSLSessionInfo sessionInfo)
ServerConnection
setSslSessionInfo
in class ServerConnection
sessionInfo
- The ssl session informationpublic void addCloseListener(ServerConnection.CloseListener listener)
ServerConnection
addCloseListener
in class ServerConnection
listener
- The close listenerprotected org.xnio.StreamConnection upgradeChannel()
ServerConnection
upgradeChannel
in class ServerConnection
protected org.xnio.conduits.ConduitStreamSinkChannel getSinkChannel()
getSinkChannel
in class ServerConnection
protected org.xnio.conduits.ConduitStreamSourceChannel getSourceChannel()
getSourceChannel
in class ServerConnection
protected org.xnio.conduits.StreamSinkConduit getSinkConduit(HttpServerExchange exchange, org.xnio.conduits.StreamSinkConduit conduit)
ServerConnection
getSinkConduit
in class ServerConnection
protected boolean isUpgradeSupported()
isUpgradeSupported
in class ServerConnection
protected boolean isConnectSupported()
isConnectSupported
in class ServerConnection
true
if this connection supports the HTTP CONNECT verbprotected void exchangeComplete(HttpServerExchange exchange)
ServerConnection
exchangeComplete
in class ServerConnection
protected void setUpgradeListener(HttpUpgradeListener upgradeListener)
setUpgradeListener
in class ServerConnection
protected void setConnectListener(HttpUpgradeListener connectListener)
setConnectListener
in class ServerConnection
protected void maxEntitySizeUpdated(HttpServerExchange exchange)
ServerConnection
maxEntitySizeUpdated
in class ServerConnection
exchange
- The current exchangepublic <T> void addToAttachmentList(AttachmentKey<AttachmentList<T>> key, T value)
AbstractAttachable
addToAttachmentList
in interface Attachable
addToAttachmentList
in class AbstractAttachable
T
- the list value typekey
- the attachment keyvalue
- the value to addpublic <T> T removeAttachment(AttachmentKey<T> key)
AbstractAttachable
removeAttachment
in interface Attachable
removeAttachment
in class AbstractAttachable
T
- the value typekey
- the attachment keynull
if there was nonepublic <T> T putAttachment(AttachmentKey<T> key, T value)
AbstractAttachable
null
, the attachment key is removed.putAttachment
in interface Attachable
putAttachment
in class AbstractAttachable
T
- the value typekey
- the attachment keyvalue
- the new valuenull
if there was nonepublic <T> List<T> getAttachmentList(AttachmentKey<? extends List<T>> key)
AbstractAttachable
getAttachmentList
in interface Attachable
getAttachmentList
in class AbstractAttachable
T
- the value typekey
- the attachment keypublic <T> T getAttachment(AttachmentKey<T> key)
AbstractAttachable
null
is returned.getAttachment
in interface Attachable
getAttachment
in class AbstractAttachable
T
- the value typekey
- the attachment keynull
if there is nonepublic boolean isPushSupported()
isPushSupported
in class ServerConnection
public boolean isRequestTrailerFieldsSupported()
isRequestTrailerFieldsSupported
in class ServerConnection
public boolean pushResource(String path, HttpString method, HeaderMap requestHeaders)
ServerConnection
pushResource
in class ServerConnection
path
- The path of the resourcemethod
- The request methodrequestHeaders
- The request headerstrue
if the server attempted the push, false otherwisepublic boolean pushResource(String path, HttpString method, HeaderMap requestHeaders, HttpHandler handler)
ServerConnection
HttpHandler
passed in will be used to generate the pushed responsepushResource
in class ServerConnection
path
- The path of the resourcemethod
- The request methodrequestHeaders
- The request headerstrue
if the server attempted the push, false otherwisepublic String getTransportProtocol()
ServerConnection
getTransportProtocol
in class ServerConnection
Copyright © 2020 JBoss by Red Hat. All rights reserved.