|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.http.servlets.HttpServletRequestWrapper
public class HttpServletRequestWrapper
A wrapper for HttpServletRequest
- differentiates between POST parameters in the URL or Content Body
- keeps content Body of the POST request, making it available many times
through getContentBodyInputStream()
.
A method of differentiating between POST parameters in the URL or Content Body of the request was needed.
The standard javax.servlet.http.HTTPServletRequest does not differentiate between URL or content body parameters,
this class does, the type is indicated in RequestParameter.type.
To differentiate manually we need to read the URL (getQueryString()) and the Content body (getInputStream()),
this is problematic with the standard javax.servlet.http.HTTPServletRequest as parameter functions (getParameterMap(), getParameterNames(), getParameter(String), getParameterValues(String))
affect the input stream functions (getInputStream(), getReader()) and vice versa.
This class solves this by reading the Request Parameters initially from both the URL and the Content Body of the Request
and storing them in the private variable params for later use.
Field Summary |
---|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
---|
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Constructor Summary | |
---|---|
HttpServletRequestWrapper(HttpServletRequest request,
String formEncoding)
HttpServletRequestWrapper Constructor |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HttpServletRequestWrapper(HttpServletRequest request, String formEncoding) throws UnsupportedEncodingException
request
- The HttpServletRequest to wrapformEncoding
- The encoding to use
UnsupportedEncodingException
Method Detail |
---|
public String getAuthType()
getAuthType
in interface HttpServletRequest
HttpServletRequest.getAuthType()
public Cookie[] getCookies()
getCookies
in interface HttpServletRequest
HttpServletRequest.getCookies()
public long getDateHeader(String name)
getDateHeader
in interface HttpServletRequest
HttpServletRequest.getDateHeader(java.lang.String)
public String getHeader(String name)
getHeader
in interface HttpServletRequest
HttpServletRequest.getHeader(java.lang.String)
public Enumeration getHeaders(String name)
getHeaders
in interface HttpServletRequest
HttpServletRequest.getHeaders(java.lang.String)
public Enumeration getHeaderNames()
getHeaderNames
in interface HttpServletRequest
HttpServletRequest.getHeaderNames()
public int getIntHeader(String name)
getIntHeader
in interface HttpServletRequest
HttpServletRequest.getIntHeader(java.lang.String)
public String getMethod()
getMethod
in interface HttpServletRequest
HttpServletRequest.getMethod()
public String getPathInfo()
getPathInfo
in interface HttpServletRequest
HttpServletRequest.getPathInfo()
public String getPathTranslated()
getPathTranslated
in interface HttpServletRequest
HttpServletRequest.getPathTranslated()
public String getContextPath()
getContextPath
in interface HttpServletRequest
HttpServletRequest.getContextPath()
public String getQueryString()
getQueryString
in interface HttpServletRequest
HttpServletRequest.getQueryString()
public String getRemoteUser()
getRemoteUser
in interface HttpServletRequest
HttpServletRequest.getRemoteUser()
public boolean isUserInRole(String name)
isUserInRole
in interface HttpServletRequest
HttpServletRequest.isUserInRole(java.lang.String)
public Principal getUserPrincipal()
getUserPrincipal
in interface HttpServletRequest
HttpServletRequest.getUserPrincipal()
public String getRequestedSessionId()
getRequestedSessionId
in interface HttpServletRequest
HttpServletRequest.getRequestedSessionId()
public String getRequestURI()
getRequestURI
in interface HttpServletRequest
HttpServletRequest.getRequestURI()
public StringBuffer getRequestURL()
getRequestURL
in interface HttpServletRequest
HttpServletRequest.getRequestURL()
public String getServletPath()
getServletPath
in interface HttpServletRequest
HttpServletRequest.getServletPath()
public HttpSession getSession(boolean create)
getSession
in interface HttpServletRequest
HttpServletRequest.getSession(boolean)
public HttpSession getSession()
getSession
in interface HttpServletRequest
HttpServletRequest.getSession(boolean)
public boolean isRequestedSessionIdValid()
isRequestedSessionIdValid
in interface HttpServletRequest
HttpServletRequest.isRequestedSessionIdValid()
public boolean isRequestedSessionIdFromCookie()
isRequestedSessionIdFromCookie
in interface HttpServletRequest
HttpServletRequest.isRequestedSessionIdFromCookie()
public boolean isRequestedSessionIdFromURL()
isRequestedSessionIdFromURL
in interface HttpServletRequest
HttpServletRequest.isRequestedSessionIdFromURL()
public boolean isRequestedSessionIdFromUrl()
isRequestedSessionIdFromUrl
in interface HttpServletRequest
HttpServletRequest.isRequestedSessionIdFromUrl()
public Object getAttribute(String name)
getAttribute
in interface ServletRequest
ServletRequest.getAttribute(java.lang.String)
public Enumeration getAttributeNames()
getAttributeNames
in interface ServletRequest
ServletRequest.getAttributeNames()
public String getCharacterEncoding()
getCharacterEncoding
in interface ServletRequest
ServletRequest.getCharacterEncoding()
public void setCharacterEncoding(String env) throws UnsupportedEncodingException
setCharacterEncoding
in interface ServletRequest
UnsupportedEncodingException
ServletRequest.setCharacterEncoding(java.lang.String)
public int getContentLength()
getContentLength
in interface ServletRequest
ServletRequest.getContentLength()
public String getContentType()
getContentType
in interface ServletRequest
ServletRequest.getContentType()
public ServletInputStream getInputStream() throws IOException
getInputStream
in interface ServletRequest
IOException
ServletRequest.getInputStream()
public InputStream getContentBodyInputStream() throws IOException
IOException
public String getParameter(String name)
getParameter
in interface ServletRequest
name
- The name of the Request parameter to get the value for
public Enumeration getParameterNames()
getParameterNames
in interface ServletRequest
public String[] getParameterValues(String name)
getParameterValues
in interface ServletRequest
name
- The name of the Request parameter to get the values for
public Map getParameterMap()
getParameterMap
in interface ServletRequest
public String getProtocol()
getProtocol
in interface ServletRequest
ServletRequest.getProtocol()
public String getScheme()
getScheme
in interface ServletRequest
ServletRequest.getScheme()
public String getServerName()
getServerName
in interface ServletRequest
ServletRequest.getServerName()
public int getServerPort()
getServerPort
in interface ServletRequest
ServletRequest.getServerPort()
public BufferedReader getReader() throws IOException
getReader
in interface ServletRequest
IOException
public String getRemoteAddr()
getRemoteAddr
in interface ServletRequest
ServletRequest.getRemoteAddr()
public String getRemoteHost()
getRemoteHost
in interface ServletRequest
ServletRequest.getRemoteHost()
public void setAttribute(String name, Object o)
setAttribute
in interface ServletRequest
ServletRequest.setAttribute(java.lang.String, java.lang.Object)
public void removeAttribute(String name)
removeAttribute
in interface ServletRequest
ServletRequest.removeAttribute(java.lang.String)
public Locale getLocale()
getLocale
in interface ServletRequest
ServletRequest.getLocale()
public Enumeration getLocales()
getLocales
in interface ServletRequest
ServletRequest.getLocales()
public boolean isSecure()
isSecure
in interface ServletRequest
ServletRequest.isSecure()
public RequestDispatcher getRequestDispatcher(String name)
getRequestDispatcher
in interface ServletRequest
ServletRequest.getRequestDispatcher(java.lang.String)
public String getRealPath(String path)
getRealPath
in interface ServletRequest
ServletRequest.getRealPath(java.lang.String)
public int getRemotePort()
getRemotePort
in interface ServletRequest
ServletRequest.getRemotePort()
public String getLocalName()
getLocalName
in interface ServletRequest
ServletRequest.getLocalName()
public String getLocalAddr()
getLocalAddr
in interface ServletRequest
ServletRequest.getLocalAddr()
public int getLocalPort()
getLocalPort
in interface ServletRequest
ServletRequest.getLocalPort()
public String toString()
toString
in class Object
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |