public class OptionalSslHandler extends ByteToMessageDecoder
OptionalSslHandler是基于收到的第一条消息支持SSL和非SSL处理程序的实用程序解码器。
ByteToMessageDecoder.CumulatorChannelHandler.SharableCOMPOSITE_CUMULATOR, MERGE_CUMULATOR| Constructor and Description |
|---|
OptionalSslHandler(SslContext sslContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(ChannelHandlerContext context, ByteBuf in, java.util.List<java.lang.Object> out)
解码从一个 ByteBuf到另一个。
|
protected ChannelHandler |
newNonSslHandler(ChannelHandlerContext context)
重写以配置ChannelHandler。
|
protected java.lang.String |
newNonSslHandlerName()
可选地指定非SSL处理程序名称,此方法可能会返回
null 。
|
protected SslHandler |
newSslHandler(ChannelHandlerContext context, SslContext sslContext)
重写配置SslHandler例如。
|
protected java.lang.String |
newSslHandlerName()
可选地指定SSL处理程序名称,此方法可能会返回
null 。
|
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAddedpublic OptionalSslHandler(SslContext sslContext)
protected void decode(ChannelHandlerContext context, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
ByteToMessageDecoder
decode在课堂上
ByteToMessageDecoder
context - ByteToMessageDecoder所属的ChannelHandlerContext
in - 从中读取数据的ByteBuf
out - 应该添加解码消息的
List
java.lang.Exception - 如果发生错误则抛出
protected java.lang.String newSslHandlerName()
null 。
protected SslHandler newSslHandler(ChannelHandlerContext context, SslContext sslContext)
SSLParameters.setEndpointIdentificationAlgorithm(String) 。
此方法不知道主机名和端口,因此服务器可能希望覆盖此方法并使用SslContext.newHandler(ByteBufAllocator, String, int)变体。
context - 使用ChannelHandlerContext 。
sslContext - 使用
SSLContext 。
SslHandler如果流量是SSL,它将替换管道中的OptionalSslHandler 。
protected java.lang.String newNonSslHandlerName()
null 。
protected ChannelHandler newNonSslHandler(ChannelHandlerContext context)
context - 使用ChannelHandlerContext 。
ChannelHandler which will replace the
OptionalSslHandler in the pipeline or
null to simply remove the
OptionalSslHandler if the traffic is non-SSL.
Copyright © 2008–2018 The Netty Project. All rights reserved.