org.apache.jcs.utils.servlet.session
Class HttpServletRequestFacade

java.lang.Object
  extended byorg.apache.jcs.utils.servlet.session.HttpServletRequestFacade
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class HttpServletRequestFacade
extends java.lang.Object
implements javax.servlet.http.HttpServletRequest

Session wrapper, to overide some methods. Servlet 2.3 has an easier way to do this.

Author:
Aaron Smuts, Daniel Rall

Field Summary
private  java.lang.String characterEncoding
           
private static DistSessionTracker dst
           
private  MetaHttpSession ms
           
private  javax.servlet.http.HttpServletRequest req
           
private  javax.servlet.http.HttpServletResponse res
           
 
Constructor Summary
HttpServletRequestFacade(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Needs some way to get cookies out, must pass res too!
 
Method Summary
 java.lang.Object getAttribute(java.lang.String name)
          Gets the attribute attribute of the HttpServletRequestFacade object
 java.util.Enumeration getAttributeNames()
          Gets the attributeNames attribute of the HttpServletRequestFacade object
 java.lang.String getAuthType()
          Gets the authType attribute of the HttpServletRequestFacade object
 java.lang.String getCharacterEncoding()
          Gets the characterEncoding attribute of the HttpServletRequestFacade object
 int getContentLength()
          Gets the contentLength attribute of the HttpServletRequestFacade object
 java.lang.String getContentType()
          Gets the contentType attribute of the HttpServletRequestFacade object
 java.lang.String getContextPath()
          Gets the contextPath attribute of the HttpServletRequestFacade object
 javax.servlet.http.Cookie[] getCookies()
          Gets the cookies attribute of the HttpServletRequestFacade object
 long getDateHeader(java.lang.String name)
          Gets the dateHeader attribute of the HttpServletRequestFacade object
 java.lang.String getHeader(java.lang.String name)
          Gets the header attribute of the HttpServletRequestFacade object
 java.util.Enumeration getHeaderNames()
          Gets the headerNames attribute of the HttpServletRequestFacade object
 java.util.Enumeration getHeaders(java.lang.String name)
          Gets the headers attribute of the HttpServletRequestFacade object
 javax.servlet.ServletInputStream getInputStream()
          Gets the inputStream attribute of the HttpServletRequestFacade object
 int getIntHeader(java.lang.String name)
          Gets the intHeader attribute of the HttpServletRequestFacade object
 java.util.Locale getLocale()
          Gets the locale attribute of the HttpServletRequestFacade object
 java.util.Enumeration getLocales()
          Gets the locales attribute of the HttpServletRequestFacade object
 java.lang.String getMethod()
          Gets the method attribute of the HttpServletRequestFacade object
 java.lang.String getParameter(java.lang.String name)
          Gets the parameter attribute of the HttpServletRequestFacade object
 java.util.Map getParameterMap()
          The implementation of this method will remain somewhat expensive until Servlet API 2.3 is adopted.
 java.util.Enumeration getParameterNames()
          Gets the parameterNames attribute of the HttpServletRequestFacade object
 java.lang.String[] getParameterValues(java.lang.String name)
          Gets the parameterValues attribute of the HttpServletRequestFacade object
 java.lang.String getPathInfo()
          Gets the pathInfo attribute of the HttpServletRequestFacade object
 java.lang.String getPathTranslated()
          Gets the pathTranslated attribute of the HttpServletRequestFacade object
 java.lang.String getProtocol()
          Gets the protocol attribute of the HttpServletRequestFacade object
 java.lang.String getQueryString()
          Gets the queryString attribute of the HttpServletRequestFacade object
 java.io.BufferedReader getReader()
          Gets the reader attribute of the HttpServletRequestFacade object
 java.lang.String getRealPath(java.lang.String path)
          Gets the realPath attribute of the HttpServletRequestFacade object
 java.lang.String getRemoteAddr()
          Gets the remoteAddr attribute of the HttpServletRequestFacade object
 java.lang.String getRemoteHost()
          Gets the remoteHost attribute of the HttpServletRequestFacade object
 java.lang.String getRemoteUser()
          Gets the remoteUser attribute of the HttpServletRequestFacade object
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
          Gets the requestDispatcher attribute of the HttpServletRequestFacade object
 java.lang.String getRequestedSessionId()
          Gets the requestedSessionId attribute of the HttpServletRequestFacade object
 java.lang.String getRequestURI()
          Gets the requestURI attribute of the HttpServletRequestFacade object
 java.lang.StringBuffer getRequestURL()
          Gets the full request URL.
 java.lang.String getScheme()
          Gets the scheme attribute of the HttpServletRequestFacade object
 java.lang.String getServerName()
          Gets the serverName attribute of the HttpServletRequestFacade object
 int getServerPort()
          Gets the serverPort attribute of the HttpServletRequestFacade object
 java.lang.String getServletPath()
          Gets the servletPath attribute of the HttpServletRequestFacade object
 javax.servlet.http.HttpSession getSession()
          Gets the session attribute of the HttpServletRequestFacade object
 javax.servlet.http.HttpSession getSession(boolean create)
          Gets the session attribute of the HttpServletRequestFacade object
 java.lang.String getSessionId()
          Gets the sessionId attribute of the HttpServletRequestFacade object
 java.security.Principal getUserPrincipal()
          Gets the userPrincipal attribute of the HttpServletRequestFacade object
 boolean isRequestedSessionIdFromCookie()
          Gets the requestedSessionIdFromCookie attribute of the HttpServletRequestFacade object
 boolean isRequestedSessionIdFromUrl()
          Gets the requestedSessionIdFromUrl attribute of the HttpServletRequestFacade object
 boolean isRequestedSessionIdFromURL()
          Gets the requestedSessionIdFromURL attribute of the HttpServletRequestFacade object
 boolean isRequestedSessionIdValid()
          Gets the requestedSessionIdValid attribute of the HttpServletRequestFacade object
 boolean isSecure()
          Gets the secure attribute of the HttpServletRequestFacade object
 boolean isUserInRole(java.lang.String role)
          Gets the userInRole attribute of the HttpServletRequestFacade object
 void removeAttribute(java.lang.String name)
          Description of the Method
 void setAttribute(java.lang.String key, java.lang.Object o)
          Sets the attribute attribute of the HttpServletRequestFacade object
 void setCharacterEncoding(java.lang.String enc)
          Overrides the name of the character encoding used in the body of this request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dst

private static final transient DistSessionTracker dst

req

private final javax.servlet.http.HttpServletRequest req

res

private final javax.servlet.http.HttpServletResponse res

ms

private MetaHttpSession ms

characterEncoding

private java.lang.String characterEncoding
Constructor Detail

HttpServletRequestFacade

public HttpServletRequestFacade(javax.servlet.http.HttpServletRequest req,
                                javax.servlet.http.HttpServletResponse res)
Needs some way to get cookies out, must pass res too!

Parameters:
req -
res -
Method Detail

getSessionId

public java.lang.String getSessionId()
Gets the sessionId attribute of the HttpServletRequestFacade object

Returns:
The sessionId value

getSession

public javax.servlet.http.HttpSession getSession()
Gets the session attribute of the HttpServletRequestFacade object

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Returns:
The session value

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
Gets the session attribute of the HttpServletRequestFacade object

Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Returns:
The session value

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Gets the attribute attribute of the HttpServletRequestFacade object

Specified by:
getAttribute in interface javax.servlet.ServletRequest
Returns:
The attribute value

getAttributeNames

public java.util.Enumeration getAttributeNames()
Gets the attributeNames attribute of the HttpServletRequestFacade object

Specified by:
getAttributeNames in interface javax.servlet.ServletRequest
Returns:
The attributeNames value

getCharacterEncoding

public java.lang.String getCharacterEncoding()
Gets the characterEncoding attribute of the HttpServletRequestFacade object

Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest
Returns:
The characterEncoding value

setCharacterEncoding

public void setCharacterEncoding(java.lang.String enc)
                          throws java.io.UnsupportedEncodingException
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading request parameters or reading input using getReader() . NOTE: This method will not modify the underlying request until Servlet API 2.3 is adopted.

Parameters:
enc - The character encoding to be used
Throws:
java.io.UnsupportedEncodingException - If the specified encoding is not supported.

getContentLength

public int getContentLength()
Gets the contentLength attribute of the HttpServletRequestFacade object

Specified by:
getContentLength in interface javax.servlet.ServletRequest
Returns:
The contentLength value

getContentType

public java.lang.String getContentType()
Gets the contentType attribute of the HttpServletRequestFacade object

Specified by:
getContentType in interface javax.servlet.ServletRequest
Returns:
The contentType value

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Gets the inputStream attribute of the HttpServletRequestFacade object

Specified by:
getInputStream in interface javax.servlet.ServletRequest
Returns:
The inputStream value
Throws:
java.io.IOException

getParameter

public java.lang.String getParameter(java.lang.String name)
Gets the parameter attribute of the HttpServletRequestFacade object

Specified by:
getParameter in interface javax.servlet.ServletRequest
Returns:
The parameter value

getParameterNames

public java.util.Enumeration getParameterNames()
Gets the parameterNames attribute of the HttpServletRequestFacade object

Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Returns:
The parameterNames value

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Gets the parameterValues attribute of the HttpServletRequestFacade object

Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Returns:
The parameterValues value

getParameterMap

public java.util.Map getParameterMap()
The implementation of this method will remain somewhat expensive until Servlet API 2.3 is adopted.

Returns:
The {3} value

getProtocol

public java.lang.String getProtocol()
Gets the protocol attribute of the HttpServletRequestFacade object

Specified by:
getProtocol in interface javax.servlet.ServletRequest
Returns:
The protocol value

getScheme

public java.lang.String getScheme()
Gets the scheme attribute of the HttpServletRequestFacade object

Specified by:
getScheme in interface javax.servlet.ServletRequest
Returns:
The scheme value

getServerName

public java.lang.String getServerName()
Gets the serverName attribute of the HttpServletRequestFacade object

Specified by:
getServerName in interface javax.servlet.ServletRequest
Returns:
The serverName value

getServerPort

public int getServerPort()
Gets the serverPort attribute of the HttpServletRequestFacade object

Specified by:
getServerPort in interface javax.servlet.ServletRequest
Returns:
The serverPort value

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.IOException
Gets the reader attribute of the HttpServletRequestFacade object

Specified by:
getReader in interface javax.servlet.ServletRequest
Returns:
The reader value
Throws:
java.io.IOException

getRemoteAddr

public java.lang.String getRemoteAddr()
Gets the remoteAddr attribute of the HttpServletRequestFacade object

Specified by:
getRemoteAddr in interface javax.servlet.ServletRequest
Returns:
The remoteAddr value

getRemoteHost

public java.lang.String getRemoteHost()
Gets the remoteHost attribute of the HttpServletRequestFacade object

Specified by:
getRemoteHost in interface javax.servlet.ServletRequest
Returns:
The remoteHost value

setAttribute

public void setAttribute(java.lang.String key,
                         java.lang.Object o)
Sets the attribute attribute of the HttpServletRequestFacade object

Specified by:
setAttribute in interface javax.servlet.ServletRequest
Parameters:
key - The new attribute value
o - The new attribute value

removeAttribute

public void removeAttribute(java.lang.String name)
Description of the Method

Specified by:
removeAttribute in interface javax.servlet.ServletRequest

getLocale

public java.util.Locale getLocale()
Gets the locale attribute of the HttpServletRequestFacade object

Specified by:
getLocale in interface javax.servlet.ServletRequest
Returns:
The locale value

getLocales

public java.util.Enumeration getLocales()
Gets the locales attribute of the HttpServletRequestFacade object

Specified by:
getLocales in interface javax.servlet.ServletRequest
Returns:
The locales value

isSecure

public boolean isSecure()
Gets the secure attribute of the HttpServletRequestFacade object

Specified by:
isSecure in interface javax.servlet.ServletRequest
Returns:
The secure value

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Gets the requestDispatcher attribute of the HttpServletRequestFacade object

Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest
Returns:
The requestDispatcher value

getRealPath

public java.lang.String getRealPath(java.lang.String path)
Gets the realPath attribute of the HttpServletRequestFacade object

Specified by:
getRealPath in interface javax.servlet.ServletRequest
Returns:
The realPath value

getAuthType

public java.lang.String getAuthType()
Gets the authType attribute of the HttpServletRequestFacade object

Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest
Returns:
The authType value

getCookies

public javax.servlet.http.Cookie[] getCookies()
Gets the cookies attribute of the HttpServletRequestFacade object

Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest
Returns:
The cookies value

getDateHeader

public long getDateHeader(java.lang.String name)
Gets the dateHeader attribute of the HttpServletRequestFacade object

Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest
Returns:
The dateHeader value

getHeader

public java.lang.String getHeader(java.lang.String name)
Gets the header attribute of the HttpServletRequestFacade object

Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest
Returns:
The header value

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
Gets the headers attribute of the HttpServletRequestFacade object

Specified by:
getHeaders in interface javax.servlet.http.HttpServletRequest
Returns:
The headers value

getHeaderNames

public java.util.Enumeration getHeaderNames()
Gets the headerNames attribute of the HttpServletRequestFacade object

Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest
Returns:
The headerNames value

getIntHeader

public int getIntHeader(java.lang.String name)
Gets the intHeader attribute of the HttpServletRequestFacade object

Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest
Returns:
The intHeader value

getMethod

public java.lang.String getMethod()
Gets the method attribute of the HttpServletRequestFacade object

Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest
Returns:
The method value

getPathInfo

public java.lang.String getPathInfo()
Gets the pathInfo attribute of the HttpServletRequestFacade object

Specified by:
getPathInfo in interface javax.servlet.http.HttpServletRequest
Returns:
The pathInfo value

getPathTranslated

public java.lang.String getPathTranslated()
Gets the pathTranslated attribute of the HttpServletRequestFacade object

Specified by:
getPathTranslated in interface javax.servlet.http.HttpServletRequest
Returns:
The pathTranslated value

getContextPath

public java.lang.String getContextPath()
Gets the contextPath attribute of the HttpServletRequestFacade object

Specified by:
getContextPath in interface javax.servlet.http.HttpServletRequest
Returns:
The contextPath value

getQueryString

public java.lang.String getQueryString()
Gets the queryString attribute of the HttpServletRequestFacade object

Specified by:
getQueryString in interface javax.servlet.http.HttpServletRequest
Returns:
The queryString value

getRemoteUser

public java.lang.String getRemoteUser()
Gets the remoteUser attribute of the HttpServletRequestFacade object

Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest
Returns:
The remoteUser value

isUserInRole

public boolean isUserInRole(java.lang.String role)
Gets the userInRole attribute of the HttpServletRequestFacade object

Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest
Returns:
The userInRole value

getUserPrincipal

public java.security.Principal getUserPrincipal()
Gets the userPrincipal attribute of the HttpServletRequestFacade object

Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest
Returns:
The userPrincipal value

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Gets the requestedSessionId attribute of the HttpServletRequestFacade object

Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest
Returns:
The requestedSessionId value

getRequestURI

public java.lang.String getRequestURI()
Gets the requestURI attribute of the HttpServletRequestFacade object

Specified by:
getRequestURI in interface javax.servlet.http.HttpServletRequest
Returns:
The requestURI value

getRequestURL

public java.lang.StringBuffer getRequestURL()
Gets the full request URL.

Returns:
A new buffer containing the reconstructed URL.

getServletPath

public java.lang.String getServletPath()
Gets the servletPath attribute of the HttpServletRequestFacade object

Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest
Returns:
The servletPath value

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Gets the requestedSessionIdValid attribute of the HttpServletRequestFacade object

Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest
Returns:
The requestedSessionIdValid value

isRequestedSessionIdFromCookie

public boolean isRequestedSessionIdFromCookie()
Gets the requestedSessionIdFromCookie attribute of the HttpServletRequestFacade object

Specified by:
isRequestedSessionIdFromCookie in interface javax.servlet.http.HttpServletRequest
Returns:
The requestedSessionIdFromCookie value

isRequestedSessionIdFromURL

public boolean isRequestedSessionIdFromURL()
Gets the requestedSessionIdFromURL attribute of the HttpServletRequestFacade object

Specified by:
isRequestedSessionIdFromURL in interface javax.servlet.http.HttpServletRequest
Returns:
The requestedSessionIdFromURL value

isRequestedSessionIdFromUrl

public boolean isRequestedSessionIdFromUrl()
Gets the requestedSessionIdFromUrl attribute of the HttpServletRequestFacade object

Specified by:
isRequestedSessionIdFromUrl in interface javax.servlet.http.HttpServletRequest
Returns:
The requestedSessionIdFromUrl value