net.sourceforge.stripes.controller
Class FlashRequest

java.lang.Object
  extended by net.sourceforge.stripes.controller.FlashRequest
All Implemented Interfaces:
Serializable, HttpServletRequest, ServletRequest

public class FlashRequest
extends Object
implements HttpServletRequest, Serializable

Captures the state of an HttpServletRequest so that the information contained therein can be carried over to the next request for use by the flash scope. There are several methods in here that cannot be faked and so must delegate to an active HttpServletRequest object, the delegate. If one of these methods is called and there is no delegate object set on the instance, they will throw a StripesRuntimeException. Unless this class is used outside its intended context (during a live request processed through StripesFilter), you won't need to worry about that.

Since:
Stripes 1.4.3
Author:
Ben Gunter
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
FlashRequest(HttpServletRequest prototype)
          Creates a new FlashRequest by copying all appropriate attributes from the prototype request supplied.
 
Method Summary
 Object getAttribute(String name)
           
 Enumeration<String> getAttributeNames()
           
 String getAuthType()
           
 String getCharacterEncoding()
           
 int getContentLength()
           
 String getContentType()
           
 String getContextPath()
           
 Cookie[] getCookies()
           
 long getDateHeader(String name)
           
protected  HttpServletRequest getDelegate()
           
 String getHeader(String name)
           
 Enumeration<String> getHeaderNames()
           
 Enumeration<String> getHeaders(String name)
           
 ServletInputStream getInputStream()
           
 int getIntHeader(String name)
           
 String getLocalAddr()
           
 Locale getLocale()
           
 Enumeration<Locale> getLocales()
           
 String getLocalName()
           
 int getLocalPort()
           
 String getMethod()
           
 String getParameter(String name)
           
 Map<String,String[]> getParameterMap()
           
 Enumeration<String> getParameterNames()
           
 String[] getParameterValues(String name)
           
 String getPathInfo()
           
 String getPathTranslated()
           
 String getProtocol()
           
 String getQueryString()
           
 BufferedReader getReader()
           
 String getRealPath(String name)
          Deprecated. 
 String getRemoteAddr()
           
 String getRemoteHost()
           
 int getRemotePort()
           
 String getRemoteUser()
           
 RequestDispatcher getRequestDispatcher(String name)
           
 String getRequestedSessionId()
           
 String getRequestURI()
           
 StringBuffer getRequestURL()
           
 String getScheme()
           
 String getServerName()
           
 int getServerPort()
           
 String getServletPath()
           
 HttpSession getSession()
           
 HttpSession getSession(boolean create)
           
 Principal getUserPrincipal()
           
 boolean isRequestedSessionIdFromCookie()
           
 boolean isRequestedSessionIdFromUrl()
          Deprecated. 
 boolean isRequestedSessionIdFromURL()
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(String role)
           
 void removeAttribute(String name)
           
static StripesRequestWrapper replaceRequest(HttpServletRequest request)
          Finds the StripesRequestWrapper for the supplied request and swaps out the underlying request for an instance of FlashRequest.
 void setAttribute(String name, Object value)
           
 void setCharacterEncoding(String characterEncoding)
           
 void setDelegate(HttpServletRequest delegate)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlashRequest

public FlashRequest(HttpServletRequest prototype)
Creates a new FlashRequest by copying all appropriate attributes from the prototype request supplied.

Parameters:
prototype - the HttpServletRequest to create a disconnected copy of
Method Detail

replaceRequest

public static StripesRequestWrapper replaceRequest(HttpServletRequest request)
Finds the StripesRequestWrapper for the supplied request and swaps out the underlying request for an instance of FlashRequest.

Parameters:
request - the current HttpServletRequest
Returns:
the StripesRequestWrapper for this request with the "live" request replaced

getDelegate

protected HttpServletRequest getDelegate()

setDelegate

public void setDelegate(HttpServletRequest delegate)

getAuthType

public String getAuthType()
Specified by:
getAuthType in interface HttpServletRequest

getCookies

public Cookie[] getCookies()
Specified by:
getCookies in interface HttpServletRequest

getDateHeader

public long getDateHeader(String name)
Specified by:
getDateHeader in interface HttpServletRequest

getHeader

public String getHeader(String name)
Specified by:
getHeader in interface HttpServletRequest

getHeaders

public Enumeration<String> getHeaders(String name)
Specified by:
getHeaders in interface HttpServletRequest

getHeaderNames

public Enumeration<String> getHeaderNames()
Specified by:
getHeaderNames in interface HttpServletRequest

getIntHeader

public int getIntHeader(String name)
Specified by:
getIntHeader in interface HttpServletRequest

getMethod

public String getMethod()
Specified by:
getMethod in interface HttpServletRequest

