aerogear-controller 1.0.1

org.jboss.aerogear.controller.router
Class DefaultRouter

java.lang.Object
  extended by org.jboss.aerogear.controller.router.DefaultRouter
All Implemented Interfaces:
Router

public class DefaultRouter
extends Object
implements Router

Default implementation of Router.

This implementation uses Context and Dependency Injection (CDI) to have various parts injected into it. Of
particular interest for end users is the RoutingModule which is described in more detail in the section below.

RoutingModule

The CDI implementation will scan for an instance of RoutingModule upon deployment, and its
RoutingModule.build() method will be called to assemble the routes configured for this application.
To simplify this process AbstractRoutingModule is provided, please refer its javadoc for sample usage.


Field Summary
private  RouteProcessor routeProcessor
           
private  Routes routes
           
 
Constructor Summary
DefaultRouter()
           
DefaultRouter(javax.enterprise.inject.Instance<RoutingModule> instance, RouteProcessor routeProcessor)
           
 
Method Summary
 void dispatch(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
          Dispatches to an appropriate Route.
 boolean hasRouteFor(javax.servlet.http.HttpServletRequest request)
          Determines if this Router has a Route for the passed-in HttpServletRequest.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

routes

private Routes routes

routeProcessor

private RouteProcessor routeProcessor
Constructor Detail

DefaultRouter

public DefaultRouter()

DefaultRouter

@Inject
public DefaultRouter(javax.enterprise.inject.Instance<RoutingModule> instance,
                            RouteProcessor routeProcessor)
Method Detail

hasRouteFor

public boolean hasRouteFor(javax.servlet.http.HttpServletRequest request)
Description copied from interface: Router
Determines if this Router has a Route for the passed-in HttpServletRequest.

Specified by:
hasRouteFor in interface Router
Parameters:
request - the HttpServletRequest.
Returns:
true if this Router has a Route for the HttpServletRequest, otherwise false.

dispatch

public void dispatch(javax.servlet.http.HttpServletRequest request,
                     javax.servlet.http.HttpServletResponse response,
                     javax.servlet.FilterChain chain)
              throws javax.servlet.ServletException
Description copied from interface: Router
Dispatches to an appropriate Route.

Specified by:
dispatch in interface Router
Parameters:
request - the HttpServletRequest.
response - the HttpServletResponse
chain - the FilterChain.
Throws:
javax.servlet.ServletException - if en error occurs while dispatching.

aerogear-controller 1.0.1

Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.