|
aerogear-controller 1.0.0.M1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.aerogear.controller.router.AbstractRoutingModule
public abstract class AbstractRoutingModule
AbstractRoutingModule simplifies the process of configuring Routes by implementing
RoutingModule and providing helper methods.
Routes routes = new AbstractRoutingModule() {
@Override
public void configuration() {
route()
.from("/home")
.on(RequestMethod.GET)
.to(SampleController.class).index();
//... more routes
}
}.build();
| Field Summary | |
|---|---|
private List<RouteBuilder> |
routes
|
| Constructor Summary | |
|---|---|
AbstractRoutingModule()
|
|
| Method Summary | ||
|---|---|---|
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. |
|
static
|
param(Class<T> clazz)
Param is used when a target method takes a argument. |
|
static String |
pathParam(String id)
Used to specify that a parameter of a method is expected to be in the request path. |
|
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 |
|---|
private final List<RouteBuilder> routes
| Constructor Detail |
|---|
public AbstractRoutingModule()
| Method Detail |
|---|
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()
RoutingModuleRoutes instance containing all the Routes configured in
the application.
build in interface RoutingModuleRoutes populated with all the configured Routes.public static <T> T param(Class<T> clazz)
.to(SampleController.class).save(param(Car.class));
clazz - the type of the parameter that the target method accepts.
public static String pathParam(String id)
.from("/car/{id}")
.on(RequestMethod.GET)
.to(SampleController.class).find(pathParam("id"));
id - the id/name of the parameter
String the same String that was passed in.
|
aerogear-controller 1.0.0.M1 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||