public class Http2ServerConnection extends ServerConnection
ServerConnection.CloseListener
EMPTY
Constructor and Description |
---|
Http2ServerConnection(Http2Channel channel,
Http2DataStreamSinkChannel sinkChannel,
OptionMap undertowOptions,
int bufferSize,
HttpHandler rootHandler)
Channel that is used when the request is already half closed
|
Http2ServerConnection(Http2Channel channel,
Http2StreamSourceChannel requestChannel,
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()
Close this channel.
|
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.
|
Pool<ByteBuffer> |
getBufferPool() |
int |
getBufferSize() |
ByteBufferPool |
getByteBufferPool() |
ChannelListener.Setter<? extends ConnectedChannel> |
getCloseSetter()
Get the setter which can be used to change the close listener for this channel.
|
XnioIoThread |
getIoThread()
Get the I/O thread associated with this channel.
|
SocketAddress |
getLocalAddress()
Get the local address that this channel is bound to.
|
<A extends SocketAddress> |
getLocalAddress(Class<A> type)
Get the local address of a given type, or
null if the address is not of that
type. |
<T> T |
getOption(Option<T> option)
Get the value of a channel 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 ConduitStreamSinkChannel |
getSinkChannel() |
protected StreamSinkConduit |
getSinkConduit(HttpServerExchange exchange,
StreamSinkConduit conduit)
Gets the sink conduit that should be used for this request.
|
protected 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.
|
OptionMap |
getUndertowOptions() |
XnioWorker |
getWorker()
Get the worker for this channel.
|
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(Option<T> option,
T value)
Set an option for this channel.
|
void |
setSslSessionInfo(SSLSessionInfo sessionInfo)
Sets the current SSL information.
|
protected void |
setUpgradeListener(HttpUpgradeListener upgradeListener) |
boolean |
supportsOption(Option<?> option)
Determine whether an option is supported on this channel.
|
void |
terminateRequestChannel(HttpServerExchange exchange)
Invoked when the exchange is complete, and there is still data in the request channel.
|
protected StreamConnection |
upgradeChannel()
Upgrade the connection, if allowed
|
createAttachmentMap
public Http2ServerConnection(Http2Channel channel, Http2StreamSourceChannel requestChannel, OptionMap undertowOptions, int bufferSize, HttpHandler rootHandler)
public Http2ServerConnection(Http2Channel channel, Http2DataStreamSinkChannel sinkChannel, OptionMap undertowOptions, int bufferSize, HttpHandler rootHandler)
channel
- undertowOptions
- bufferSize
- rootHandler
- public 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 XnioWorker getWorker()
CloseableChannel
getWorker
in interface CloseableChannel
getWorker
in class ServerConnection
public XnioIoThread getIoThread()
CloseableChannel
getIoThread
in interface 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(Option<?> option)
Configurable
supportsOption
in interface Configurable
supportsOption
in class ServerConnection
option
- the optiontrue
if it is supportedpublic <T> T getOption(Option<T> option) throws IOException
Configurable
getOption
in interface Configurable
getOption
in class ServerConnection
T
- the type of the option valueoption
- the option to getnull
if it is not setIOException
- if an I/O error occurred when reading the optionpublic <T> T setOption(Option<T> option, T value) throws IllegalArgumentException, IOException
Configurable
setOption
in interface Configurable
setOption
in class ServerConnection
T
- the type of the option valueoption
- the option to setvalue
- the value of the option to setIllegalArgumentException
- if the value is not acceptable for this optionIOException
- if an I/O error occurred when modifying the optionpublic void close() throws IOException
CloseableChannel
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in interface InterruptibleChannel
close
in interface CloseableChannel
close
in class ServerConnection
IOException
- if the close failedpublic SocketAddress getPeerAddress()
ServerConnection
getPeerAddress
in interface ConnectedChannel
getPeerAddress
in class ServerConnection
public <A extends SocketAddress> A getPeerAddress(Class<A> type)
ServerConnection
getPeerAddress
in interface ConnectedChannel
getPeerAddress
in class ServerConnection
A
- The address typetype
- The type of address to returnpublic ChannelListener.Setter<? extends ConnectedChannel> getCloseSetter()
ConnectedChannel
public SocketAddress getLocalAddress()
BoundChannel
getLocalAddress
in interface BoundChannel
getLocalAddress
in class ServerConnection
public <A extends SocketAddress> A getLocalAddress(Class<A> type)
BoundChannel
null
if the address is not of that
type.getLocalAddress
in interface BoundChannel
getLocalAddress
in class ServerConnection
A
- the address typetype
- the address type classnull
if unknownpublic 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 StreamConnection upgradeChannel()
ServerConnection
upgradeChannel
in class ServerConnection
protected ConduitStreamSinkChannel getSinkChannel()
getSinkChannel
in class ServerConnection
protected ConduitStreamSourceChannel getSourceChannel()
getSourceChannel
in class ServerConnection
protected StreamSinkConduit getSinkConduit(HttpServerExchange exchange, 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 © 2019 JBoss by Red Hat. All rights reserved.