@UnstableApi public class HttpToHttp2ConnectionHandler extends Http2ConnectionHandler
See InboundHttp2ToHttpAdapter
to get translation from HTTP/2 frames to HTTP/1.x objects.
ByteToMessageDecoder.Cumulator
ChannelHandler.Sharable
Modifier and Type | Field and Description |
---|---|
private int |
currentStreamId |
private boolean |
validateHeaders |
COMPOSITE_CUMULATOR, MERGE_CUMULATOR
Modifier | Constructor and Description |
---|---|
protected |
HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder,
Http2ConnectionEncoder encoder,
Http2Settings initialSettings,
boolean validateHeaders) |
Modifier and Type | Method and Description |
---|---|
private int |
getStreamId(HttpHeaders httpHeaders)
Get the next stream id either from the
HttpHeaders object or HTTP/2 codec |
void |
write(ChannelHandlerContext ctx,
java.lang.Object msg,
ChannelPromise promise)
Handles conversion of
HttpMessage and HttpContent to HTTP/2 frames. |
private static void |
writeHeaders(ChannelHandlerContext ctx,
Http2ConnectionEncoder encoder,
int streamId,
HttpHeaders headers,
Http2Headers http2Headers,
boolean endStream,
Http2CodecUtil.SimpleChannelPromiseAggregator promiseAggregator) |
bind, channelActive, channelInactive, channelReadComplete, channelWritabilityChanged, close, closeStream, closeStreamLocal, closeStreamRemote, connect, connection, decode, decoder, deregister, disconnect, encoder, exceptionCaught, flush, frameWriter, goAway, gracefulShutdownTimeoutMillis, gracefulShutdownTimeoutMillis, handlerAdded, handlerRemoved0, handleServerHeaderDecodeSizeError, isGracefulShutdownComplete, onConnectionError, onError, onHttpClientUpgrade, onHttpServerUpgrade, onStreamError, read, resetStream
actualReadableBytes, callDecode, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
channelRegistered, channelUnregistered
ensureNotSharable, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handlerRemoved
private final boolean validateHeaders
private int currentStreamId
protected HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders)
private int getStreamId(HttpHeaders httpHeaders) throws java.lang.Exception
HttpHeaders
object or HTTP/2 codechttpHeaders
- The HTTP/1.x headers object to look for the stream idHttpHeaders
objectjava.lang.Exception
- If the httpHeaders
object specifies an invalid stream idpublic void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise)
HttpMessage
and HttpContent
to HTTP/2 frames.write
in interface ChannelOutboundHandler
write
in class Http2ConnectionHandler
ctx
- the ChannelHandlerContext
for which the write operation is mademsg
- the message to writepromise
- the ChannelPromise
to notify once the operation completesprivate static void writeHeaders(ChannelHandlerContext ctx, Http2ConnectionEncoder encoder, int streamId, HttpHeaders headers, Http2Headers http2Headers, boolean endStream, Http2CodecUtil.SimpleChannelPromiseAggregator promiseAggregator)