Top Description Fields Constructors Methods
io.netty.handler.codec.http2

public Class HttpToHttp2ConnectionHandler

extends Http2ConnectionHandler
Class Inheritance
Annotations
@UnstableApi
Imports
io.netty.buffer.ByteBuf, io.netty.channel.ChannelHandlerContext, .ChannelPromise, io.netty.handler.codec.http.EmptyHttpHeaders, .FullHttpMessage, .HttpContent, .HttpHeaders, .HttpMessage, .HttpScheme, .LastHttpContent, io.netty.handler.codec.http2.Http2CodecUtil.SimpleChannelPromiseAggregator, io.netty.util.ReferenceCountUtil, io.netty.util.internal.UnstableApi

Translates HTTP/1.x object writes into HTTP/2 frames.

See InboundHttp2ToHttpAdapter to get translation from HTTP/2 frames to HTTP/1.x objects.

Field Summary

Modifier and TypeField and Description
private int
private HttpScheme
private final boolean

Constructor Summary

AccessConstructor and Description
protected
HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders)

protected
HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders, boolean decoupleCloseAndGoAway)

protected
HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders, boolean decoupleCloseAndGoAway, HttpScheme httpScheme)

protected
HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders, boolean decoupleCloseAndGoAway, boolean flushPreface, HttpScheme httpScheme)

Method Summary

Modifier and TypeMethod and Description
private int

Returns:

The stream id to use with this HttpHeaders object
getStreamId
(HttpHeaders
The HTTP/1.x headers object to look for the stream id
httpHeaders
)

Get the next stream id either from the HttpHeaders object or HTTP/2 codec

public void
write(ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
,
ChannelPromise
the ChannelPromise to notify once the operation completes
promise
)

Overrides io.netty.handler.codec.http2.Http2ConnectionHandler.write.

Implements io.netty.channel.ChannelOutboundHandler.write.

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)

Inherited from io.netty.handler.codec.http2.Http2ConnectionHandler:
bindchannelActivechannelInactivechannelReadCompletechannelReadComplete0channelWritabilityChangedclosecloseStreamcloseStreamLocalcloseStreamRemoteconnectconnectiondecodedecoderderegisterdisconnectencoderexceptionCaughtflushframeWritergoAwaygracefulShutdownTimeoutMillisgracefulShutdownTimeoutMillishandlerAddedhandlerRemoved0handleServerHeaderDecodeSizeErrorisGracefulShutdownCompleteonConnectionErroronErroronHttpClientUpgradeonHttpServerUpgradeonStreamErrorreadresetStream

Field Detail

currentStreamIdback to summary
private int currentStreamId
httpSchemeback to summary
private HttpScheme httpScheme
validateHeadersback to summary
private final boolean validateHeaders

Constructor Detail

HttpToHttp2ConnectionHandlerback to summary
protected HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders)
HttpToHttp2ConnectionHandlerback to summary
protected HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders, boolean decoupleCloseAndGoAway)
HttpToHttp2ConnectionHandlerback to summary
protected HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders, boolean decoupleCloseAndGoAway, HttpScheme httpScheme)
HttpToHttp2ConnectionHandlerback to summary
protected HttpToHttp2ConnectionHandler(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder, Http2Settings initialSettings, boolean validateHeaders, boolean decoupleCloseAndGoAway, boolean flushPreface, HttpScheme httpScheme)

Method Detail

getStreamIdback to summary
private int getStreamId(HttpHeaders httpHeaders) throws Exception

Get the next stream id either from the HttpHeaders object or HTTP/2 codec

Parameters
httpHeaders:HttpHeaders

The HTTP/1.x headers object to look for the stream id

Returns:int

The stream id to use with this HttpHeaders object

Exceptions
Exception:
If the httpHeaders object specifies an invalid stream id
writeback to summary
public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)

Overrides io.netty.handler.codec.http2.Http2ConnectionHandler.write.

Implements io.netty.channel.ChannelOutboundHandler.write.

Handles conversion of HttpMessage and HttpContent to HTTP/2 frames.

Parameters
ctx:ChannelHandlerContext

Doc from io.netty.channel.ChannelOutboundHandler.write.

the ChannelHandlerContext for which the write operation is made

msg:Object

Doc from io.netty.channel.ChannelOutboundHandler.write.

the message to write

promise:ChannelPromise

Doc from io.netty.channel.ChannelOutboundHandler.write.

the ChannelPromise to notify once the operation completes

Annotations
@Override
writeHeadersback to summary
private static void writeHeaders(ChannelHandlerContext ctx, Http2ConnectionEncoder encoder, int streamId, HttpHeaders headers, Http2Headers http2Headers, boolean endStream, Http2CodecUtil.SimpleChannelPromiseAggregator promiseAggregator)