|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.arsdigita.bebop.RequestLocal
A variable whose value is local to each request. Objects that need to store
values that change in every request should declare them to be
RequestLocal
. These variables hold their values only during a
duration of a request. They get reinitialized by a call to initialValue(PageState)
for every new HTTP request.
For example, a class that wants to implement a request local property
foo
would do the following:
public class SomeClass { private RequestLocal m_foo; public SomeClass() { m_foo = new RequestLocal() { protected Object initialValue(PageState s) { // Foo could be a much more complicated value return s.getRequestURI(); } }; } public String getFoo(PageState s) { return (String) m_foo.get(s); } public void setFoo(PageState s, String v) { m_foo.set(s, v); } }
Field Summary | |
static String |
versionId
|
Constructor Summary | |
RequestLocal()
|
Method Summary | |
Object |
get(PageState state)
Returns the request-specific value for this variable for the request associated with state . |
protected Object |
initialValue(PageState state)
Returns the value to be used during the request represented by state . |
void |
set(javax.servlet.http.HttpServletRequest request,
Object value)
Sets a new value for the request local variable and associates it with the request represented by request |
void |
set(PageState state,
Object value)
Sets a new value for the request local variable and associates it with the request represented by state . |
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 RequestLocal()
Method Detail |
protected Object initialValue(PageState state)
state
. This method is called at most once per request,
the first time the value of this RequestLocal
is
requested with get
. RequestLocal
must be
subclassed, and this method must be overridden. Typically, an
anonymous inner class will be used.
state
- represents the current state of the request
public Object get(PageState state)
state
.
state
- represents the current state of the request
public void set(PageState state, Object value)
state
.
state
- represents the current state of the requestvalue
- the new value for this request local variablepublic void set(javax.servlet.http.HttpServletRequest request, Object value)
Sets a new value for the request local variable and associates it with
the request represented by request
This method is intended for use when a Dispatcher needs to assign some value to a RequestLocal for Bebop Page processing before Page processing begins.
request
- represents the current requestvalue
- the new value for this request local variable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |