org.apache.beehive.netui.pageflow.scoping.internal
Class ScopedRequestImpl

Object
  extended by ServletRequestWrapper
      extended by HttpServletRequestWrapper
          extended by ScopedRequestImpl
All Implemented Interfaces:
HttpServletRequest, ServletRequest, ScopedRequest

public class ScopedRequestImpl
extends HttpServletRequestWrapper
implements ScopedRequest

A wrapper around HttpServletRequest, associated with a given scope-key. All calls to setAttribute, getAttribute, removeAttribute, etc. are scoped to this object, while most other functionality delegates to the wrapped HttpServletRequest. Instances of this class also keep track of their own request-URIs, which are independent of the wrapped request-URIs.


Field Summary
 
Fields inherited from interface ScopedRequest
AUTOSCOPE_PREFIX
 
Fields inherited from interface HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
ScopedRequestImpl(HttpServletRequest req, String overrideRequestURI, Object scopeKey, ServletContext context)
          Deprecated. Use ScopedRequestImpl(HttpServletRequest, String, Object, ServletContext, boolean).
ScopedRequestImpl(HttpServletRequest req, String overrideRequestURI, Object scopeKey, ServletContext servletContext, boolean seeOuterRequestAttributes)
           
 
Method Summary
 void addListenScope(Object scopeKey)
          Adds a scope to "listen" to.
 void addParameter(String name, String value)
          Add a parameter to the request.
 boolean didRedirect()
          Deprecated. Use ScopedResponseImpl.didRedirect() instead.
 void doForward()
           
 Map filterParameterMap(Map parameterMap)
           
 Object getAttribute(String attrName)
           
 Object getAttribute(String attrName, boolean allowOuterRequestAttributes)
          Same as getAttribute, but allows outer request attributes to be hidden explicitly, even if the implementation of getAttribute shows them by default.
 Enumeration getAttributeNames()
           
 String getForwardedURI()
           
 String getListenScopeParameter(String paramName)
          Get the parameter from the listen scoped requests
 String getLocalParameter(String paramName)
          Get the parameter from the scoped request only (don't check in listen scoped requests)
 HttpServletRequest getOuterRequest()
           
 String getParameter(String paramName)
           
 Map getParameterMap()
           
 Enumeration getParameterNames()
           
 String[] getParameterValues(String paramName)
           
 String getPathInfo()
           
 RequestDispatcher getRequestDispatcher(String uri)
           
 String getRequestedSessionId()
           
 String getRequestURI()
           
 StringBuffer getRequestURL()
           
 String getScopedName(String baseName)
           
 Object getScopeKey()
           
 String getServletPath()
           
 boolean hasListenScopes()
          see if this scoped request is listening to any other scoped request
 void persistAttributes()
          Stores the current map of request attributes in the Session.
 void registerOuterAttribute(String attrName)
           
 void removeAttribute(String attrName)
           
 void renameScope(Object newScopeKey)
           
static void renameSessionScope(Object oldScopeKey, Object newScopeKey, HttpServletRequest outerRequest)
           
 void restoreAttributes()
          Restores the map of request attributes from a map saved in the Session.
 void setActiveRequest()
          Makes this request listen to specially-prefixed request parameters.
 void setAttribute(String attrName, Object o)
           
 void setForwardedURI(String uri)
          Simply stores the URI that was being forwarded to.
 void setPathInfo(String pathInfo)
           
 void setRequestURI(String uri)
           
 void setRequestURI(String contextPath, String servletPath)
           
 
Methods inherited from class HttpServletRequestWrapper
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathTranslated, getQueryString, getRemoteUser, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class ServletRequestWrapper
getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getScheme, getServerName, getServerPort, isSecure, setCharacterEncoding, setRequest
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface HttpServletRequest
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathTranslated, getQueryString, getRemoteUser, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from interface ServletRequest
getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocale, getLocales, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getScheme, getServerName, getServerPort, isSecure, setCharacterEncoding
 

Constructor Detail

ScopedRequestImpl

public ScopedRequestImpl(HttpServletRequest req,
                         String overrideRequestURI,
                         Object scopeKey,
                         ServletContext servletContext,
                         boolean seeOuterRequestAttributes)

ScopedRequestImpl

public ScopedRequestImpl(HttpServletRequest req,
                         String overrideRequestURI,
                         Object scopeKey,
                         ServletContext context)
Deprecated. Use ScopedRequestImpl(HttpServletRequest, String, Object, ServletContext, boolean).

Method Detail

getRequestedSessionId

public String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface HttpServletRequest
Overrides:
getRequestedSessionId in class HttpServletRequestWrapper

getRequestURI

public String getRequestURI()
Specified by:
getRequestURI in interface HttpServletRequest
Overrides:
getRequestURI in class HttpServletRequestWrapper

setRequestURI

public void setRequestURI(String uri)
Specified by:
setRequestURI in interface ScopedRequest

setRequestURI

public void setRequestURI(String contextPath,
                          String servletPath)

getRequestURL

public StringBuffer getRequestURL()
Specified by:
getRequestURL in interface HttpServletRequest
Overrides:
getRequestURL in class HttpServletRequestWrapper

getServletPath

public String getServletPath()
Specified by:
getServletPath in interface HttpServletRequest
Overrides:
getServletPath in class HttpServletRequestWrapper

getParameter

public String getParameter(String paramName)
Specified by:
getParameter in interface ServletRequest
Overrides:
getParameter in class ServletRequestWrapper

addParameter

public void addParameter(String name,
                         String value)
Add a parameter to the request.

Parameters:
name - the parameter name.
value - the parameter value.

getLocalParameter

public String getLocalParameter(String paramName)
Get the parameter from the scoped request only (don't check in listen scoped requests)

Specified by:
getLocalParameter in interface ScopedRequest
Parameters:
paramName -
Returns:
value of the parameter

getListenScopeParameter

public String getListenScopeParameter(String paramName)
Get the parameter from the listen scoped requests

Specified by:
getListenScopeParameter in interface ScopedRequest
Parameters:
paramName -
Returns:
value of the parameter

getParameterNames

public Enumeration getParameterNames()
Specified by:
getParameterNames in interface ServletRequest
Overrides:
getParameterNames in class ServletRequestWrapper

getParameterValues

public String[] getParameterValues(String paramName)
Specified by:
getParameterValues in interface ServletRequest
Overrides:
getParameterValues in class ServletRequestWrapper

getParameterMap

public Map getParameterMap()
Specified by:
getParameterMap in interface ServletRequest
Overrides:
getParameterMap in class ServletRequestWrapper

filterParameterMap

public Map filterParameterMap(Map parameterMap)
Specified by:
filterParameterMap in interface ScopedRequest

addListenScope

public void addListenScope(Object scopeKey)
Adds a scope to "listen" to. This scope will see all request parameters from a ScopedRequest of the given scope.

Specified by:
addListenScope in interface ScopedRequest

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String uri)
Specified by:
getRequestDispatcher in interface ServletRequest
Overrides:
getRequestDispatcher in class ServletRequestWrapper

doForward

public void doForward()
Specified by:
doForward in interface ScopedRequest

setForwardedURI

public void setForwardedURI(String uri)
Simply stores the URI that was being forwarded to.

Specified by:
setForwardedURI in interface ScopedRequest
Parameters:
uri -

getForwardedURI

public String getForwardedURI()
Specified by:
getForwardedURI in interface ScopedRequest

didRedirect

public boolean didRedirect()
Deprecated. Use ScopedResponseImpl.didRedirect() instead.

Specified by:
didRedirect in interface ScopedRequest

persistAttributes

public void persistAttributes()
Stores the current map of request attributes in the Session.

Specified by:
persistAttributes in interface ScopedRequest

restoreAttributes

public void restoreAttributes()
Restores the map of request attributes from a map saved in the Session.

Specified by:
restoreAttributes in interface ScopedRequest

getOuterRequest

public final HttpServletRequest getOuterRequest()
Specified by:
getOuterRequest in interface ScopedRequest

getAttribute

public final Object getAttribute(String attrName)
Specified by:
getAttribute in interface ServletRequest
Overrides:
getAttribute in class ServletRequestWrapper

getAttribute

public final Object getAttribute(String attrName,
                                 boolean allowOuterRequestAttributes)
Description copied from interface: ScopedRequest
Same as getAttribute, but allows outer request attributes to be hidden explicitly, even if the implementation of getAttribute shows them by default.

Specified by:
getAttribute in interface ScopedRequest

setAttribute

public final void setAttribute(String attrName,
                               Object o)
Specified by:
setAttribute in interface ServletRequest
Overrides:
setAttribute in class ServletRequestWrapper

getAttributeNames

public final Enumeration getAttributeNames()
Specified by:
getAttributeNames in interface ServletRequest
Overrides:
getAttributeNames in class ServletRequestWrapper

removeAttribute

public final void removeAttribute(String attrName)
Specified by:
removeAttribute in interface ServletRequest
Overrides:
removeAttribute in class ServletRequestWrapper

registerOuterAttribute

public void registerOuterAttribute(String attrName)
Specified by:
registerOuterAttribute in interface ScopedRequest

getScopeKey

public final Object getScopeKey()
Specified by:
getScopeKey in interface ScopedRequest

renameScope

public void renameScope(Object newScopeKey)
Specified by:
renameScope in interface ScopedRequest

renameSessionScope

public static void renameSessionScope(Object oldScopeKey,
                                      Object newScopeKey,
                                      HttpServletRequest outerRequest)

getPathInfo

public String getPathInfo()
Specified by:
getPathInfo in interface HttpServletRequest
Overrides:
getPathInfo in class HttpServletRequestWrapper

setPathInfo

public void setPathInfo(String pathInfo)

setActiveRequest

public void setActiveRequest()
Makes this request listen to specially-prefixed request parameters.

Specified by:
setActiveRequest in interface ScopedRequest

getScopedName

public final String getScopedName(String baseName)
Specified by:
getScopedName in interface ScopedRequest

hasListenScopes

public boolean hasListenScopes()
see if this scoped request is listening to any other scoped request

Specified by:
hasListenScopes in interface ScopedRequest
Returns:
true if has listen scopes