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

public Class HttpToHttp2ConnectionHandler

extends Http2ConnectionHandler
Class Inheritance
Annotations
@UnstableApi
Imports
io.netty5.buffer.Buffer, io.netty5.channel.ChannelHandlerContext, io.netty5.handler.codec.http.FullHttpMessage, .HttpContent, .HttpMessage, .HttpScheme, .LastHttpContent, io.netty5.handler.codec.http.headers.HttpHeaders, io.netty5.handler.codec.http2.Http2CodecUtil.SimpleChannelPromiseAggregator, io.netty5.handler.codec.http2.headers.Http2Headers, io.netty5.util.Resource, io.netty5.util.concurrent.Future, .Promise, io.netty5.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 Future<Void>
write(ChannelHandlerContext
the ChannelHandlerContext for which the write operation is made
ctx
,
Object
the message to write
msg
)

Overrides default io.netty5.channel.ChannelHandler.write.

Handles conversion of HttpMessage and HttpContent to HTTP/2 frames.
private static Future<Void>
writeHeaders(ChannelHandlerContext ctx, Http2ConnectionEncoder encoder, int streamId, HttpHeaders headers, Http2Headers http2Headers, boolean endStream)

Inherited from io.netty5.handler.codec.http2.Http2ConnectionHandler:
channelActivechannelExceptionCaughtchannelInactivechannelReadCompletechannelReadComplete0channelWritabilityChangedclosecloseStreamcloseStreamLocalcloseStreamRemoteconnectiondecodedecoderencoderflushframeWritergoAwaygracefulShutdownTimeoutMillisgracefulShutdownTimeoutMillishandlerAdded0handlerRemoved0handleServerHeaderDecodeSizeErrorisGracefulShutdownCompleteonConnectionErroronErroronHttpClientUpgradeonHttpServerUpgradeonStreamErrorresetStream

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 Future<Void> write(ChannelHandlerContext ctx, Object msg)

Overrides default io.netty5.channel.ChannelHandler.write.

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

Parameters
ctx:ChannelHandlerContext

Doc from io.netty5.channel.ChannelHandler.write.

the ChannelHandlerContext for which the write operation is made

msg:Object

Doc from io.netty5.channel.ChannelHandler.write.

the message to write

Returns:Future<Void>

Doc from io.netty5.channel.ChannelHandler.write.

the Future which will be notified once the operation completes.

Annotations
@Override
writeHeadersback to summary
private static Future<Void> writeHeaders(ChannelHandlerContext ctx, Http2ConnectionEncoder encoder, int streamId, HttpHeaders headers, Http2Headers http2Headers, boolean endStream)