aerogear-controller 1.0.2

org.jboss.aerogear.controller.router
Class AbstractRoutingModule

java.lang.Object
  extended by org.jboss.aerogear.controller.router.AbstractRoutingModule
All Implemented Interfaces:
RoutingModule

public abstract class AbstractRoutingModule
extends Object
implements RoutingModule

AbstractRoutingModule simplifies the process of configuring Routes by implementing RoutingModule and providing helper methods.

Example Usage:
 Routes routes = new AbstractRoutingModule() {
     @Override
     public void configuration() {
         route()
                .from("/home")
                .on(RequestMethod.GET)
                .to(SampleController.class).index();
         // ... more routes
     }
 }.build();
 


Field Summary
static MediaType HTML
           
static MediaType JSON
           
static MediaType JSP
           
private  List<RouteBuilder> routes
           
 
Constructor Summary
AbstractRoutingModule()
           
 
Method Summary
private  void addParameter(Parameter<?> parameter)
           
 Routes build()
          Returns a Routes instance containing all the Routes configured in the application.
abstract  void configuration()
          "Hook" for the template method build(), which subclasses should implement to define the routes of the application.
private  RouteDescriptor current()
           
<T> T
param(Class<T> type)
           
 String param(String str)
           
<T> T
param(String id, Class<T> type)
           
 String param(String id, String defaultValue)
           
 RouteBuilder route()
          Is the starting point to configuring a single route.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JSON

public static final MediaType JSON

JSP

public static final MediaType JSP

HTML

public static final MediaType HTML

routes

private final List<RouteBuilder> routes
Constructor Detail

AbstractRoutingModule

public AbstractRoutingModule()
Method Detail

configuration

public abstract void configuration()
                            throws Exception
"Hook" for the template method build(), which subclasses should implement to define the routes of the application. For an example usage see the javadoc for this class.

Throws:
Exception - enables a route to specify a target method that throws an exception. This method is only about configuring routes and not invoking them, but the target methods might still declare that they throw exceptions and configuration() declares this as well, saving end users from having to have try/catch clauses that clutter up their route configurations

route

public RouteBuilder route()
Is the starting point to configuring a single route.

Returns:
RouteBuilder which provides a fluent API for configuring a Route.

build

public Routes build()
Description copied from interface: RoutingModule
Returns a Routes instance containing all the Routes configured in the application.

Specified by:
build in interface RoutingModule
Returns:
Routes populated with all the configured Routes.

param

public <T> T param(Class<T> type)

param

public String param(String str)

param

public <T> T param(String id,
                   Class<T> type)

param

public String param(String id,
                    String defaultValue)

addParameter

private void addParameter(Parameter<?> parameter)

current

private RouteDescriptor current()

aerogear-controller 1.0.2

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