getPathInfo

public String getPathInfo()
Specified by:
getPathInfo in interface HttpServletRequest

getPathTranslated

public String getPathTranslated()
Specified by:
getPathTranslated in interface HttpServletRequest

getContextPath

public String getContextPath()
Specified by:
getContextPath in interface HttpServletRequest

getQueryString

public String getQueryString()
Specified by:
getQueryString in interface HttpServletRequest

getRemoteUser

public String getRemoteUser()
Specified by:
getRemoteUser in interface HttpServletRequest

isUserInRole

public boolean isUserInRole(String role)
Specified by:
isUserInRole in interface HttpServletRequest

getUserPrincipal

public Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface HttpServletRequest

getRequestedSessionId

public String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface HttpServletRequest

getRequestURI

public String getRequestURI()
Specified by:
getRequestURI in interface HttpServletRequest

getRequestURL

public StringBuffer getRequestURL()
Specified by:
getRequestURL in interface HttpServletRequest

getServletPath

public String getServletPath()
Specified by:
getServletPath in interface HttpServletRequest

getSession

public HttpSession getSession(boolean create)
Specified by:
getSession in interface HttpServletRequest

getSession

public HttpSession getSession()
Specified by:
getSession in interface HttpServletRequest

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface HttpServletRequest

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Specified by:
isRequestedSessionIdFromCookie in interface HttpServletRequest

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Specified by:
isRequestedSessionIdFromURL in interface HttpServletRequest

isRequestedSessionIdFromUrl

@Deprecated
public boolean isRequestedSessionIdFromUrl()
Deprecated. 

Specified by:
isRequestedSessionIdFromUrl in interface HttpServletRequest

getAttribute

public Object getAttribute(String name)
Specified by:
getAttribute in interface ServletRequest

getAttributeNames

public Enumeration<String> getAttributeNames()
Specified by:
getAttributeNames in interface ServletRequest

getCharacterEncoding

public String getCharacterEncoding()
Specified by:
getCharacterEncoding in interface ServletRequest

setCharacterEncoding

public void setCharacterEncoding(String characterEncoding)
Specified by:
setCharacterEncoding in interface ServletRequest

getContentLength

public int getContentLength()
Specified by:
getContentLength in interface ServletRequest

getContentType

public String getContentType()
Specified by:
getContentType in interface ServletRequest

getInputStream

public ServletInputStream getInputStream()
Specified by:
getInputStream in interface ServletRequest

getParameter

public String getParameter(String name)
Specified by:
getParameter in interface ServletRequest

getParameterNames

public Enumeration<String> getParameterNames()
Specified by:
getParameterNames in interface ServletRequest

getParameterValues

public String[] getParameterValues(String name)
Specified by:
getParameterValues in interface ServletRequest

getParameterMap

public Map<String,String[]> getParameterMap()
Specified by:
getParameterMap in interface ServletRequest

getProtocol

public String getProtocol()
Specified by:
getProtocol in interface ServletRequest

getScheme

public String getScheme()
Specified by:
getScheme in interface ServletRequest

getServerName

public String getServerName()
Specified by:
getServerName in interface ServletRequest

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface ServletRequest

getReader

public BufferedReader getReader()
Specified by:
getReader in interface ServletRequest

getRemoteAddr

public String getRemoteAddr()
Specified by:
getRemoteAddr in interface ServletRequest

getRemoteHost

public String getRemoteHost()
Specified by:
getRemoteHost in interface ServletRequest

setAttribute

public void setAttribute(String name,
                         Object value)
Specified by:
setAttribute in interface ServletRequest

removeAttribute

public void removeAttribute(String name)
Specified by:
removeAttribute in interface ServletRequest

getLocale

public Locale getLocale()
Specified by:
getLocale in interface ServletRequest

getLocales

public Enumeration<Locale> getLocales()
Specified by:
getLocales in interface ServletRequest

isSecure

public boolean isSecure()
Specified by:
isSecure in interface ServletRequest

getRequestDispatcher

public RequestDispatcher getRequestDispatcher(String name)
Specified by:
getRequestDispatcher in interface ServletRequest

getRealPath

@Deprecated
public String getRealPath(String name)
Deprecated. 

Specified by:
getRealPath in interface ServletRequest

getRemotePort

public int getRemotePort()
Specified by:
getRemotePort in interface ServletRequest

getLocalName

public String getLocalName()
Specified by:
getLocalName in interface ServletRequest

getLocalAddr

public String getLocalAddr()
Specified by:
getLocalAddr in interface ServletRequest

getLocalPort

public int getLocalPort()
Specified by:
getLocalPort in interface ServletRequest


? Copyright 2005-2006, Stripes Development Team.