public abstract class AbstractRoutingModule extends Object implements RoutingModule
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();
| Modifier and Type | Field and Description |
|---|---|
static MediaType |
HTML |
static MediaType |
JSON |
static MediaType |
JSP |
private List<RouteBuilder> |
routes |
| Constructor and Description |
|---|
AbstractRoutingModule() |
| Modifier and Type | Method and Description |
|---|---|
private void |
addParameter(Parameter<?> parameter) |
Routes |
build()
|
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 id) |
String |
param(String id,
String defaultValue) |
RouteBuilder |
route()
Is the starting point to configuring a single route.
|
public static final MediaType JSON
public static final MediaType JSP
public static final MediaType HTML
private final List<RouteBuilder> routes
public abstract void configuration()
throws Exception
build(), which subclasses should implement to define the routes of the
application. For an example usage see the javadoc for this class.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 configurationspublic RouteBuilder route()
RouteBuilder which provides a fluent API for configuring a Route.public Routes build()
RoutingModulebuild in interface RoutingModuleRoutes populated with all the configured Routes.public <T> T param(Class<T> type)
private void addParameter(Parameter<?> parameter)
private RouteDescriptor current()
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.