|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
org.barracudamvc.core.helper.servlet.DefaultServletRequestWrapper
This class acts as a thin wrapper around a ServletRequest. Most calls are simply passed through to the underlying request object. This object does however, expose a method which allows you to set parameters in the request object. This was necessary for cases where we needed to be able to do a POST, save the parameters somewhere, and then do a GET and reconstitute the parameters from that.
When you instantiate this object, it will automatically check the clients session to see if there are any parameter state information that needs to be reconstituted into the current request.
Field Summary | |
static String |
DEFAULT_ENCODING
|
protected static org.apache.log4j.Logger |
logger
|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
DefaultServletRequestWrapper(javax.servlet.http.HttpServletRequest ireq)
Create a DefaultServletRequestWrapper around some other HttpServletRequest impl. |
Method Summary | |
void |
addParameter(String name,
String value)
Set a given parameter (note that this is backed by a hashmap, so the structure is slightly different than that of the underlying ServletRequest which allows multiple paramters with the same name). |
javax.servlet.http.HttpServletRequest |
getCoreRequest()
Get the underlying servlet request. |
String |
getMethod()
Get the underlying request method. |
String |
getParameter(String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist. |
Map |
getParameterMap()
Returns a java.util.Map of the parameters of this request. |
Enumeration |
getParameterNames()
Returns an Enumeration of String objects containing the names of the parameters contained in this request. |
String[] |
getParameterValues(String name)
Returns an array of String objects containing all of the values the given request parameter has, or null if the parameter does not exist. |
void |
removeAllParameters(String name)
Remove all parameters for a specified name |
void |
removeParameter(String name)
Remove the first parameter whose key matches the specified name |
void |
resetParameters()
Reset the parameter values to their original state (ie. the actual values in the request) |
void |
setMethod(String imethod)
Set the underlying request method. |
void |
setRequest(javax.servlet.ServletRequest ireq)
Set the underlying request object. |
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper |
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole |
Methods inherited from class javax.servlet.ServletRequestWrapper |
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface javax.servlet.http.HttpServletRequest |
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole |
Methods inherited from interface javax.servlet.ServletRequest |
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding |
Field Detail |
protected static final org.apache.log4j.Logger logger
public static String DEFAULT_ENCODING
Constructor Detail |
public DefaultServletRequestWrapper(javax.servlet.http.HttpServletRequest ireq)
ireq
- the underlying HttpServletRequestMethod Detail |
public void setMethod(String imethod)
setMethod
in interface BarracudaServletRequestWrapper
imethod
- the underlying request method (GET, POST, etc)public String getMethod()
getMethod
in interface javax.servlet.http.HttpServletRequest
public void addParameter(String name, String value)
addParameter
in interface BarracudaServletRequestWrapper
name
- the key name for the parametervalue
- the value associated with the given keypublic String getParameter(String name)
getParameter
in interface javax.servlet.ServletRequest
name
- the key name for the parameter
public Enumeration getParameterNames()
getParameterNames
in interface javax.servlet.ServletRequest
public Map getParameterMap()
getParameterMap
in interface javax.servlet.ServletRequest
public String[] getParameterValues(String name)
getParameterValues
in interface javax.servlet.ServletRequest
name
- the key name for the parameter
public void removeParameter(String name)
removeParameter
in interface BarracudaServletRequestWrapper
name
- the key name for the parameterpublic void removeAllParameters(String name)
removeAllParameters
in interface BarracudaServletRequestWrapper
name
- the key name for the parameterpublic void resetParameters()
resetParameters
in interface BarracudaServletRequestWrapper
public javax.servlet.http.HttpServletRequest getCoreRequest()
public void setRequest(javax.servlet.ServletRequest ireq)
ireq
- the underlying HttpServletRequest
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |