org.apache.jetspeed.request
Class PortalRequest

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.apache.jetspeed.request.PortalRequest
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class PortalRequest
extends javax.servlet.http.HttpServletRequestWrapper

PortalRequest wraps the original request to the portal and keeps local references to properties like contextPath, servletPath and the Session when its created.

Some web servers like WebSphere don't store these properties inside the request but derive them dynamically based on the web application context in which they are invoked.

For cross-context invoked portlet applications, getting access to the portal contextPath using requestContext.getRequest().getContextPath() this clearly is a problem. Also, access to the Portal Session is not possible this way.

The requestContext.request is actually wrapped by this class which solves the problem by storing a reference to the actual properties at the time of creation and returning

Version:
$Id$
Author:
Ate Douma

Field Summary
private  String contextPath
           
private  String servletPath
           
private  javax.servlet.http.HttpSession session
           
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
PortalRequest(javax.servlet.http.HttpServletRequest request)
           
 
Method Summary
 String getContextPath()
           
 String getServletPath()
           
 javax.servlet.http.HttpSession getSession()
           
 javax.servlet.http.HttpSession getSession(boolean create)
           
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, 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, getParameter, getParameterMap, getParameterNames, getParameterValues, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Field Detail

contextPath

private final String contextPath

servletPath

private final String servletPath

session

private final javax.servlet.http.HttpSession session
Constructor Detail

PortalRequest

public PortalRequest(javax.servlet.http.HttpServletRequest request)
Method Detail

getContextPath

public String getContextPath()
Specified by:
getContextPath in interface javax.servlet.http.HttpServletRequest
Overrides:
getContextPath in class javax.servlet.http.HttpServletRequestWrapper

getServletPath

public String getServletPath()
Specified by:
getServletPath in interface javax.servlet.http.HttpServletRequest
Overrides:
getServletPath in class javax.servlet.http.HttpServletRequestWrapper

getSession

public javax.servlet.http.HttpSession getSession()
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Overrides:
getSession in class javax.servlet.http.HttpServletRequestWrapper

getSession

public javax.servlet.http.HttpSession getSession(boolean create)
Specified by:
getSession in interface javax.servlet.http.HttpServletRequest
Overrides:
getSession in class javax.servlet.http.HttpServletRequestWrapper


Copyright © 1999-2007 Apache Software Foundation. All Rights Reserved.