@UnstableApi public class InboundHttp2ToHttpAdapter extends Http2EventAdapter
请参阅HttpToHttp2ConnectionHandler以获取从HTTP / 1.x对象到HTTP / 2帧的写入以进行写入。
| Modifier and Type | Field and Description |
|---|---|
protected Http2Connection |
connection |
protected boolean |
validateHttpHeaders |
| Modifier | Constructor and Description |
|---|---|
protected |
InboundHttp2ToHttpAdapter(Http2Connection connection, int maxContentLength, boolean validateHttpHeaders, boolean propagateSettings) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
fireChannelRead(ChannelHandlerContext ctx, FullHttpMessage msg, boolean release, Http2Stream stream)
设置最终标题并启动频道阅读事件
|
protected FullHttpMessage |
getMessage(Http2Stream stream)
获取与stream关联的 stream 。
|
protected FullHttpMessage |
newMessage(Http2Stream stream, Http2Headers headers, boolean validateHttpHeaders, ByteBufAllocator alloc)
根据当前连接参数创建一个新的 FullHttpMessage
|
int |
onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream)
处理入站
DATA框架。
|
void |
onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endOfStream)
处理入站
HEADERS帧。
|
void |
onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream)
处理带有指定优先级信息的入站
HEADERS帧。
|
void |
onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding)
处理入站
PUSH_PROMISE框架。
|
void |
onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode)
处理入站
RST_STREAM框架。
|
protected void |
onRstStreamRead(Http2Stream stream, FullHttpMessage msg)
如果收到
RST_STREAM则调用,但我们有该流的一些数据。
|
void |
onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings)
处理入站
SETTINGS框架。
|
void |
onStreamRemoved(Http2Stream stream)
通知监听者,给定的数据流现在已经从连接中移除,不再通过
Http2Connection.stream(int)返回。
|
protected FullHttpMessage |
processHeadersBegin(ChannelHandlerContext ctx, Http2Stream stream, Http2Headers headers, boolean endOfStream, boolean allowAppend, boolean appendToTrailer)
提供HTTP / 2和HTTP头对象之间的转换,同时确保流处于额外头的有效状态。
|
protected void |
putMessage(Http2Stream stream, FullHttpMessage message)
使
message成为与
stream相关的州。
|
protected void |
removeMessage(Http2Stream stream, boolean release)
该流超出了HTTP消息流的范围,将不再被跟踪
|
onGoAwayRead, onGoAwayReceived, onGoAwaySent, onPingAckRead, onPingRead, onPriorityRead, onSettingsAckRead, onStreamActive, onStreamAdded, onStreamClosed, onStreamHalfClosed, onUnknownFrame, onWindowUpdateReadprotected final Http2Connection connection
protected final boolean validateHttpHeaders
protected InboundHttp2ToHttpAdapter(Http2Connection connection, int maxContentLength, boolean validateHttpHeaders, boolean propagateSettings)
protected final void removeMessage(Http2Stream stream, boolean release)
stream - 要移除关联状态的流
release - true如果存在该值,则调用释放。
false不要致电发布。
protected final FullHttpMessage getMessage(Http2Stream stream)
stream 。
stream - 从中获取关联状态的流
FullHttpMessage与stream相关联。
protected final void putMessage(Http2Stream stream, FullHttpMessage message)
message成为与
stream相关联的州。
stream - 与
message相关联的流。
message - 包含HTTP语义的消息。
public void onStreamRemoved(Http2Stream stream)
Http2Connection.Listener复制的描述
Http2Connection.stream(int)返回。
在删除它们之前,连接可能会保持一段时间不活动的流。
如果RuntimeException被抛出,它将被记录并且不被传播 。 不支持从此方法中抛出并被视为编程错误。
onStreamRemoved在界面
Http2Connection.Listener
onStreamRemoved ,班级
Http2EventAdapter
protected void fireChannelRead(ChannelHandlerContext ctx, FullHttpMessage msg, boolean release, Http2Stream stream)
ctx - 触发事件的上下文
msg - 要发送的消息
release - true如果存在值,则调用释放值。
false不要致电发布。
stream - 正在触发的消息流
protected FullHttpMessage newMessage(Http2Stream stream, Http2Headers headers, boolean validateHttpHeaders, ByteBufAllocator alloc) throws Http2Exception
FullHttpMessage
stream - 为其创建消息的流
headers - 与
stream关联的标题
validateHttpHeaders -
true验证http-codec中的HTTP头 false不要验证http-codec中的HTTP标头 alloc - ByteBufAllocator用于生成消息的内容
Http2Exception
protected FullHttpMessage processHeadersBegin(ChannelHandlerContext ctx, Http2Stream stream, Http2Headers headers, boolean endOfStream, boolean allowAppend, boolean appendToTrailer) throws Http2Exception
ctx - 收到此消息的上下文。
用于发送信息头,如果检测到。
stream -在流
headers适用于
headers - 要处理的标题
endOfStream -
true如果
stream已收到流标志的结尾
allowAppend -
true如果流已经存在,将会追加标题。 false和流已经存在,则此方法返回null 。 appendToTrailer -
true如果消息stream已经存在,那么应该将标题添加到尾部标题。 false然后将追加到最初的标题。 stream的流的对象。
null如果allowAppend是false且流已经存在。
Http2Exception - 如果流标识未处于正确的状态以处理标头请求
public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) throws Http2Exception
Http2FrameListener复制的描述
DATA框架。
onDataRead在界面
Http2FrameListener
onDataRead在课程
Http2EventAdapter
ctx - 读取框架的句柄的上下文。
streamId - 帧的主题流。
data - 帧的有效载荷缓冲区。
该缓冲区将由编解码器释放。
padding - 应添加的其他字节以掩盖真实的内容大小。
必须介于0和256(含)之间。
endOfStream - 指示这是否是来自此流的远程端点的最后一个帧。
WINDOW_UPDATE )。
返回等于data + padding长度的值将有效地选择退出该帧的应用程序级流量控制。
返回小于data + padding长度的值将推迟处理字节的返回,该处理后的字节必须稍后通过Http2LocalFlowController.consumeBytes(Http2Stream, int)返回。
返回的值必须大于0 ,小于data.readableBytes() + padding 。
Http2Exception
public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endOfStream) throws Http2Exception
Http2FrameListener
HEADERS框架。
每个HEADERS帧序列只会调用以下方法之一。 当收到END_HEADERS标志时将会调用一个。
Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean) Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean) Http2FrameListener.onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int) 换一种说法; Http2Headers将包含当前消息交换步骤的所有标题(不需要额外的排队)。
onHeadersRead在界面
Http2FrameListener
onHeadersRead在课程
Http2EventAdapter
ctx - 读取帧的处理程序的上下文。
streamId - 框架的主题流。
headers - 收到的标题。
padding - 应添加的其他字节以掩盖真正的内容大小。
必须介于0和256(含)之间。
endOfStream - 指示这是否是来自此流的远程端点的最后一个帧。
Http2Exception
public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream) throws Http2Exception
Http2FrameListener复制的描述
HEADERS帧。
只有在遇到END_HEADERS时END_HEADERS调用。
每个HEADERS帧序列只会调用以下方法之一。 当收到END_HEADERS标志时将会调用一个。
Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean) Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean) Http2FrameListener.onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int) 换一种说法; Http2Headers将包含当前消息交换步骤的所有标题(不需要额外的排队)。
onHeadersRead在界面
Http2FrameListener
onHeadersRead在课程
Http2EventAdapter
ctx - 读取帧的处理程序的上下文。
streamId - 框架的主题流。
headers - 收到的标题。
streamDependency - 此流依赖的流,如果依赖于连接,则为0。
weight - 流的新权重。
exclusive - 流是否应该是其父项的排他依赖项。
padding - 应添加的其他字节以遮盖真正的内容大小。
必须介于0和256(含)之间。
endOfStream - 指示这是否是来自此流的远程端点的最后一个帧。
Http2Exception
public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode) throws Http2Exception
Http2FrameListener
RST_STREAM框架。
onRstStreamRead ,界面
Http2FrameListener
onRstStreamRead在课程
Http2EventAdapter
ctx - 读取帧的句柄的上下文。
streamId - 正在终止的流。
errorCode - 识别故障类型的错误代码。
Http2Exception
public void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding) throws Http2Exception
Http2FrameListener
PUSH_PROMISE框架。
只有在遇到END_HEADERS时END_HEADERS调用。
承诺的请求必须是权威的,可缓存的和安全的。 见[RFC http2], Section 8.2 。
每个HEADERS帧序列将只调用以下方法之一。 当收到END_HEADERS标志时将会调用一个。
Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean) Http2FrameListener.onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean) Http2FrameListener.onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int) 换一种说法; Http2Headers将包含当前消息交换步骤的所有标题(不需要额外的排队)。
onPushPromiseRead在界面
Http2FrameListener
onPushPromiseRead在课程
Http2EventAdapter
ctx - 读取框架的句柄的上下文。
streamId - 帧被发送的流。
promisedStreamId - 承诺流的ID。
headers - 收到的标题。
padding - 应添加的额外字节以掩盖真实的内容大小。
必须介于0和256(含)之间。
Http2Exception
public void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings) throws Http2Exception
Http2FrameListener复制的描述
SETTINGS框架。
onSettingsRead在界面
Http2FrameListener
onSettingsRead在课程
Http2EventAdapter
ctx - 读取框架的句柄的上下文。
settings - 从远程端点接收的设置。
Http2Exception
protected void onRstStreamRead(Http2Stream stream, FullHttpMessage msg)
RST_STREAM is received but we have some data for that stream.
Copyright © 2008–2018 The Netty Project. All rights reserved.