public class OptionalSslHandler
extends io.netty.handler.codec.ByteToMessageDecoder
OptionalSslHandler
is a utility decoder to support both SSL and non-SSL handlers
based on the first message received.Constructor and Description |
---|
OptionalSslHandler(SslContext sslContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
decode(io.netty.channel.ChannelHandlerContext context,
io.netty.buffer.ByteBuf in,
List<Object> out) |
protected io.netty.channel.ChannelHandler |
newNonSslHandler(io.netty.channel.ChannelHandlerContext context)
Override to configure the ChannelHandler.
|
protected String |
newNonSslHandlerName()
Optionally specify the non-SSL handler name, this method may return
null . |
protected SslHandler |
newSslHandler(io.netty.channel.ChannelHandlerContext context,
SslContext sslContext)
Override to configure the SslHandler eg.
|
protected 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, userEventTriggered
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
ensureNotSharable, handlerAdded, isSharable
public OptionalSslHandler(SslContext sslContext)
protected void decode(io.netty.channel.ChannelHandlerContext context, io.netty.buffer.ByteBuf in, List<Object> out) throws Exception
decode
in class io.netty.handler.codec.ByteToMessageDecoder
Exception
protected String newSslHandlerName()
null
.protected SslHandler newSslHandler(io.netty.channel.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 String newNonSslHandlerName()
null
.protected io.netty.channel.ChannelHandler newNonSslHandler(io.netty.channel.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–2019 The Netty Project. All rights reserved.