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.ServerChannelHandler
Netty HTTPServerChannelHandler
that 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 Subject
authenticate(SecurityAuthenticator authenticator, org.apache.camel.LoggingLevel deniedLoggingLevel, HttpPrincipal principal)
Authenticates the http basic auth subject.protected void
beforeProcess(org.apache.camel.Exchange exchange, io.netty.channel.ChannelHandlerContext ctx, Object message)
protected void
channelRead0(io.netty.channel.ChannelHandlerContext ctx, Object msg)
protected org.apache.camel.Exchange
createExchange(io.netty.channel.ChannelHandlerContext ctx, Object message)
void
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
protected static HttpPrincipal
extractBasicAuthSubject(io.netty.handler.codec.http.HttpRequest request)
Extracts the username and password details from the HTTP basic header Authorization.NettyHttpConsumer
getConsumer()
protected Object
getResponseBody(org.apache.camel.Exchange exchange)
protected boolean
matchesRoles(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:
channelRead0
in 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:
HttpPrincipal
with 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:
beforeProcess
in classorg.apache.camel.component.netty.handlers.ServerChannelHandler
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classorg.apache.camel.component.netty.handlers.ServerChannelHandler
-
getResponseBody
protected Object getResponseBody(org.apache.camel.Exchange exchange) throws Exception
- Overrides:
getResponseBody
in classorg.apache.camel.component.netty.handlers.ServerChannelHandler
- Throws:
Exception
-
-