public class OptionalSslHandler extends ByteToMessageDecoder
OptionalSslHandler is a utility decoder to support both SSL and non-SSL handlers
based on the first message received.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)
Decode the from one
ByteBuf to an other. |
protected ChannelHandler |
newNonSslHandler(ChannelHandlerContext context)
Override to configure the ChannelHandler.
|
protected java.lang.String |
newNonSslHandlerName()
Optionally specify the non-SSL handler name, this method may return
null. |
protected SslHandler |
newSslHandler(ChannelHandlerContext context,
SslContext sslContext)
Override to configure the SslHandler eg.
|
protected java.lang.String |
newSslHandlerName()
Optionally specify the SSL handler name, this method may return
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
ByteToMessageDecoderByteBuf to an other. This method will be called till either the input
ByteBuf has nothing to read when return from this method or till nothing was read from the input
ByteBuf.decode in class ByteToMessageDecodercontext - the ChannelHandlerContext which this ByteToMessageDecoder belongs toin - the ByteBuf from which to read dataout - the List to which decoded messages should be addedjava.lang.Exception - is thrown if an error occursprotected java.lang.String newSslHandlerName()
null.protected SslHandler newSslHandler(ChannelHandlerContext context, SslContext sslContext)
SSLParameters.setEndpointIdentificationAlgorithm(String).
The hostname and port is not known by this method so servers may want to override this method and use the
SslContext.newHandler(ByteBufAllocator, String, int) variant.context - the ChannelHandlerContext to use.sslContext - the SSLContext to use.SslHandler which will replace the OptionalSslHandler in the pipeline if the
traffic is SSL.protected java.lang.String newNonSslHandlerName()
null.protected ChannelHandler newNonSslHandler(ChannelHandlerContext context)
context - the ChannelHandlerContext to use.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.