|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.baswell.routes.RoutingTable
public class RoutingTable
Hub for all routes. Routes can be added to the RoutingTable in the following ways:
1. As class objects. Routes added as class objects are instantiated on each matched HTTP request. Once the HTTP request is processed, the instantiated route object is discarded. Every HTTP request gets its own route object instance. The route class does not have to be thread safe.
2. As instances of the route class. In this case the same route object will get used for every matched HTTP request. The route class must be thread safe as it can process multiple HTTP requests concurrently.
Normally build should be called during application startup after all routes have been added. If there are any
errors in route configurations an error will be thrown then. Otherwise this method will be called on the first request
that uses the Routes engine.
If the RoutesFilter or RoutesServlet is used in web.xml then this class should be treated as a singleton (only
one instance created). If multiple instances of RoutingTable are created then RoutesFilter and RoutesServlet
will only have visibly to the last one created.
| Constructor Summary | |
|---|---|
RoutingTable()
The default RoutesConfiguration will be used. |
|
RoutingTable(RoutesConfiguration routesConfiguration)
|
|
| Method Summary | |
|---|---|
RoutingTable |
add(java.lang.Object... instancesOrClasses)
Adds to the given objects to the routing table. |
void |
build()
Builds the routing table from the added route objects. |
void |
setRoutes(java.util.List<java.lang.Object> routeObjects)
Calls add(java.lang.Object...) for each object in the given list. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RoutingTable()
RoutesConfiguration will be used.
public RoutingTable(RoutesConfiguration routesConfiguration)
| Method Detail |
|---|
public void setRoutes(java.util.List<java.lang.Object> routeObjects)
add(java.lang.Object...) for each object in the given list. Can be used in spring XML mappings as:
routeObjects - The list of route objects to add to the routing table.public RoutingTable add(java.lang.Object... instancesOrClasses)
instancesOrClasses - Route class or instance objects.
public void build()
throws RoutesException
RoutesException - If an added route is configured incorrectly.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||