org.apache.camel.component.netty.http.handlers
Class HttpServerChannelHandler
java.lang.Object
org.jboss.netty.channel.SimpleChannelUpstreamHandler
org.apache.camel.component.netty.handlers.ServerChannelHandler
org.apache.camel.component.netty.http.handlers.HttpServerChannelHandler
- All Implemented Interfaces:
- org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler
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 classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler |
org.jboss.netty.channel.ChannelHandler.Sharable |
Method Summary |
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,
org.jboss.netty.channel.MessageEvent messageEvent)
|
protected org.jboss.netty.channel.ChannelFutureListener |
createResponseFutureListener(org.apache.camel.component.netty.NettyConsumer consumer,
org.apache.camel.Exchange exchange,
SocketAddress remoteAddress)
|
void |
exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent exceptionEvent)
|
protected static HttpPrincipal |
extractBasicAuthSubject(org.jboss.netty.handler.codec.http.HttpRequest request)
Extracts the username and password details from the HTTP basic header Authorization. |
protected Object |
getResponseBody(org.apache.camel.Exchange exchange)
|
protected boolean |
matchesRoles(String roles,
String userRoles)
|
void |
messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent messageEvent)
|
Methods inherited from class org.apache.camel.component.netty.handlers.ServerChannelHandler |
channelClosed, channelOpen |
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler |
channelBound, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HttpServerChannelHandler
public HttpServerChannelHandler(NettyHttpConsumer consumer)
messageReceived
public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.MessageEvent messageEvent)
throws Exception
- Overrides:
messageReceived
in class org.apache.camel.component.netty.handlers.ServerChannelHandler
- Throws:
Exception
matchesRoles
protected boolean matchesRoles(String roles,
String userRoles)
extractBasicAuthSubject
protected static HttpPrincipal extractBasicAuthSubject(org.jboss.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,
org.jboss.netty.channel.MessageEvent messageEvent)
- Overrides:
beforeProcess
in class org.apache.camel.component.netty.handlers.ServerChannelHandler
exceptionCaught
public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
org.jboss.netty.channel.ExceptionEvent exceptionEvent)
throws Exception
- Overrides:
exceptionCaught
in class org.apache.camel.component.netty.handlers.ServerChannelHandler
- Throws:
Exception
createResponseFutureListener
protected org.jboss.netty.channel.ChannelFutureListener createResponseFutureListener(org.apache.camel.component.netty.NettyConsumer consumer,
org.apache.camel.Exchange exchange,
SocketAddress remoteAddress)
- Overrides:
createResponseFutureListener
in class org.apache.camel.component.netty.handlers.ServerChannelHandler
getResponseBody
protected Object getResponseBody(org.apache.camel.Exchange exchange)
throws Exception
- Overrides:
getResponseBody
in class org.apache.camel.component.netty.handlers.ServerChannelHandler
- Throws:
Exception
Apache Camel