com.continuuity.http
Class RequestRouter

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelUpstreamHandler
      extended by com.continuuity.http.RequestRouter
All Implemented Interfaces:
org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler

public class RequestRouter
extends org.jboss.netty.channel.SimpleChannelUpstreamHandler

RequestRouter that uses HttpMethodHandler to determine the http-handler method Signature of http request. It uses this signature to dynamically configure the Netty Pipeline. Http Handler methods with return-type BodyConsumer will be streamed , while other methods will use HttpChunkAggregator


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Constructor Summary
RequestRouter(HttpResourceHandler methodHandler, int chunkMemoryLimit, boolean enableSSL)
           
 
Method Summary
 void channelConnected(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e)
           
 void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ExceptionEvent e)
           
 void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e)
          If the HttpRequest is valid and handled it will be sent upstream, if it cannot be invoked the response will be written back immediately.
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestRouter

public RequestRouter(HttpResourceHandler methodHandler,
                     int chunkMemoryLimit,
                     boolean enableSSL)
Method Detail

messageReceived

public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.MessageEvent e)
                     throws Exception
If the HttpRequest is valid and handled it will be sent upstream, if it cannot be invoked the response will be written back immediately.

Overrides:
messageReceived in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Parameters:
ctx -
e -
Throws:
Exception

channelConnected

public void channelConnected(org.jboss.netty.channel.ChannelHandlerContext ctx,
                             org.jboss.netty.channel.ChannelStateEvent e)
                      throws Exception
Overrides:
channelConnected in class org.jboss.netty.channel.SimpleChannelUpstreamHandler
Throws:
Exception

exceptionCaught

public void exceptionCaught(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.ExceptionEvent e)
Overrides:
exceptionCaught in class org.jboss.netty.channel.SimpleChannelUpstreamHandler


Copyright 2013 Continuuity, Inc. Licensed under the Apache License, Version 2.0