Class HttpServerMultiplexChannelHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<Object>
-
- org.apache.camel.component.netty.http.handlers.HttpServerMultiplexChannelHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,HttpServerConsumerChannelFactory
@Sharable public class HttpServerMultiplexChannelHandler extends io.netty.channel.SimpleChannelInboundHandler<Object> implements HttpServerConsumerChannelFactory
A multiplexHttpServerInitializerFactory
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 nettyServerBootstrap
-
-
Constructor Summary
Constructors Constructor Description HttpServerMultiplexChannelHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addConsumer(NettyHttpConsumer consumer)
Adds the given consumer.protected void
channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg)
int
consumers()
Number of active consumersvoid
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
io.netty.channel.ChannelHandler
getChannelHandler()
Gets theChannelHandler
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-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Method Detail
-
init
public void init(int port)
Description copied from interface:HttpServerConsumerChannelFactory
Initializes this consumer channel factory with the given port.- Specified by:
init
in interfaceHttpServerConsumerChannelFactory
-
addConsumer
public void addConsumer(NettyHttpConsumer consumer)
Description copied from interface:HttpServerConsumerChannelFactory
Adds the given consumer.- Specified by:
addConsumer
in interfaceHttpServerConsumerChannelFactory
-
removeConsumer
public void removeConsumer(NettyHttpConsumer consumer)
Description copied from interface:HttpServerConsumerChannelFactory
Removes the given consumer- Specified by:
removeConsumer
in interfaceHttpServerConsumerChannelFactory
-
consumers
public int consumers()
Description copied from interface:HttpServerConsumerChannelFactory
Number of active consumers- Specified by:
consumers
in interfaceHttpServerConsumerChannelFactory
-
getPort
public int getPort()
Description copied from interface:HttpServerConsumerChannelFactory
The port number this consumer channel factory is using.- Specified by:
getPort
in interfaceHttpServerConsumerChannelFactory
-
getChannelHandler
public io.netty.channel.ChannelHandler getChannelHandler()
Description copied from interface:HttpServerConsumerChannelFactory
Gets theChannelHandler
- Specified by:
getChannelHandler
in interfaceHttpServerConsumerChannelFactory
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
-