|
||||||||||
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 handler that will effectively handle the
call. Based on a given Handler subclass, it is also capable of instantiating
the handler with the call's context, request and response without requiring
the usage of a Finder 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 handler 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 Handler 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.
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.
Constructor Summary | |
---|---|
Finder()
Constructor. |
|
Finder(Context context)
Constructor. |
|
Finder(Context context,
java.lang.Class<? extends Handler> targetClass)
Constructor. |
Method Summary | |
---|---|
Handler |
createResource(Request request,
Response response)
Deprecated. Use the createTarget(Request, Response) instead. |
Handler |
createTarget(java.lang.Class<? extends Handler> targetClass,
Request request,
Response response)
Creates a new instance of a given handler class. |
protected Handler |
createTarget(Request request,
Response response)
Creates a new instance of the handler class designated by the "targetClass" property. |
protected Handler |
findTarget(Request request,
Response response)
Finds the target Handler if available. |
java.lang.Class<? extends Handler> |
getTargetClass()
Returns the target Handler class. |
void |
handle(Request request,
Response response)
Handles a call. |
void |
setTargetClass(java.lang.Class<? extends Handler> targetClass)
Sets the target Handler class. |
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 |
---|
public Finder()
public Finder(Context context)
context
- The context.public Finder(Context context, java.lang.Class<? extends Handler> targetClass)
context
- The context.targetClass
- The target handler class.Method Detail |
---|
@Deprecated public Handler createResource(Request request, Response response)
createTarget(Request, Response)
instead.
createTarget(Class, Request, Response)
with the "targetClass"
property as a parameter.
request
- The request to handle.response
- The response to update.
public Handler createTarget(java.lang.Class<? extends Handler> targetClass, Request request, Response response)
request
- The request to handle.response
- The response to update.
protected Handler createTarget(Request request, Response response)
createTarget(Class, Request, Response)
with the "targetClass"
property as a parameter.
request
- The request to handle.response
- The response to update.
protected Handler findTarget(Request request, Response response)
createTarget(Request, Response)
method.
request
- The request to handle.response
- The response to update.
public java.lang.Class<? extends Handler> getTargetClass()
public void handle(Request request, Response response)
handle
in class Restlet
request
- The request to handle.response
- The response to update.public void setTargetClass(java.lang.Class<? extends Handler> targetClass)
targetClass
- The target Handler class.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |