|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.arsdigita.dispatcher.RequestValue
A variable whose value is specific to each request. Objects that
need to store values that change in every request should decare
them to be RequestValue. These variables hold their
values only during a duration of a request. They get reinitialized
by a call to initialValue for every new HTTP
request.
For example, a class that wants to implement a request specific
property foo would do the following:
public class SomeClass {
private RequestValue m_foo;
public SomeClass() {
m_foo = new RequestValue() {
protected Object initialValue(HttpServletRequest r) {
// Foo could be a much more complicated value
return r.getRequestURI();
}
};
}
public String getFoo(HttpServletRequest r) {
return (String)m_foo.get(r);
}
public void setFoo(HttpServletRequest r, String v) {
m_foo.set(r, v);
}
}
| Field Summary | |
static String |
versionId
|
| Constructor Summary | |
RequestValue()
|
|
| Method Summary | |
Object |
get()
This convenience method works like get(HttpServletRequest), but uses DispatcherHelper.getRequest() to get the request object. |
Object |
get(javax.servlet.http.HttpServletRequest request)
Return the request specific value for this variable for the request associated with request. |
protected Object |
initialValue(javax.servlet.http.HttpServletRequest request)
Return the value to be used during the request represented by request. |
void |
set(javax.servlet.http.HttpServletRequest request,
Object value)
Set a new value for the request local variable and associate it with the request represented by request |
void |
set(Object value)
This convenience method works like set(HttpServletRequest, Object), but uses DispatcherHelper.getRequest() to get the request object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String versionId
| Constructor Detail |
public RequestValue()
| Method Detail |
protected Object initialValue(javax.servlet.http.HttpServletRequest request)
request. This method is called at most once per
request, the first time the value of this
RequestValue is requested with get. RequestValue must be subclassed, and this
method overridden. Typically, an anonymous inner class will be
used.
request - represents the current request
public Object get(javax.servlet.http.HttpServletRequest request)
request.
request - represents the current request
public Object get()
public void set(javax.servlet.http.HttpServletRequest request,
Object value)
Set a new value for the request local variable and associate
it with the request represented by request
request - represents the current requestvalue - the new value for this request valuepublic void set(Object value)
This convenience method works like set(HttpServletRequest, Object), but uses DispatcherHelper.getRequest() to get the request object.
value - the new value for this request value
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||