@UnstableApi @ChannelHandler.Sharable public class Http2StreamFrameToHttpObjectCodec extends MessageToMessageCodec<Http2StreamFrame,HttpObject>
Http2StreamFrame
转换为HttpObject
,然后返回。
它可以作为适配器与Http2MultiplexCodec
一起使用,以使http / 2连接向后兼容ChannelHandler
s期望HttpObject
为简单起见,它将转换为分块编码,除非整个流为单个标头。
ChannelHandler.Sharable
Constructor and Description |
---|
Http2StreamFrameToHttpObjectCodec(boolean isServer) |
Http2StreamFrameToHttpObjectCodec(boolean isServer, boolean validateHeaders) |
Modifier and Type | Method and Description |
---|---|
boolean |
acceptInboundMessage(java.lang.Object msg)
当且仅当指定的消息可以被该编解码器解码时返回
true 。
|
protected void |
decode(ChannelHandlerContext ctx, Http2StreamFrame frame, java.util.List<java.lang.Object> out) |
protected void |
encode(ChannelHandlerContext ctx, HttpObject obj, java.util.List<java.lang.Object> out)
|
void |
handlerAdded(ChannelHandlerContext ctx)
子类可以忽略这个方法。
|
protected boolean |
isSsl(ChannelHandlerContext ctx) |
acceptOutboundMessage, channelRead, write
bind, close, connect, deregister, disconnect, flush, read
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggered
ensureNotSharable, handlerRemoved, isSharable
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
exceptionCaught, handlerRemoved
public Http2StreamFrameToHttpObjectCodec(boolean isServer, boolean validateHeaders)
public Http2StreamFrameToHttpObjectCodec(boolean isServer)
public boolean acceptInboundMessage(java.lang.Object msg) throws java.lang.Exception
MessageToMessageCodec
true
。
acceptInboundMessage
在课堂上
MessageToMessageCodec<Http2StreamFrame,HttpObject>
msg
- 消息
java.lang.Exception
protected void decode(ChannelHandlerContext ctx, Http2StreamFrame frame, java.util.List<java.lang.Object> out) throws java.lang.Exception
decode
,班级
MessageToMessageCodec<Http2StreamFrame,HttpObject>
java.lang.Exception
MessageToMessageDecoder.decode(ChannelHandlerContext, Object, List)
protected void encode(ChannelHandlerContext ctx, HttpObject obj, java.util.List<java.lang.Object> out) throws java.lang.Exception
encode
class
MessageToMessageCodec<Http2StreamFrame,HttpObject>
ctx
- 这个处理程序属于的ChannelHandlerContext
obj
- 要编码的HttpObject
消息
out
- 应该添加编码味精的
List
需要做某种聚合
java.lang.Exception
- 如果发生错误则抛出
MessageToMessageEncoder.encode(ChannelHandlerContext, Object, List)
public void handlerAdded(ChannelHandlerContext ctx) throws java.lang.Exception
ChannelHandlerAdapter
handlerAdded
在界面
ChannelHandler
handlerAdded
class
ChannelHandlerAdapter
java.lang.Exception
protected boolean isSsl(ChannelHandlerContext ctx)
Copyright © 2008–2018 The Netty Project. All rights reserved.