Package org.restlet.ext.spring
Class SpringRouter
- java.lang.Object
-
- org.restlet.Restlet
-
- org.restlet.routing.Router
-
- org.restlet.ext.spring.SpringRouter
-
- All Implemented Interfaces:
org.restlet.Uniform
public class SpringRouter extends org.restlet.routing.Router
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.- Author:
- Jerome Louvel
- See Also:
- Spring home page
-
-
Constructor Summary
Constructors Constructor Description SpringRouter()
Constructor.SpringRouter(org.restlet.Context context)
Constructor with a parent context.SpringRouter(org.restlet.Restlet parent)
Constructor with a parent Restlet.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
setAttachment(org.restlet.routing.Router router, java.lang.String path, java.lang.Object route)
Attach a single route.void
setAttachments(java.util.Map<java.lang.String,java.lang.Object> routes)
Sets the map of routes to attach.static void
setAttachments(org.restlet.routing.Router router, java.util.Map<java.lang.String,java.lang.Object> routes)
Sets the map of routes to attach.void
setDefaultAttachment(java.lang.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
-
-
-
-
Constructor Detail
-
SpringRouter
public SpringRouter()
Constructor.
-
SpringRouter
public SpringRouter(org.restlet.Context context)
Constructor with a parent context.- Parameters:
context
- The parent context.
-
SpringRouter
public SpringRouter(org.restlet.Restlet parent)
Constructor with a parent Restlet.- Parameters:
parent
- The parent Restlet.
-
-
Method Detail
-
setAttachment
public static void setAttachment(org.restlet.routing.Router router, java.lang.String path, java.lang.Object route)
Attach a single route.- Parameters:
router
- The router to attach to.path
- The attachment URI path.route
- The route object to attach.
-
setAttachments
public static void setAttachments(org.restlet.routing.Router router, java.util.Map<java.lang.String,java.lang.Object> routes)
Sets the map of routes to attach.- Parameters:
router
- The router to attach to.routes
- The map of routes to attach
-
setAttachments
public void setAttachments(java.util.Map<java.lang.String,java.lang.Object> routes)
Sets the map of routes to attach. The map keys are the URI templates and the values can be either Restlet instances,ServerResource
subclasses (asClass
instances or as qualified class names).- Parameters:
routes
- The map of routes to attach.
-
setDefaultAttachment
public void setDefaultAttachment(java.lang.Object route)
Sets the default route to attach. The route can be either Restlet instances,ServerResource
subclasses (asClass
instances or as qualified class names).- Parameters:
route
- The default route to attach.
-
-