public class HTTP2ServerConnection extends HTTP2Connection implements Connection.UpgradeTo
Modifier and Type | Class and Description |
---|---|
protected class |
HTTP2ServerConnection.ServerHttpChannelOverHTTP2 |
HTTP2Connection.HTTP2Producer
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Modifier and Type | Field and Description |
---|---|
private java.util.Queue<HttpChannelOverHTTP2> |
channels |
private HttpConfiguration |
httpConfig |
private ServerSessionListener |
listener |
private boolean |
recycleHttpChannels |
private java.util.concurrent.atomic.AtomicLong |
totalRequests |
private java.util.concurrent.atomic.AtomicLong |
totalResponses |
private java.util.List<Frame> |
upgradeFrames |
LOG
Constructor and Description |
---|
HTTP2ServerConnection(ByteBufferPool byteBufferPool,
java.util.concurrent.Executor executor,
EndPoint endPoint,
HttpConfiguration httpConfig,
ServerParser parser,
ISession session,
int inputBufferSize,
ServerSessionListener listener) |
Modifier and Type | Method and Description |
---|---|
long |
getMessagesIn() |
long |
getMessagesOut() |
protected ServerParser |
getParser() |
boolean |
isRecycleHttpChannels() |
static boolean |
isSupportedProtocol(java.lang.String protocol) |
protected HTTP2ServerConnection.ServerHttpChannelOverHTTP2 |
newServerHttpChannelOverHTTP2(Connector connector,
HttpConfiguration httpConfig,
HttpTransportOverHTTP2 transport) |
private void |
notifyAccept(ISession session) |
private void |
offerHttpChannel(HttpChannelOverHTTP2 channel) |
void |
onData(IStream stream,
DataFrame frame,
Callback callback) |
void |
onNewStream(Connector connector,
IStream stream,
HeadersFrame frame) |
void |
onOpen()
Callback method invoked when this connection is opened.
|
void |
onSessionFailure(java.lang.Throwable failure,
Callback callback) |
boolean |
onSessionTimeout(java.lang.Throwable failure) |
void |
onStreamFailure(IStream stream,
java.lang.Throwable failure,
Callback callback) |
boolean |
onStreamTimeout(IStream stream,
java.lang.Throwable failure) |
void |
onTrailers(IStream stream,
HeadersFrame frame) |
void |
onUpgradeTo(java.nio.ByteBuffer buffer)
Callback method invoked when this connection is upgraded.
|
private HttpChannelOverHTTP2 |
pollHttpChannel() |
private HttpChannelOverHTTP2 |
provideHttpChannel(Connector connector,
IStream stream) |
void |
push(Connector connector,
IStream stream,
MetaData.Request request) |
void |
setRecycleHttpChannels(boolean recycleHttpChannels) |
boolean |
upgrade(MetaData.Request request) |
close, dispatch, getBytesIn, getBytesOut, getSession, offerTask, onClose, onFillable, onFlushed, onIdleExpired, produce, setInputBuffer
addListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onFillInterestedFailed, onReadTimeout, removeListener, setInputBufferSize, toConnectionString, toString, tryFillInterested, tryFillInterested
private final java.util.Queue<HttpChannelOverHTTP2> channels
private final java.util.List<Frame> upgradeFrames
private final java.util.concurrent.atomic.AtomicLong totalRequests
private final java.util.concurrent.atomic.AtomicLong totalResponses
private final ServerSessionListener listener
private final HttpConfiguration httpConfig
private boolean recycleHttpChannels
public HTTP2ServerConnection(ByteBufferPool byteBufferPool, java.util.concurrent.Executor executor, EndPoint endPoint, HttpConfiguration httpConfig, ServerParser parser, ISession session, int inputBufferSize, ServerSessionListener listener)
public static boolean isSupportedProtocol(java.lang.String protocol)
protocol
- A HTTP2 protocol variantpublic long getMessagesIn()
getMessagesIn
in interface Connection
getMessagesIn
in class AbstractConnection
public long getMessagesOut()
getMessagesOut
in interface Connection
getMessagesOut
in class AbstractConnection
protected ServerParser getParser()
getParser
in class HTTP2Connection
public boolean isRecycleHttpChannels()
public void setRecycleHttpChannels(boolean recycleHttpChannels)
public void onUpgradeTo(java.nio.ByteBuffer buffer)
Connection.UpgradeTo
Callback method invoked when this connection is upgraded.
This must be called before Connection.onOpen()
.
onUpgradeTo
in interface Connection.UpgradeTo
buffer
- An optional buffer that can contain prefilled data. Typically this
results from an upgrade of one protocol to the other where the old connection has buffered
data destined for the new connection. The new connection must take ownership of the buffer
and is responsible for returning it to the buffer poolpublic void onOpen()
Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen
in interface Connection
onOpen
in class HTTP2Connection
private void notifyAccept(ISession session)
public void onNewStream(Connector connector, IStream stream, HeadersFrame frame)
public void onTrailers(IStream stream, HeadersFrame frame)
public boolean onStreamTimeout(IStream stream, java.lang.Throwable failure)
public void onStreamFailure(IStream stream, java.lang.Throwable failure, Callback callback)
public boolean onSessionTimeout(java.lang.Throwable failure)
public void onSessionFailure(java.lang.Throwable failure, Callback callback)
public void push(Connector connector, IStream stream, MetaData.Request request)
private HttpChannelOverHTTP2 provideHttpChannel(Connector connector, IStream stream)
protected HTTP2ServerConnection.ServerHttpChannelOverHTTP2 newServerHttpChannelOverHTTP2(Connector connector, HttpConfiguration httpConfig, HttpTransportOverHTTP2 transport)
private void offerHttpChannel(HttpChannelOverHTTP2 channel)
private HttpChannelOverHTTP2 pollHttpChannel()
public boolean upgrade(MetaData.Request request)