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 multiplex
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-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConsumer(NettyHttpConsumer consumer) Adds the given consumer.protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) intNumber of active consumersvoidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) io.netty.channel.ChannelHandlerGets theChannelHandlerintgetPort()The port number this consumer channel factory is using.voidinit(int port) Initializes this consumer channel factory with the given port.voidremoveConsumer(NettyHttpConsumer consumer) Removes the given consumerMethods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
Constructor Details
-
HttpServerMultiplexChannelHandler
public HttpServerMultiplexChannelHandler()
-
-
Method Details
-
init
public void init(int port) Description copied from interface:HttpServerConsumerChannelFactoryInitializes this consumer channel factory with the given port.- Specified by:
initin interfaceHttpServerConsumerChannelFactory
-
addConsumer
Description copied from interface:HttpServerConsumerChannelFactoryAdds the given consumer.- Specified by:
addConsumerin interfaceHttpServerConsumerChannelFactory
-
removeConsumer
Description copied from interface:HttpServerConsumerChannelFactoryRemoves the given consumer- Specified by:
removeConsumerin interfaceHttpServerConsumerChannelFactory
-
consumers
public int consumers()Description copied from interface:HttpServerConsumerChannelFactoryNumber of active consumers- Specified by:
consumersin interfaceHttpServerConsumerChannelFactory
-
getPort
public int getPort()Description copied from interface:HttpServerConsumerChannelFactoryThe port number this consumer channel factory is using.- Specified by:
getPortin interfaceHttpServerConsumerChannelFactory
-
getChannelHandler
public io.netty.channel.ChannelHandler getChannelHandler()Description copied from interface:HttpServerConsumerChannelFactoryGets theChannelHandler- Specified by:
getChannelHandlerin interfaceHttpServerConsumerChannelFactory
-
channelRead0
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception - Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter- Throws:
Exception
-