@ChannelHandler.Sharable public class HttpServerMultiplexChannelHandler extends io.netty.channel.SimpleChannelInboundHandler<Object> implements HttpServerConsumerChannelFactory
HttpServerInitializerFactory
which keeps a list of handlers, and delegates to the
target handler based on the http context path in the incoming request. This is used to allow to reuse
the same Netty consumer, allowing to have multiple routes on the same netty ServerBootstrap
Constructor and Description |
---|
HttpServerMultiplexChannelHandler() |
Modifier and Type | Method and Description |
---|---|
void |
addConsumer(NettyHttpConsumer consumer)
Adds the given consumer.
|
protected void |
channelRead0(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
int |
consumers()
Number of active consumers
|
void |
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
Throwable cause) |
io.netty.channel.ChannelHandler |
getChannelHandler()
Gets the
ChannelHandler |
int |
getPort()
The port number this consumer channel factory is using.
|
void |
init(int port)
Initializes this consumer channel factory with the given port.
|
void |
removeConsumer(NettyHttpConsumer consumer)
Removes the given consumer
|
acceptInboundMessage, channelRead
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
public void init(int port)
HttpServerConsumerChannelFactory
init
in interface HttpServerConsumerChannelFactory
public void addConsumer(NettyHttpConsumer consumer)
HttpServerConsumerChannelFactory
addConsumer
in interface HttpServerConsumerChannelFactory
public void removeConsumer(NettyHttpConsumer consumer)
HttpServerConsumerChannelFactory
removeConsumer
in interface HttpServerConsumerChannelFactory
public int consumers()
HttpServerConsumerChannelFactory
consumers
in interface HttpServerConsumerChannelFactory
public int getPort()
HttpServerConsumerChannelFactory
getPort
in interface HttpServerConsumerChannelFactory
public io.netty.channel.ChannelHandler getChannelHandler()
HttpServerConsumerChannelFactory
ChannelHandler
getChannelHandler
in interface HttpServerConsumerChannelFactory
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
exceptionCaught
in interface io.netty.channel.ChannelHandler
exceptionCaught
in interface io.netty.channel.ChannelInboundHandler
exceptionCaught
in class io.netty.channel.ChannelInboundHandlerAdapter
Exception
Apache Camel