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 HTTP
ServerChannelHandler that handles the incoming HTTP requests and routes the received message in
Camel.-
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 TypeMethodDescriptionprotected 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.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, createResponseFutureListenerMethods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelReadMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
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
-
HttpServerChannelHandler
-
-
Method Details
-
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
-
matchesRoles
-
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
- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classorg.apache.camel.component.netty.handlers.ServerChannelHandler
-
getResponseBody
- Overrides:
getResponseBodyin classorg.apache.camel.component.netty.handlers.ServerChannelHandler- Throws:
Exception
-
createExchange
protected org.apache.camel.Exchange createExchange(io.netty.channel.ChannelHandlerContext ctx, Object message) throws Exception - Overrides:
createExchangein classorg.apache.camel.component.netty.handlers.ServerChannelHandler- Throws:
Exception
-