|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.Restlet
org.restlet.routing.Router
org.restlet.ext.spring.SpringRouter
public class SpringRouter
Router that is easily configurable with Spring. Here is a usage example:
<bean class="org.restlet.ext.spring.SpringRouter">
<constructor-arg ref="application" />
<property name="attachments">
<map>
<entry key="/users/{user}" value="org.restlet.example.tutorial.UserResource" />
<entry key="/users/{user}/orders" value="org.restlet.example.tutorial.OrdersResource" />
<entry key="/users/{user}/orders/{order}" value="org.restlet.example.tutorial.OrderResource" />
</map>
</property>
</bean>
Concurrency note: instances of this class or its subclasses can be invoked by
several threads at the same time and therefore must be thread-safe. You
should be especially careful when storing state in member variables.
| Field Summary |
|---|
| Fields inherited from class org.restlet.routing.Router |
|---|
MODE_BEST_MATCH, MODE_CUSTOM, MODE_FIRST_MATCH, MODE_LAST_MATCH, MODE_NEXT_MATCH, MODE_RANDOM_MATCH |
| Constructor Summary | |
|---|---|
SpringRouter()
Constructor. |
|
SpringRouter(Context context)
Constructor with a parent context. |
|
SpringRouter(Restlet parent)
Constructor with a parent Restlet. |
|
| Method Summary | |
|---|---|
static void |
setAttachment(Router router,
String path,
Object route)
Attach a single route. |
void |
setAttachments(Map<String,Object> routes)
Sets the map of routes to attach. |
static void |
setAttachments(Router router,
Map<String,Object> routes)
Sets the map of routes to attach. |
void |
setDefaultAttachment(Object route)
Sets the default route to attach. |
| Methods inherited from class org.restlet.routing.Router |
|---|
attach, attach, attach, attach, attach, attach, attachDefault, attachDefault, createRoute, createRoute, detach, detach, doHandle, getCustom, getDefaultMatchingMode, getDefaultMatchingQuery, getDefaultRoute, getMatchingMode, getMaxAttempts, getNext, getRequiredScore, getRetryDelay, getRoutes, getRoutingMode, handle, logRoute, redirectPermanent, redirectSeeOther, redirectTemporary, setDefaultMatchingMode, setDefaultMatchingQuery, setDefaultRoute, setMaxAttempts, setRequiredScore, setRetryDelay, setRoutes, setRoutingMode, start, stop |
| Methods inherited from class org.restlet.Restlet |
|---|
createFinder, finalize, getApplication, getAuthor, getContext, getDescription, getFinderClass, getLogger, getName, getOwner, handle, handle, handle, isStarted, isStopped, setAuthor, setContext, setDescription, setFinderClass, setName, setOwner |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SpringRouter()
public SpringRouter(Context context)
context - The parent context.public SpringRouter(Restlet parent)
parent - The parent Restlet.| Method Detail |
|---|
public static void setAttachment(Router router,
String path,
Object route)
router - The router to attach to.path - The attachment URI path.route - The route object to attach.
public static void setAttachments(Router router,
Map<String,Object> routes)
router - The router to attach to.routes - The map of routes to attachpublic void setAttachments(Map<String,Object> routes)
ServerResource
subclasses (as Class instances or as qualified class names).
routes - The map of routes to attach.public void setDefaultAttachment(Object route)
ServerResource subclasses (as Class instances
or as qualified class names).
route - The default route to attach.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||