org.restlet.ext.spring
Class SpringRouter

java.lang.Object
  extended by org.restlet.Uniform
      extended by org.restlet.Restlet
          extended by org.restlet.Router
              extended by org.restlet.ext.spring.SpringRouter

public class SpringRouter
extends 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

Field Summary
 
Fields inherited from class org.restlet.Router
BEST, CUSTOM, FIRST, LAST, NEXT, RANDOM
 
Constructor Summary
SpringRouter()
          Constructor.
SpringRouter(Context context)
          Constructor with a parent context.
SpringRouter(Restlet parent)
          Constructor with a parent Restlet.
 
Method Summary
 void setAttachments(java.util.Map<java.lang.String,java.lang.Object> routes)
          Sets the map of routes to attach.
static void setAttachments(Router router, java.util.Map<java.lang.String,java.lang.Object> routes)
          Sets the map of routes to attach.
 
Methods inherited from class org.restlet.Router
attach, attach, attach, attachDefault, attachDefault, createFinder, createRoute, detach, getCustom, getDefaultMatchingMode, getDefaultMatchQuery, getDefaultRoute, getFinderClass, getMaxAttempts, getNext, getRequiredScore, getRetryDelay, getRoutes, getRoutingMode, handle, setDefaultMatchingMode, setDefaultMatchQuery, setDefaultRoute, setFinderClass, setMaxAttempts, setRequiredScore, setRetryDelay, setRoutes, setRoutingMode
 
Methods inherited from class org.restlet.Restlet
getApplication, getContext, getLogger, init, isStarted, isStopped, setContext, start, stop
 
Methods inherited from class org.restlet.Uniform
delete, delete, get, get, handle, head, head, options, options, post, post, put, put
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringRouter

public SpringRouter()
Constructor.


SpringRouter

public SpringRouter(Context context)
Constructor with a parent context.


SpringRouter

public SpringRouter(Restlet parent)
Constructor with a parent Restlet.

Method Detail

setAttachments

public static void setAttachments(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, Resource subclasses (as Class instances or as qualified class names).

Parameters:
routes - The map of routes to attach.


Copyright © 2005-2008 Noelios Technologies.