org.jasig.portal.container.servlet
Class ServletRequestImpl

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.jasig.portal.container.servlet.ServletRequestImpl
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class ServletRequestImpl
extends javax.servlet.http.HttpServletRequestWrapper

A wrapper of the real HttpServletRequest that allows modification of the request parameters and a uPortal implementation of security methods.

uPortal's IPerson and GroupService are used to determine the remote user its role memberships in the case that the container does not know.

Version:
$Revision: 1.14.4.1 $
Author:
Ken Weiner, kweiner@unicon.net

Field Summary
protected  java.util.Hashtable parameters
           
protected  IPerson person
           
protected  org.apache.pluto.om.common.SecurityRoleRefSet securityRoleRefs
           
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
ServletRequestImpl(javax.servlet.http.HttpServletRequest request)
           
ServletRequestImpl(javax.servlet.http.HttpServletRequest request, IPerson person, org.apache.pluto.om.common.SecurityRoleRefSet securityRoleRefs)
           
 
Method Summary
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map getParameterMap()
           
 java.util.Enumeration getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 java.lang.String getRemoteUser()
          Returns the remote user from the real HttpServletRequest if it is available.
 java.security.Principal getUserPrincipal()
          Returns the user principal from the real HttpServletRequest if it is available.
 boolean isUserInRole(java.lang.String role)
          Determines whether or not the user is in the given role.
 void setParameters(java.util.Map parameters)
          Replaces the existing request parameters with a new set of parameters.
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
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 class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, 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, getLocale, getLocales, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Field Detail

parameters

protected java.util.Hashtable parameters

person

protected IPerson person

securityRoleRefs

protected org.apache.pluto.om.common.SecurityRoleRefSet securityRoleRefs
Constructor Detail

ServletRequestImpl

public ServletRequestImpl(javax.servlet.http.HttpServletRequest request)

ServletRequestImpl

public ServletRequestImpl(javax.servlet.http.HttpServletRequest request,
                          IPerson person,
                          org.apache.pluto.om.common.SecurityRoleRefSet securityRoleRefs)
Method Detail

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.servlet.ServletRequest
Overrides:
getParameter in class javax.servlet.ServletRequestWrapper

getParameterMap

public java.util.Map getParameterMap()
Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Overrides:
getParameterMap in class javax.servlet.ServletRequestWrapper

getParameterNames

public java.util.Enumeration getParameterNames()
Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Overrides:
getParameterNames in class javax.servlet.ServletRequestWrapper

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper

setParameters

public void setParameters(java.util.Map parameters)
Replaces the existing request parameters with a new set of parameters.

Parameters:
parameters - the new parameters

getRemoteUser

public java.lang.String getRemoteUser()
Returns the remote user from the real HttpServletRequest if it is available. If it is not available, the username of the user will be returned provided that the user is authenticated. If not authenticated, then null will be returned.

Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest
Overrides:
getRemoteUser in class javax.servlet.http.HttpServletRequestWrapper
Returns:
the name of the remote user or null

getUserPrincipal

public java.security.Principal getUserPrincipal()
Returns the user principal from the real HttpServletRequest if it is available. If it is not available, the principal representing the user will be returned provided that the user is authenticated. If not authenticated, then null will be returned.

Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest
Overrides:
getUserPrincipal in class javax.servlet.http.HttpServletRequestWrapper
Returns:
the user principal or null

isUserInRole

public boolean isUserInRole(java.lang.String role)
Determines whether or not the user is in the given role. The uPortal GroupService shall be used to represent the given role as a uPortal IGroupMember. Therefore, the role must be in the form of a uPortal group key such as local.0 or pags.students.

Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest
Overrides:
isUserInRole in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
role - the role of the user
Returns:
true is the user is in the given role, otherwise false