org.jasig.portal.url
Class PortalHttpServletRequestWrapper

java.lang.Object
  extended by org.jasig.portal.url.AbstractHttpServletRequestWrapper
      extended by org.jasig.portal.url.PortalHttpServletRequestWrapper
All Implemented Interfaces:
HttpServletRequest, ServletRequest, IWritableHttpServletRequest

public class PortalHttpServletRequestWrapper
extends AbstractHttpServletRequestWrapper
implements IWritableHttpServletRequest

Portal wide request wrapper. Provides portal specific information for request parameters, attributes, user and role.

Version:
$Revision: 11911 $
Author:
Peter Kharchenko: pkharchenko at unicon.net

Field Summary
static String ATTRIBUTE__HTTP_SERVLET_REQUEST
          HttpServletRequest attribute that this HttpServletRequest object will be available.
static String ATTRIBUTE__HTTP_SERVLET_RESPONSE
          HttpServletRequest attribute that the HttpServletResponse object will be available.
protected  org.apache.commons.logging.Log logger
           
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
PortalHttpServletRequestWrapper(HttpServletRequest request, HttpServletResponse response, IUserInstanceManager userInstanceManager)
          Construct a writable this.request wrapping a real this.request
 
Method Summary
 boolean addParameterValue(String name, String value)
          Adds a value of a request parameter
 boolean deleteParameter(String name)
          Removes any values of an existing parameter
 boolean deleteParameterValue(String name, String value)
          Removes all occurances of the specific value of a request parameter
 Object getAttribute(String name)
           
 Locale getLocale()
           
 Enumeration<Locale> getLocales()
           
 String getParameter(String name)
           
 Map<String,String[]> getParameterMap()
           
 Enumeration<String> getParameterNames()
           
 String[] getParameterValues(String name)
           
 String getRemoteUser()
           
 Principal getUserPrincipal()
           
 boolean isUserInRole(String role)
          Determines whether or not the user is in the given role.
 boolean setParameterValue(String name, String value)
          Sets a value of request parameter (overwriting any previous values)
 boolean setParameterValues(String name, String[] values)
          Sets a set of values of request parameter (overwriting any previous values)
 
Methods inherited from class org.jasig.portal.url.AbstractHttpServletRequestWrapper
getAttributeNames, getAuthType, getCharacterEncoding, getContentLength, getContentType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getInputStream, getIntHeader, getLocalAddr, getLocalName, getLocalPort, getMethod, getPathInfo, getPathTranslated, getProtocol, getQueryString, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getRequestedSessionId, getRequestURI, getRequestURL, getScheme, getServerName, getServerPort, getServletPath, getSession, getSession, getWrappedRequest, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.http.HttpServletRequest
getAuthType, getContextPath, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid
 
Methods inherited from interface javax.servlet.ServletRequest
getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Field Detail

ATTRIBUTE__HTTP_SERVLET_REQUEST

public static final String ATTRIBUTE__HTTP_SERVLET_REQUEST
HttpServletRequest attribute that this HttpServletRequest object will be available.


ATTRIBUTE__HTTP_SERVLET_RESPONSE

public static final String ATTRIBUTE__HTTP_SERVLET_RESPONSE
HttpServletRequest attribute that the HttpServletResponse object will be available.


logger

protected final org.apache.commons.logging.Log logger
Constructor Detail

PortalHttpServletRequestWrapper

public PortalHttpServletRequestWrapper(HttpServletRequest request,
                                       HttpServletResponse response,
                                       IUserInstanceManager userInstanceManager)
Construct a writable this.request wrapping a real this.request

Parameters:
this.request - Request to wrap, can not be null.
Method Detail

getAttribute

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

addParameterValue

public boolean addParameterValue(String name,
                                 String value)
Description copied from interface: IWritableHttpServletRequest
Adds a value of a request parameter

Specified by:
addParameterValue in interface IWritableHttpServletRequest
Parameters:
name - The name of the request parameter
value - The value of the request parameter
Returns:
true if the parameter already existsted

setParameterValue

public boolean setParameterValue(String name,
                                 String value)
Description copied from interface: IWritableHttpServletRequest
Sets a value of request parameter (overwriting any previous values)

Specified by:
setParameterValue in interface IWritableHttpServletRequest
Parameters:
name - The name of the request parameter
value - The value of the request parameter
Returns:
true if the parameter already existsted

setParameterValues

public boolean setParameterValues(String name,
                                  String[] values)
Description copied from interface: IWritableHttpServletRequest
Sets a set of values of request parameter (overwriting any previous values)

Specified by:
setParameterValues in interface IWritableHttpServletRequest
Parameters:
name - The name of the request parameter
values - The values of the request parameter
Returns:
true if the parameter already existsted

deleteParameter

public boolean deleteParameter(String name)
Description copied from interface: IWritableHttpServletRequest
Removes any values of an existing parameter

Specified by:
deleteParameter in interface IWritableHttpServletRequest
Parameters:
name - The name of the request parameter to remove
Returns:
true if the parameter existed

deleteParameterValue

public boolean deleteParameterValue(String name,
                                    String value)
Description copied from interface: IWritableHttpServletRequest
Removes all occurances of the specific value of a request parameter

Specified by:
deleteParameterValue in interface IWritableHttpServletRequest
Parameters:
name - The name of the request parameter
value - The value to remove all occurances of
Returns:
true if the parameter value existed

getParameter

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

getParameterMap

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

getParameterNames

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

getParameterValues

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

getRemoteUser

public String getRemoteUser()
Specified by:
getRemoteUser in interface HttpServletRequest
Overrides:
getRemoteUser in class AbstractHttpServletRequestWrapper

getUserPrincipal

public Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface HttpServletRequest
Overrides:
getUserPrincipal in class AbstractHttpServletRequestWrapper

isUserInRole

public boolean isUserInRole(String role)
Determines whether or not the user is in the given role. The wrapped request is consulted first then the GroupService is used to determine if a group exists for the specified role and if the user is a member of it.

Specified by:
isUserInRole in interface HttpServletRequest
Overrides:
isUserInRole in class AbstractHttpServletRequestWrapper
See Also:
AbstractHttpServletRequestWrapper.isUserInRole(java.lang.String)

getLocale

public Locale getLocale()
Specified by:
getLocale in interface ServletRequest
Overrides:
getLocale in class AbstractHttpServletRequestWrapper

getLocales

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


Copyright © 2010 Jasig. All Rights Reserved.