org.exist.http.servlets
Class HttpServletRequestWrapper

java.lang.Object
  extended byorg.exist.http.servlets.HttpServletRequestWrapper

public class HttpServletRequestWrapper
extends java.lang.Object

A wrapper for HttpServletRequest 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.

Version:
1.1
Author:
Adam Retter

Constructor Summary
HttpServletRequestWrapper(HttpServletRequest request, java.lang.String formEncoding)
          HttpServletRequestWrapper Constructor
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
           
 java.lang.String getAuthType()
           
 java.lang.String getCharacterEncoding()
           
 int getContentLength()
           
 java.lang.String getContentType()
           
 java.lang.String getContextPath()
           
 Cookie[] getCookies()
           
 long getDateHeader(java.lang.String name)
           
 java.lang.String getHeader(java.lang.String name)
           
 java.util.Enumeration getHeaderNames()
           
 java.util.Enumeration getHeaders(java.lang.String name)
           
 ServletInputStream getInputStream()
           
 int getIntHeader(java.lang.String name)
           
 java.lang.String getLocalAddr()
           
 java.util.Locale getLocale()
           
 java.util.Enumeration getLocales()
           
 java.lang.String getLocalName()
           
 int getLocalPort()
           
 java.lang.String getMethod()
           
 java.lang.String getParameter(java.lang.String name)
          get the value of a Request parameter by its name from the local parameter store
 java.util.Map getParameterMap()
          get a Map of Request parameters (keys and values) from the local parameter store
 java.util.Enumeration getParameterNames()
          get the names of the Request parameters from the local parameter store
 java.lang.String[] getParameterValues(java.lang.String name)
          get the values of the Request parameter indicated by name from the local parameter store
 java.lang.String getPathInfo()
           
 java.lang.String getPathTranslated()
           
 java.lang.String getProtocol()
           
 java.lang.String getQueryString()
           
 java.io.BufferedReader getReader()
           
 java.lang.String getRealPath(java.lang.String path)
           
 java.lang.String getRemoteAddr()
           
 java.lang.String getRemoteHost()
           
 int getRemotePort()
           
 java.lang.String getRemoteUser()
           
 RequestDispatcher getRequestDispatcher(java.lang.String name)
           
 java.lang.String getRequestedSessionId()
           
 java.lang.String getRequestURI()
           
 java.lang.StringBuffer getRequestURL()
           
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.lang.String getServletPath()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 java.security.Principal getUserPrincipal()
           
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
           
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(java.lang.String name)
           
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object o)
           
 void setCharacterEncoding(java.lang.String env)
           
 java.lang.String toString()
          Similar to javax.servlet.http.HttpServletRequest.toString() except it includes output of the Request parameters from the Request's Content Body
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HttpServletRequestWrapper

public HttpServletRequestWrapper(HttpServletRequest request,
                                 java.lang.String formEncoding)
                          throws java.io.UnsupportedEncodingException
HttpServletRequestWrapper Constructor

Parameters:
request - The HttpServletRequest to wrap
formEncoding - The encoding to use
Method Detail

getAuthType

public java.lang.String getAuthType()
See Also:
javax.servlet.http.HttpServletRequest#getAuthType

getCookies

public Cookie[] getCookies()
See Also:
javax.servlet.http.HttpServletRequest#getCookies

getDateHeader

public long getDateHeader(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#getDateHeader

getHeader

public java.lang.String getHeader(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#getHeader

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#getHeaders

getHeaderNames

public java.util.Enumeration getHeaderNames()
See Also:
javax.servlet.http.HttpServletRequest#getHeaderNames

getIntHeader

public int getIntHeader(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#getIntHeader

getMethod

public java.lang.String getMethod()
See Also:
javax.servlet.http.HttpServletRequest#getMethod

getPathInfo

public java.lang.String getPathInfo()
See Also:
javax.servlet.http.HttpServletRequest#getPathInfo

getPathTranslated

public java.lang.String getPathTranslated()
See Also:
javax.servlet.http.HttpServletRequest#getPathTranslated

getContextPath

public java.lang.String getContextPath()
See Also:
javax.servlet.http.HttpServletRequest#getContextPath

getQueryString

public java.lang.String getQueryString()
See Also:
javax.servlet.http.HttpServletRequest#getQueryString

getRemoteUser

public java.lang.String getRemoteUser()
See Also:
javax.servlet.http.HttpServletRequest#getRemoteUser

isUserInRole

public boolean isUserInRole(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#isUserInRole

getUserPrincipal

public java.security.Principal getUserPrincipal()
See Also:
javax.servlet.http.HttpServletRequest#getUserPrincipal

getRequestedSessionId

public java.lang.String getRequestedSessionId()
See Also:
javax.servlet.http.HttpServletRequest#getRequestedSessionId

getRequestURI

public java.lang.String getRequestURI()
See Also:
javax.servlet.http.HttpServletRequest#getRequestURI

getRequestURL

public java.lang.StringBuffer getRequestURL()
See Also:
javax.servlet.http.HttpServletRequest#getRequestedURL

getServletPath

public java.lang.String getServletPath()
See Also:
javax.servlet.http.HttpServletRequest#getServletPath

getSession

public HttpSession getSession(boolean create)
See Also:
javax.servlet.http.HttpServletRequest#getSession

getSession

public HttpSession getSession()
See Also:
javax.servlet.http.HttpServletRequest#getSession

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
See Also:
javax.servlet.http.HttpServletRequest#isRequestedSessionIdValie

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
See Also:
javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromCookie

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
See Also:
javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromURL

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
See Also:
javax.servlet.http.HttpServletRequest#isRequestedSessionIdFromUrl

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#getAttribute

getAttributeNames

public java.util.Enumeration getAttributeNames()
See Also:
javax.servlet.http.HttpServletRequest#getAttributeNames

getCharacterEncoding

public java.lang.String getCharacterEncoding()
See Also:
javax.servlet.http.HttpServletRequest#getCharacterEncoding

setCharacterEncoding

public void setCharacterEncoding(java.lang.String env)
                          throws java.io.UnsupportedEncodingException
Throws:
java.io.UnsupportedEncodingException
See Also:
javax.servlet.http.HttpServletRequest#setCharacterEncoding

getContentLength

public int getContentLength()
See Also:
javax.servlet.http.HttpServletRequest#getContentLength

getContentType

public java.lang.String getContentType()
See Also:
javax.servlet.http.HttpServletRequest#getContentType

getInputStream

public ServletInputStream getInputStream()
                                  throws java.io.IOException
Throws:
java.io.IOException
See Also:
javax.servlet.http.HttpServletRequest#getInputStream

getParameter

public java.lang.String getParameter(java.lang.String name)
get the value of a Request parameter by its name from the local parameter store

Parameters:
name - The name of the Request parameter to get the value for
Returns:
The value of the Request parameter with the specified name

getParameterNames

public java.util.Enumeration getParameterNames()
get the names of the Request parameters from the local parameter store

Returns:
An enumeration of string values representing the Request parameters names

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
get the values of the Request parameter indicated by name from the local parameter store

Parameters:
name - The name of the Request parameter to get the values for
Returns:
The String array of the Request parameter's values

getParameterMap

public java.util.Map getParameterMap()
get a Map of Request parameters (keys and values) from the local parameter store

Returns:
Map of Request Parameters. Key is of type String and Value is of type String[].

getProtocol

public java.lang.String getProtocol()
See Also:
javax.servlet.http.HttpServletRequest#getProtocol

getScheme

public java.lang.String getScheme()
See Also:
javax.servlet.http.HttpServletRequest#getScheme

getServerName

public java.lang.String getServerName()
See Also:
javax.servlet.http.HttpServletRequest#getServerName

getServerPort

public int getServerPort()
See Also:
javax.servlet.http.HttpServletRequest#getServerPort

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Throws:
java.io.IOException

getRemoteAddr

public java.lang.String getRemoteAddr()
See Also:
javax.servlet.http.HttpServletRequest#getRemoteAddr

getRemoteHost

public java.lang.String getRemoteHost()
See Also:
javax.servlet.http.HttpServletRequest#getRemoteHost

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object o)
See Also:
javax.servlet.http.HttpServletRequest#setAttribute

removeAttribute

public void removeAttribute(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#removeAttribute

getLocale

public java.util.Locale getLocale()
See Also:
javax.servlet.http.HttpServletRequest#getLocale

getLocales

public java.util.Enumeration getLocales()
See Also:
javax.servlet.http.HttpServletRequest#getLocales

isSecure

public boolean isSecure()
See Also:
javax.servlet.http.HttpServletRequest#isSecure

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(java.lang.String name)
See Also:
javax.servlet.http.HttpServletRequest#getRequestDispatcher

getRealPath

public java.lang.String getRealPath(java.lang.String path)
See Also:
javax.servlet.http.HttpServletRequest#getRealPath

getRemotePort

public int getRemotePort()
See Also:
javax.servlet.http.HttpServletRequest#getRemotePort

getLocalName

public java.lang.String getLocalName()
See Also:
javax.servlet.http.HttpServletRequest#getLocalName

getLocalAddr

public java.lang.String getLocalAddr()
See Also:
javax.servlet.http.HttpServletRequest#getLocalAddr

getLocalPort

public int getLocalPort()
See Also:
javax.servlet.http.HttpServletRequest#getLocalPort

toString

public java.lang.String toString()
Similar to javax.servlet.http.HttpServletRequest.toString() except it includes output of the Request parameters from the Request's Content Body

Returns:
String representation of HttpServletRequestWrapper


<oXygen/> XML Editor provides support for editing and debugging XQuery expressions against the eXist XML Database.