|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Uniform
org.restlet.Restlet
org.restlet.Finder
public class Finder
Restlet that can find the target resource that will concretely handle a call.
Based on a given resource class, it is also capable of instantiating the
resource with the call's context, request and response without requiring the
usage of a subclass. It will use either the constructor with three arguments:
context, request, response; or it will invoke the default constructor then
invoke the init() method with the same arguments.
Once the target resource has been found, the call is automatically dispatched
to the appropriate handle*() method (where the '*' character corresponds to
the method name) if the corresponding allow*() method returns true.
For example, if you want to support a MOVE method for a WebDAV server, you
just have to add a handleMove() method in your subclass of Resource and it
will be automatically be used by the Finder instance at runtime.
If no matching handle*() method is found, then a
Status.CLIENT_ERROR_METHOD_NOT_ALLOWED is returned.
Constructor Summary | |
---|---|
Finder()
Constructor. |
|
Finder(Context context)
Constructor. |
|
Finder(Context context,
Class<? extends Resource> targetClass)
Constructor. |
Method Summary | |
---|---|
Resource |
createResource(Request request,
Response response)
Creates a new instance of the resource class designated by the "targetClass" property. |
Resource |
findTarget(Request request,
Response response)
Finds the target Resource if available. |
Class<? extends Resource> |
getTargetClass()
Returns the target Resource class. |
void |
handle(Request request,
Response response)
Handles a call. |
Methods inherited from class org.restlet.Restlet |
---|
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 |
---|
public Finder()
public Finder(Context context)
context
- The context.public Finder(Context context, Class<? extends Resource> targetClass)
context
- The context.targetClass
- The target resource class.Method Detail |
---|
public Resource findTarget(Request request, Response response)
createResource(Request, Response)
method.
request
- The request to handle.response
- The response to update.
public Resource createResource(Request request, Response response)
request
- The request to handle.response
- The response to update.
public Class<? extends Resource> getTargetClass()
public void handle(Request request, Response response)
handle
in class Restlet
request
- The request to handle.response
- The response to update.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |