Class HttpServerChannelHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.SimpleChannelInboundHandler<Object>
-
- org.apache.camel.component.netty.handlers.ServerChannelHandler
-
- org.apache.camel.component.netty.http.handlers.HttpServerChannelHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
public class HttpServerChannelHandler extends org.apache.camel.component.netty.handlers.ServerChannelHandlerNetty HTTPServerChannelHandlerthat handles the incoming HTTP requests and routes the received message in Camel.
-
-
Constructor Summary
Constructors Constructor Description HttpServerChannelHandler(NettyHttpConsumer consumer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Subjectauthenticate(SecurityAuthenticator authenticator, org.apache.camel.LoggingLevel deniedLoggingLevel, HttpPrincipal principal)Authenticates the http basic auth subject.protected voidbeforeProcess(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message)protected voidchannelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg)protected org.apache.camel.ExchangecreateExchange(io.netty.channel.ChannelHandlerContext ctx, Object message)voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)protected static HttpPrincipalextractBasicAuthSubject(io.netty.handler.codec.http.HttpRequest request)Extracts the username and password details from the HTTP basic header Authorization.NettyHttpConsumergetConsumer()protected ObjectgetResponseBody(org.apache.camel.Exchange exchange)protected booleanmatchesRoles(String roles, String userRoles)-
Methods inherited from class org.apache.camel.component.netty.handlers.ServerChannelHandler
channelActive, channelInactive, createResponseFutureListener
-
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Constructor Detail
-
HttpServerChannelHandler
public HttpServerChannelHandler(NettyHttpConsumer consumer)
-
-
Method Detail
-
getConsumer
public NettyHttpConsumer getConsumer()
-
channelRead0
protected void channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg) throws Exception- Overrides:
channelRead0in classorg.apache.camel.component.netty.handlers.ServerChannelHandler- Throws:
Exception
-
extractBasicAuthSubject
protected static HttpPrincipal extractBasicAuthSubject(io.netty.handler.codec.http.HttpRequest request)
Extracts the username and password details from the HTTP basic header Authorization. This requires that the Authorization HTTP header is provided, and its using Basic. Currently Digest is not supported.- Returns:
HttpPrincipalwith username and password details, or null if not possible to extract
-
authenticate
protected Subject authenticate(SecurityAuthenticator authenticator, org.apache.camel.LoggingLevel deniedLoggingLevel, HttpPrincipal principal)
Authenticates the http basic auth subject.- Parameters:
authenticator- the authenticatorprincipal- the principal- Returns:
- true if username and password is valid, false if not
-
beforeProcess
protected void beforeProcess(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message)- Overrides:
beforeProcessin classorg.apache.camel.component.netty.handlers.ServerChannelHandler
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classorg.apache.camel.component.netty.handlers.ServerChannelHandler
-
getResponseBody
protected Object getResponseBody(org.apache.camel.Exchange exchange) throws Exception
- Overrides:
getResponseBodyin classorg.apache.camel.component.netty.handlers.ServerChannelHandler- Throws:
Exception
-
-