|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.Restlet
org.restlet.routing.Filter
org.restlet.routing.Extractor
public class Extractor
Filter extracting attributes from a call. Multiple extractions can be
defined, based on the query string of the resource reference, on the request
form (ex: posted from a browser) or on cookies.
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.
Field Summary |
---|
Fields inherited from class org.restlet.routing.Filter |
---|
CONTINUE, SKIP, STOP |
Constructor Summary | |
---|---|
Extractor()
Constructor. |
|
Extractor(Context context)
Constructor. |
|
Extractor(Context context,
Restlet next)
Constructor. |
Method Summary | |
---|---|
protected int |
beforeHandle(Request request,
Response response)
Allows filtering before its handling by the target Restlet. |
void |
extractFromCookie(String attribute,
String cookieName,
boolean first)
Extracts an attribute from the request cookies. |
void |
extractFromEntity(String attribute,
String parameter,
boolean first)
Extracts an attribute from the request entity form. |
void |
extractFromQuery(String attribute,
String parameter,
boolean first)
Extracts an attribute from the query string of the resource reference. |
Methods inherited from class org.restlet.routing.Filter |
---|
afterHandle, doHandle, getNext, handle, hasNext, setNext, setNext, start, stop |
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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Extractor()
public Extractor(Context context)
context
- The context.public Extractor(Context context, Restlet next)
context
- The context.next
- The next Restlet.Method Detail |
---|
protected int beforeHandle(Request request, Response response)
Message.getAttributes()
).
beforeHandle
in class Filter
request
- The request to filter.response
- The response to filter.
public void extractFromCookie(String attribute, String cookieName, boolean first)
attribute
- The name of the request attribute to set.cookieName
- The name of the cookies to extract.first
- Indicates if only the first cookie should be set. Otherwise as
a List instance might be set in the attribute value.public void extractFromEntity(String attribute, String parameter, boolean first)
attribute
- The name of the request attribute to set.parameter
- The name of the entity form parameter to extract.first
- Indicates if only the first cookie should be set. Otherwise as
a List instance might be set in the attribute value.public void extractFromQuery(String attribute, String parameter, boolean first)
attribute
- The name of the request attribute to set.parameter
- The name of the query string parameter to extract.first
- Indicates if only the first cookie should be set. Otherwise as
a List instance might be set in the attribute value.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |