|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Restlet
org.restlet.resource.Finder
org.restlet.ext.spring.SpringFinder
public class SpringFinder
Finder that is specialized for easier usage by Spring wiring services. The
idea is to create a singleton Spring bean based on that SpringFinder and
configure it using Spring's "lookup-method" element to return instances of a
"prototype" bean for create()
. Finally, attach the SpringFinder to
your Router. When the create()
method is invoked, a new instance of
your prototype bean will be created and returned. A sample XML for
"lookup-method":
<bean id="myFinder" class="org.restlet.ext.spring.SpringFinder"> <lookup-method name="create" bean="myResource"/> </bean> <bean id="myResource" class="com.mycompany.rest.resource.MyResource" scope="prototype"> <property name="aProperty" value="anotherOne"/> <property name="oneMore" value="true"/> </bean>Note that the Code Generation Library (cglib) will be required in order to use the Spring's lookup method mechanism.
Constructor Summary | |
---|---|
SpringFinder()
Constructor. |
|
SpringFinder(Context context)
Constructor. |
|
SpringFinder(Context context,
Class<? extends ServerResource> targetClass)
Constructor. |
|
SpringFinder(Restlet restlet)
Constructor. |
Method Summary | |
---|---|
ServerResource |
create()
Creates a new instance of the ServerResource class designated by
the "targetClass" property. |
ServerResource |
create(Class<? extends ServerResource> targetClass,
Request request,
Response response)
Calls the create() method that can be configured as a lookup
method in Spring. |
ServerResource |
create(Request request,
Response response)
|
Methods inherited from class org.restlet.resource.Finder |
---|
createFinder, find, getTargetClass, handle, setTargetClass, toString |
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, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SpringFinder()
public SpringFinder(Context context)
context
- The parent context.public SpringFinder(Context context, Class<? extends ServerResource> targetClass)
context
- The context.targetClass
- The target resource class.public SpringFinder(Restlet restlet)
restlet
- The parent Restlet.Method Detail |
---|
public ServerResource create()
ServerResource
class designated by
the "targetClass" property. This method is intended to be configured as a
lookup method in Spring.
public ServerResource create(Class<? extends ServerResource> targetClass, Request request, Response response)
create()
method that can be configured as a lookup
method in Spring. Overriding this method was necessary for direct calls
to it, for example by unit tests.
create
in class Finder
public ServerResource create(Request request, Response response)
create
in class Finder
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |