org.xwiki.container.servlet.filters.internal
Class SavedRequestRestorerFilter.SavedRequestWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.SavedRequestWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest
Enclosing class:
SavedRequestRestorerFilter

public static class SavedRequestRestorerFilter.SavedRequestWrapper
extends javax.servlet.http.HttpServletRequestWrapper

Request Wrapper that inserts data from a previous request into the current request.


Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
SavedRequestRestorerFilter.SavedRequestWrapper(javax.servlet.http.HttpServletRequest request)
          Simple constructor that forwards the initialization to the default HttpServletRequestWrapper.
SavedRequestRestorerFilter.SavedRequestWrapper(javax.servlet.http.HttpServletRequest newRequest, SavedRequestManager.SavedRequest savedRequest)
          Constructor that forwards the new request to the HttpServletRequestWrapper, and stores the saved request data internally.
 
Method Summary
 java.lang.String getParameter(java.lang.String name)
          Retrieves the value for the parameter, either from the new request, or from the saved data.
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
          Retrieves the combined map of parameter names - values, with the new values overriding the old ones.
 java.util.Enumeration<java.lang.String> getParameterNames()
          Retrieves the combined list of parameter names, from both the new and saved requests.
 java.lang.String[] getParameterValues(java.lang.String name)
          Retrieves all the values for the parameter, either from the new request, or from the saved data (but not combined).
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, 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, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Constructor Detail

SavedRequestRestorerFilter.SavedRequestWrapper

public SavedRequestRestorerFilter.SavedRequestWrapper(javax.servlet.http.HttpServletRequest request)
Simple constructor that forwards the initialization to the default HttpServletRequestWrapper. No saved data is used.

Parameters:
request - the new request, the primary object wrapped which contains the actual request data.

SavedRequestRestorerFilter.SavedRequestWrapper

public SavedRequestRestorerFilter.SavedRequestWrapper(javax.servlet.http.HttpServletRequest newRequest,
                                                      SavedRequestManager.SavedRequest savedRequest)
Constructor that forwards the new request to the HttpServletRequestWrapper, and stores the saved request data internally.

Parameters:
newRequest - the new request, the primary object wrapped which contains the actual request data.
savedRequest - the old request, the secondary object wrapped which contains the saved (fallback) request parameters.
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String name)
Retrieves the value for the parameter, either from the new request, or from the saved data.

Specified by:
getParameter in interface javax.servlet.ServletRequest
Overrides:
getParameter in class javax.servlet.ServletRequestWrapper
Parameters:
name - the name of the parameter
Returns:
a String representing the first value of the parameter, or null if no value was set in either of the requests.
See Also:
ServletRequest.getParameter(java.lang.String)

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Retrieves all the values for the parameter, either from the new request, or from the saved data (but not combined).

Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper
Parameters:
name - the name of the parameter
Returns:
an array of String objects containing the parameter's values, or null if no value was set in either of the requests.
See Also:
ServletRequest.getParameterValues(java.lang.String)

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Retrieves the combined map of parameter names - values, with the new values overriding the old ones.

Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Overrides:
getParameterMap in class javax.servlet.ServletRequestWrapper
Returns:
an immutable Map containing parameter names as keys and parameter values as map values
See Also:
ServletRequest.getParameterMap()

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Retrieves the combined list of parameter names, from both the new and saved requests.

Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Overrides:
getParameterNames in class javax.servlet.ServletRequestWrapper
Returns:
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters
See Also:
ServletRequest.getParameterNames()


Copyright © 2004-2011 XWiki. All Rights Reserved.