|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.ui.util.RequestState
A collection of objects that define the state of a single HTTP request. These are provided by the servlet engine to the servlet or JSP page.
This collection is needed in several contexts, so it is convenient to package them all in one object that can be passed around.
We also includes a Waveset Session since in the Lighthouse environment you almost always have to have one of these.
Field Summary | |
static java.lang.String |
code_id
|
static java.lang.String |
OPTION_PREFIX
A prefix we look for in request parameter names. |
static java.lang.String |
POST_NULL
Special value we post when the end result is to set the target attribute to null. |
protected static Trace |
trace
|
Constructor Summary | |
RequestState(javax.servlet.http.HttpSession hs,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse resp,
LighthouseContext lighthouseContext,
PageInformation pi)
|
Method Summary | |
void |
cleanup()
|
java.lang.String |
encodeAbsoluteURL(java.lang.String url)
Encode a response URL. |
java.lang.String |
encodeAbsoluteURL(java.lang.String url,
boolean needSession)
Encode a response URL. |
java.lang.String |
encodeURL(java.lang.String url)
Encode a response URL. |
java.lang.String |
getAttribute(java.lang.String name)
Return the value of a session attribute, coercing to a string. |
static boolean |
getBooleanParameter(javax.servlet.ServletRequest req,
java.lang.String name)
|
static boolean |
getBooleanParameter(javax.servlet.ServletRequest req,
java.lang.String name,
boolean defaultValue)
Return the value of a boolean parameter. |
boolean |
getBooleanParameter(java.lang.String name)
|
boolean |
getBooleanParameter(java.lang.String name,
boolean defaultValue)
|
int |
getContentLength()
|
static int |
getContentLength(RequestState req)
|
javax.servlet.http.HttpSession |
getHttpSession()
|
static int |
getIntParameter(javax.servlet.ServletRequest req,
java.lang.String name)
Return the value of an int parameter. |
static int |
getIntParameter(javax.servlet.ServletRequest req,
java.lang.String name,
int defaultValue)
Return the value of an int parameter. |
int |
getIntParameter(java.lang.String name)
Return the value of an int parameter. |
int |
getIntParameter(java.lang.String name,
int defaultValue)
Return the value of an int parameter. |
LighthouseContext |
getLighthouseContext()
|
java.util.Locale |
getLocale()
|
java.lang.String |
getLocalizedString(int value)
Localize an integer. |
static java.lang.String |
getLocalizedString(java.util.Locale locale,
int value)
|
static java.lang.String |
getLocalizedString(java.util.Locale locale,
java.lang.Object value)
Coerce an object to a string. |
java.lang.String |
getLocalizedString(java.lang.Object value)
|
static java.lang.String |
getLocalizedString(java.lang.String value,
java.util.Locale locale)
|
java.lang.String |
getMethod()
|
java.lang.Object |
getOption(java.lang.String name)
|
java.util.Map |
getOptions()
|
PageInformation |
getPageInformation()
|
static java.lang.String |
getParameter(java.util.Map parameterMap,
java.lang.String name)
Return from the specified map of parameter values a single value for the specified parameter. |
static java.lang.String |
getParameter(RequestState req,
java.lang.String name)
|
static java.lang.String |
getParameter(javax.servlet.ServletRequest r,
java.lang.String name)
Return the value of a parameter, collapsing empty strings to null. |
java.lang.String |
getParameter(java.lang.String name)
Return the value of a parameter from the HttpRequest that was supplied to our constructor. |
java.util.Map |
getParameterMap()
|
static java.lang.String[] |
getParameterValues(java.util.Map parameterMap,
java.lang.String name)
Return from the specified map of parameter values the values of the specified parameter. |
java.lang.String[] |
getParameterValues(java.lang.String name)
Return all values of a parameter. |
java.lang.String |
getQueryString()
|
BufferedRequest |
getRequest()
|
java.lang.String |
getRequestURI()
|
javax.servlet.http.HttpServletResponse |
getResponse()
|
static java.lang.String |
getString(java.util.Locale locale,
java.lang.Object value)
|
Session |
getWavesetSession()
|
static boolean |
hasParameter(javax.servlet.ServletRequest req,
java.lang.String name)
|
boolean |
hasParameter(java.lang.String name)
Return true if the request has a value for the named parameter. |
void |
removeAttribute(java.lang.String name)
Remove a session attribute. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Set a session attribute. |
void |
setLighthouseContext(LighthouseContext lighthouseContext)
|
void |
setLocale(java.util.Locale locale)
|
void |
setOption(java.lang.String name,
java.lang.Object value)
|
void |
setOptions(java.util.Map options)
|
void |
setParameter(java.lang.String name,
java.lang.Object value)
Set a post parameter override. |
void |
setTrace(boolean b)
|
void |
setWavesetSession(Session session)
|
boolean |
testOption(java.lang.String name)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
protected static Trace trace
public static final java.lang.String OPTION_PREFIX
public static final java.lang.String POST_NULL
Constructor Detail |
public RequestState(javax.servlet.http.HttpSession hs, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse resp, LighthouseContext lighthouseContext, PageInformation pi) throws WavesetException
Method Detail |
public void setOption(java.lang.String name, java.lang.Object value)
public void setOptions(java.util.Map options)
public void setTrace(boolean b)
public void setLocale(java.util.Locale locale)
public void setWavesetSession(Session session)
public void cleanup() throws WavesetException
WavesetException
public javax.servlet.http.HttpSession getHttpSession()
public BufferedRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public LighthouseContext getLighthouseContext()
public void setLighthouseContext(LighthouseContext lighthouseContext)
public Session getWavesetSession()
public java.util.Map getOptions()
public java.util.Locale getLocale()
public PageInformation getPageInformation()
public java.lang.Object getOption(java.lang.String name)
public boolean testOption(java.lang.String name)
public void setParameter(java.lang.String name, java.lang.Object value)
This only works for simple String parameters right now.
public static java.lang.String getParameter(javax.servlet.ServletRequest r, java.lang.String name)
Originally this would trim strings, but that isn't always desired so we stopped. Collapsing empty strings to null has also been done for some time, and is more heavily used so don't remove that.
Note that you can't tell the difference between a posted parameter with a null value and a parameter that was never posted. To do that, you have to get the Enumeration of names and check. UPDATE 1/30/02: It can sometimes happen with generated forms that the same field appears more than once, which results in a multi-valued post parameter. In these cases, pick the first value that is non-null.
public static java.lang.String getParameter(RequestState req, java.lang.String name)
public java.lang.String getParameter(java.lang.String name)
This is the one generally called during post data assimilation, it will obey parameter value overrides specified by the setParameter method.
public static java.lang.String[] getParameterValues(java.util.Map parameterMap, java.lang.String name)
public static java.lang.String getParameter(java.util.Map parameterMap, java.lang.String name)
public static boolean getBooleanParameter(javax.servlet.ServletRequest req, java.lang.String name, boolean defaultValue)
public static boolean getBooleanParameter(javax.servlet.ServletRequest req, java.lang.String name)
public boolean getBooleanParameter(java.lang.String name)
public boolean getBooleanParameter(java.lang.String name, boolean defaultValue)
public static int getIntParameter(javax.servlet.ServletRequest req, java.lang.String name, int defaultValue)
int
parameter.
If null, return the specified default.
public static int getIntParameter(javax.servlet.ServletRequest req, java.lang.String name)
int
parameter.
If null, return -1
.
public int getIntParameter(java.lang.String name)
int
parameter.
If null, return -1
.
public int getIntParameter(java.lang.String name, int defaultValue)
int
parameter.
If null, return the specified default.
public boolean hasParameter(java.lang.String name)
public static boolean hasParameter(javax.servlet.ServletRequest req, java.lang.String name)
public java.util.Map getParameterMap() throws java.io.IOException, WavesetException
java.io.IOException
WavesetException
public java.lang.String getAttribute(java.lang.String name)
public java.lang.String getQueryString()
public java.lang.String getRequestURI()
public java.lang.String getMethod()
public void setAttribute(java.lang.String name, java.lang.String value)
public void removeAttribute(java.lang.String name)
public java.lang.String encodeURL(java.lang.String url)
public java.lang.String encodeAbsoluteURL(java.lang.String url)
public java.lang.String encodeAbsoluteURL(java.lang.String url, boolean needSession)
url
- the original urlneedSession
- Do we need the session id in the url. Added
because for applet code base, we don't want the session
id since it causes the applet loading to hose uppublic int getContentLength()
public static int getContentLength(RequestState req)
public java.lang.String[] getParameterValues(java.lang.String name)
public static java.lang.String getString(java.util.Locale locale, java.lang.Object value)
public static java.lang.String getLocalizedString(java.util.Locale locale, java.lang.Object value)
If the result looks like a message catalog key, try to resolve it using the current request locale. General purpose enough to go in util, but we're evolving where message catalogs go, so we may need Session access.
public static java.lang.String getLocalizedString(java.lang.String value, java.util.Locale locale)
public java.lang.String getLocalizedString(java.lang.Object value)
public java.lang.String getLocalizedString(int value)
public static java.lang.String getLocalizedString(java.util.Locale locale, int value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |