org.apache.pluto.internal.impl
Class PortletRequestImpl

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.apache.pluto.internal.impl.PortletRequestImpl
All Implemented Interfaces:
javax.portlet.PortletRequest, javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest, InternalPortletRequest
Direct Known Subclasses:
ActionRequestImpl, RenderRequestImpl

public abstract class PortletRequestImpl
extends javax.servlet.http.HttpServletRequestWrapper
implements javax.portlet.PortletRequest, InternalPortletRequest

Abstract javax.portlet.PortletRequest implementation. This class also implements InternalPortletRequest.


Field Summary
 
Fields inherited from interface javax.portlet.PortletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH, USER_INFO
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
PortletRequestImpl(InternalPortletRequest internalPortletRequest)
           
PortletRequestImpl(PortletContainer container, InternalPortletWindow internalPortletWindow, javax.servlet.http.HttpServletRequest servletRequest)
          Creates a PortletRequestImpl instance.
 
Method Summary
protected  java.util.Map baseGetParameterMap()
          The base method that returns the parameter map in this portlet request.
 java.lang.Object getAttribute(java.lang.String name)
           
 java.util.Enumeration getAttributeNames()
           
 java.lang.String getAuthType()
           
 java.lang.String getContextPath()
           
 javax.servlet.http.HttpServletRequest getHttpServletRequest()
           
 javax.servlet.ServletInputStream getInputStream()
           
 InternalPortletWindow getInternalPortletWindow()
           
 java.util.Locale getLocale()
           
 java.util.Enumeration getLocales()
           
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map getParameterMap()
           
 java.util.Enumeration getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
 javax.portlet.PortalContext getPortalContext()
           
 PortletContainer getPortletContainer()
           
 javax.portlet.PortletMode getPortletMode()
           
 javax.portlet.PortletSession getPortletSession()
           
 javax.portlet.PortletSession getPortletSession(boolean create)
          Returns the portlet session.
 java.util.Enumeration getProperties(java.lang.String name)
           
 java.lang.String getProperty(java.lang.String name)
           
 java.util.Enumeration getPropertyNames()
           
 java.io.BufferedReader getReader()
           
 java.lang.String getRemoteUser()
           
 javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
           
 java.lang.String getRequestedSessionId()
           
 java.lang.String getResponseContentType()
           
 java.util.Enumeration getResponseContentTypes()
           
 java.lang.String getScheme()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.security.Principal getUserPrincipal()
           
 javax.portlet.WindowState getWindowState()
           
 void init(javax.portlet.PortletContext portletContext, javax.servlet.http.HttpServletRequest req)
          Initializes the portlet request for use within the target context.
 boolean isPortletModeAllowed(javax.portlet.PortletMode mode)
           
 boolean isRequestedSessionIdValid()
           
 boolean isSecure()
           
 boolean isUserInRole(java.lang.String roleName)
          Determines whether a user is mapped to the specified role.
 boolean isWindowStateAllowed(javax.portlet.WindowState state)
          Determine whether or not the specified WindowState is allowed for this portlet.
 void release()
          TODO: Implement this properly.
 void removeAttribute(java.lang.String name)
           
 void setAttribute(java.lang.String name, java.lang.Object value)
           
protected  void setBodyAccessed()
           
 void setCharacterEncoding(java.lang.String encoding)
          TODO: why check bodyAccessed?
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getCharacterEncoding, getContentLength, getContentType, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRequest, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.portlet.PortletRequest
getPreferences
 
Methods inherited from interface javax.servlet.ServletRequest
getCharacterEncoding, getContentLength, getContentType, getProtocol, getRealPath, getRemoteAddr, getRemoteHost
 

Constructor Detail

PortletRequestImpl

public PortletRequestImpl(InternalPortletRequest internalPortletRequest)

PortletRequestImpl

public PortletRequestImpl(PortletContainer container,
                          InternalPortletWindow internalPortletWindow,
                          javax.servlet.http.HttpServletRequest servletRequest)
Creates a PortletRequestImpl instance.

Parameters:
container - the portlet container.
internalPortletWindow - the internal portlet window.
servletRequest - the underlying servlet request.
Method Detail

isWindowStateAllowed

public boolean isWindowStateAllowed(javax.portlet.WindowState state)
Determine whether or not the specified WindowState is allowed for this portlet.

Specified by:
isWindowStateAllowed in interface javax.portlet.PortletRequest
Parameters:
state - the state in question
Returns:
true if the state is allowed.

isPortletModeAllowed

public boolean isPortletModeAllowed(javax.portlet.PortletMode mode)
Specified by:
isPortletModeAllowed in interface javax.portlet.PortletRequest

getPortletMode

public javax.portlet.PortletMode getPortletMode()
Specified by:
getPortletMode in interface javax.portlet.PortletRequest

getWindowState

public javax.portlet.WindowState getWindowState()
Specified by:
getWindowState in interface javax.portlet.PortletRequest

getPortletSession

public javax.portlet.PortletSession getPortletSession()
Specified by:
getPortletSession in interface javax.portlet.PortletRequest

getPortletSession

public javax.portlet.PortletSession getPortletSession(boolean create)
Returns the portlet session.

Note that since portlet request instance is created everytime the portlet container receives an incoming request, the portlet session instance held by the request instance is also re-created for each incoming request.

Specified by:
getPortletSession in interface javax.portlet.PortletRequest

getProperty

public java.lang.String getProperty(java.lang.String name)
                             throws java.lang.IllegalArgumentException
Specified by:
getProperty in interface javax.portlet.PortletRequest
Throws:
java.lang.IllegalArgumentException

getProperties

public java.util.Enumeration getProperties(java.lang.String name)
Specified by:
getProperties in interface javax.portlet.PortletRequest

getPropertyNames

public java.util.Enumeration getPropertyNames()
Specified by:
getPropertyNames in interface javax.portlet.PortletRequest

getPortalContext

public javax.portlet.PortalContext getPortalContext()
Specified by:
getPortalContext in interface javax.portlet.PortletRequest

getAuthType

public java.lang.String getAuthType()
Specified by:
getAuthType in interface javax.portlet.PortletRequest
Specified by:
getAuthType in interface javax.servlet.http.HttpServletRequest
Overrides:
getAuthType in class javax.servlet.http.HttpServletRequestWrapper

getContextPath

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

getRemoteUser

public java.lang.String getRemoteUser()
Specified by:
getRemoteUser in interface javax.portlet.PortletRequest
Specified by:
getRemoteUser in interface javax.servlet.http.HttpServletRequest
Overrides:
getRemoteUser in class javax.servlet.http.HttpServletRequestWrapper

getUserPrincipal

public java.security.Principal getUserPrincipal()
Specified by:
getUserPrincipal in interface javax.portlet.PortletRequest
Specified by:
getUserPrincipal in interface javax.servlet.http.HttpServletRequest
Overrides:
getUserPrincipal in class javax.servlet.http.HttpServletRequestWrapper

isUserInRole

public boolean isUserInRole(java.lang.String roleName)
Determines whether a user is mapped to the specified role. As specified in PLT-20-3, we must reference the <security-role-ref> mappings within the deployment descriptor. If no mapping is available, then, and only then, do we check use the actual role name specified against the web application deployment descriptor.

Specified by:
isUserInRole in interface javax.portlet.PortletRequest
Specified by:
isUserInRole in interface javax.servlet.http.HttpServletRequest
Overrides:
isUserInRole in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
roleName - the name of the role
Returns:
true if it is determined the user has the given role.

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Specified by:
getAttribute in interface javax.portlet.PortletRequest
Specified by:
getAttribute in interface javax.servlet.ServletRequest
Overrides:
getAttribute in class javax.servlet.ServletRequestWrapper

getAttributeNames

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

getParameter

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

getParameterNames

public java.util.Enumeration getParameterNames()
Specified by:
getParameterNames in interface javax.portlet.PortletRequest
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.portlet.PortletRequest
Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper

getParameterMap

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

isSecure

public boolean isSecure()
Specified by:
isSecure in interface javax.portlet.PortletRequest
Specified by:
isSecure in interface javax.servlet.ServletRequest
Overrides:
isSecure in class javax.servlet.ServletRequestWrapper

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Specified by:
setAttribute in interface javax.portlet.PortletRequest
Specified by:
setAttribute in interface javax.servlet.ServletRequest
Overrides:
setAttribute in class javax.servlet.ServletRequestWrapper

removeAttribute

public void removeAttribute(java.lang.String name)
Specified by:
removeAttribute in interface javax.portlet.PortletRequest
Specified by:
removeAttribute in interface javax.servlet.ServletRequest
Overrides:
removeAttribute in class javax.servlet.ServletRequestWrapper

getRequestedSessionId

public java.lang.String getRequestedSessionId()
Specified by:
getRequestedSessionId in interface javax.portlet.PortletRequest
Specified by:
getRequestedSessionId in interface javax.servlet.http.HttpServletRequest
Overrides:
getRequestedSessionId in class javax.servlet.http.HttpServletRequestWrapper

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
Specified by:
isRequestedSessionIdValid in interface javax.portlet.PortletRequest
Specified by:
isRequestedSessionIdValid in interface javax.servlet.http.HttpServletRequest
Overrides:
isRequestedSessionIdValid in class javax.servlet.http.HttpServletRequestWrapper

getResponseContentType

public java.lang.String getResponseContentType()
Specified by:
getResponseContentType in interface javax.portlet.PortletRequest

getResponseContentTypes

public java.util.Enumeration getResponseContentTypes()
Specified by:
getResponseContentTypes in interface javax.portlet.PortletRequest

getLocale

public java.util.Locale getLocale()
Specified by:
getLocale in interface javax.portlet.PortletRequest
Specified by:
getLocale in interface javax.servlet.ServletRequest
Overrides:
getLocale in class javax.servlet.ServletRequestWrapper

getLocales

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

getScheme

public java.lang.String getScheme()
Specified by:
getScheme in interface javax.portlet.PortletRequest
Specified by:
getScheme in interface javax.servlet.ServletRequest
Overrides:
getScheme in class javax.servlet.ServletRequestWrapper

getServerName

public java.lang.String getServerName()
Specified by:
getServerName in interface javax.portlet.PortletRequest
Specified by:
getServerName in interface javax.servlet.ServletRequest
Overrides:
getServerName in class javax.servlet.ServletRequestWrapper

getServerPort

public int getServerPort()
Specified by:
getServerPort in interface javax.portlet.PortletRequest
Specified by:
getServerPort in interface javax.servlet.ServletRequest
Overrides:
getServerPort in class javax.servlet.ServletRequestWrapper

baseGetParameterMap

protected java.util.Map baseGetParameterMap()
The base method that returns the parameter map in this portlet request. All parameter-related methods call this base method. Subclasses may just overwrite this protected method to change behavior of all parameter- related methods.

Returns:
the base parameter map from which parameters are retrieved.

setBodyAccessed

protected void setBodyAccessed()

getInternalPortletWindow

public InternalPortletWindow getInternalPortletWindow()
Specified by:
getInternalPortletWindow in interface InternalPortletRequest

getPortletContainer

public PortletContainer getPortletContainer()
Specified by:
getPortletContainer in interface InternalPortletRequest

getHttpServletRequest

public javax.servlet.http.HttpServletRequest getHttpServletRequest()
Specified by:
getHttpServletRequest in interface InternalPortletRequest

init

public void init(javax.portlet.PortletContext portletContext,
                 javax.servlet.http.HttpServletRequest req)
Description copied from interface: InternalPortletRequest
Initializes the portlet request for use within the target context. This method ensures that the portlet utilizes resources from the included context, and not those from the intiating (portal) context.

Specified by:
init in interface InternalPortletRequest
Parameters:
portletContext - the target portlet context.
req - the servlet request.

release

public void release()
TODO: Implement this properly. Not required now

Specified by:
release in interface InternalPortletRequest

getReader

public java.io.BufferedReader getReader()
                                 throws java.io.UnsupportedEncodingException,
                                        java.io.IOException
Specified by:
getReader in interface javax.servlet.ServletRequest
Overrides:
getReader in class javax.servlet.ServletRequestWrapper
Throws:
java.io.UnsupportedEncodingException
java.io.IOException

getInputStream

public javax.servlet.ServletInputStream getInputStream()
                                                throws java.io.IOException
Specified by:
getInputStream in interface javax.servlet.ServletRequest
Overrides:
getInputStream in class javax.servlet.ServletRequestWrapper
Throws:
java.io.IOException

getRequestDispatcher

public javax.servlet.RequestDispatcher getRequestDispatcher(java.lang.String path)
Specified by:
getRequestDispatcher in interface javax.servlet.ServletRequest
Overrides:
getRequestDispatcher in class javax.servlet.ServletRequestWrapper

setCharacterEncoding

public void setCharacterEncoding(java.lang.String encoding)
                          throws java.io.UnsupportedEncodingException
TODO: why check bodyAccessed?

Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Overrides:
setCharacterEncoding in class javax.servlet.ServletRequestWrapper
Throws:
java.io.UnsupportedEncodingException


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.