org.jboss.aerogear.controller.router
Class AbstractRoutingModule
java.lang.Object
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();
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
JSON
public static final MediaType JSON
JSP
public static final MediaType JSP
HTML
public static final MediaType HTML
routes
private final List<RouteBuilder> routes
AbstractRoutingModule
public AbstractRoutingModule()
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()
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.