javax.portlet.filter
Class PortletRequestWrapper

java.lang.Object
  extended by javax.portlet.filter.PortletRequestWrapper
All Implemented Interfaces
PortletRequest
Direct Known Subclasses:
ActionRequestWrapper, EventRequestWrapper, RenderRequestWrapper, ResourceRequestWrapper

public class PortletRequestWrapper
extends Object
implements PortletRequest

The PortletRequestWrapper provides a convenient implementation of the PortletRequest interface and is extended by other request wrappers. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.

Since:
2.0
See Also
PortletRequest

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.portlet.PortletRequest
PortletRequest.P3PUserInfos
 
Field Summary
 
Fields inherited from interface javax.portlet.PortletRequest
ACTION_PHASE, ACTION_SCOPE_ID, BASIC_AUTH, CCPP_PROFILE, CLIENT_CERT_AUTH, DIGEST_AUTH, EVENT_PHASE, FORM_AUTH, LIFECYCLE_PHASE, RENDER_HEADERS, RENDER_MARKUP, RENDER_PART, RENDER_PHASE, RESOURCE_PHASE, USER_INFO
 
Constructor Summary
PortletRequestWrapper(PortletRequest request)
          Creates an PortletRequest adaptor wrapping the given request object.
 
Method Summary
 Object getAttribute(String name)
          The default behavior of this method is to call getAttribute(String name) on the wrapped request object.
 Enumeration<String> getAttributeNames()
          The default behavior of this method is to call getAttributeNames() on the wrapped request object.
 String getAuthType()
          The default behavior of this method is to call getAuthType() on the wrapped request object.
 String getContextPath()
          The default behavior of this method is to call getContextPath() on the wrapped request object.
 javax.servlet.http.Cookie[] getCookies()
          The default behavior of this method is to call getCookies() on the wrapped request object.
 Locale getLocale()
          The default behavior of this method is to call getLocale() on the wrapped request object.
 Enumeration<Locale> getLocales()
          The default behavior of this method is to call getLocales() on the wrapped request object.
 String getParameter(String name)
          The default behavior of this method is to call getParameter(String name) on the wrapped request object.
 Map<String,String[]> getParameterMap()
          The default behavior of this method is to call getParameterMap() on the wrapped request object.
 Enumeration<String> getParameterNames()
          The default behavior of this method is to call getParameterNames() on the wrapped request object.
 String[] getParameterValues(String name)
          The default behavior of this method is to call getParameterValues(name) on the wrapped request object.
 PortalContext getPortalContext()
          The default behavior of this method is to call getPortalContext() on the wrapped request object.
 PortletMode getPortletMode()
          The default behavior of this method is to call getPortletMode() on the wrapped request object.
 PortletSession getPortletSession()
          The default behavior of this method is to call getPortletSession() on the wrapped request object.
 PortletSession getPortletSession(boolean create)
          The default behavior of this method is to call getPortletSession(create) on the wrapped request object.
 PortletPreferences getPreferences()
          The default behavior of this method is to call getPreferences() on the wrapped request object.
 Map<String,String[]> getPrivateParameterMap()
          The default behavior of this method is to call getPrivateParameterMap() on the wrapped request object.
 Enumeration<String> getProperties(String name)
          The default behavior of this method is to call getProperteis(name) on the wrapped request object.
 String getProperty(String name)
          The default behavior of this method is to call getProperty(name) on the wrapped request object.
 Enumeration<String> getPropertyNames()
          The default behavior of this method is to call getPropertyNames() on the wrapped request object.
 Map<String,String[]> getPublicParameterMap()
          The default behavior of this method is to call getPublicParameterMap() on the wrapped request object.
 String getRemoteUser()
          The default behavior of this method is to call getRemoteUser() on the wrapped request object.
 PortletRequest getRequest()
          Return the wrapped request object.
 String getRequestedSessionId()
          The default behavior of this method is to call getRequestedSessionId() on the wrapped request object.
 String getResponseContentType()
          The default behavior of this method is to call getResponseContentType() on the wrapped request object.
 Enumeration<String> getResponseContentTypes()
          The default behavior of this method is to call getResponseContentTypes() on the wrapped request object.
 String getScheme()
          The default behavior of this method is to call getScheme() on the wrapped request object.
 String getServerName()
          The default behavior of this method is to call getServerName() on the wrapped request object.
 int getServerPort()
          The default behavior of this method is to call getServerPort() on the wrapped request object.
 Principal getUserPrincipal()
          The default behavior of this method is to call getUserPrincipal() on the wrapped request object.
 String getWindowID()
          The default behavior of this method is to call getWindowId() on the wrapped request object.
 WindowState getWindowState()
          The default behavior of this method is to call getWindowState() on the wrapped request object.
 boolean isPortletModeAllowed(PortletMode mode)
          The default behavior of this method is to call isPortletModeAllowed(mode) on the wrapped request object.
 boolean isRequestedSessionIdValid()
          The default behavior of this method is to call isRequestedSessionIdValid() on the wrapped request object.
 boolean isSecure()
          The default behavior of this method is to call isSecure() on the wrapped request object.
 boolean isUserInRole(String role)
          The default behavior of this method is to call isUserInRole(role) on the wrapped request object.
 boolean isWindowStateAllowed(WindowState state)
          The default behavior of this method is to call isWindowStateAllowed(state) on the wrapped request object.
 void removeAttribute(String name)
          The default behavior of this method is to call removeAttribute(name) on the wrapped request object.
 void setAttribute(String name, Object o)
          The default behavior of this method is to call setAttribute(name, o) on the wrapped request object.
 void setRequest(PortletRequest request)
          Sets the request object being wrapped.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletRequestWrapper

public PortletRequestWrapper(PortletRequest request)
Creates an PortletRequest adaptor wrapping the given request object.

Parameters
request - the portlet request to wrap
Throws
IllegalArgumentException - if the request is null
Method Detail

getAttribute

public Object getAttribute(String name)
The default behavior of this method is to call getAttribute(String name) on the wrapped request object.

Specified by:
getAttribute in interface PortletRequest
Parameters
name - a String specifying the name of the attribute
Returns
an Object containing the value of the attribute, or null if the attribute does not exist.

getAttributeNames

public Enumeration<String> getAttributeNames()
The default behavior of this method is to call getAttributeNames() on the wrapped request object.

Specified by:
getAttributeNames in interface PortletRequest
Returns
an Enumeration of strings containing the names of the request attributes, or an empty Enumeration if the request has no attributes available to it.

getAuthType

public String getAuthType()
The default behavior of this method is to call getAuthType() on the wrapped request object.

Specified by:
getAuthType in interface PortletRequest
Returns
one of the static members BASIC_AUTH, FORM_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH (suitable for == comparison) indicating the authentication scheme, a custom one, or null if the request was not authenticated.

getContextPath

public String getContextPath()
The default behavior of this method is to call getContextPath() on the wrapped request object.

Specified by:
getContextPath in interface PortletRequest
Returns
a String specifying the portion of the request URL that indicates the context of the request
See Also
PortletResponse.encodeURL(java.lang.String)

getLocale

public Locale getLocale()
The default behavior of this method is to call getLocale() on the wrapped request object.

Specified by:
getLocale in interface PortletRequest
Returns
the preferred Locale in which the portal will accept content.

getLocales

public Enumeration<Locale> getLocales()
The default behavior of this method is to call getLocales() on the wrapped request object.

Specified by:
getLocales in interface PortletRequest
Returns
an Enumeration of Locales, in decreasing order, in which the portal will accept content for this request

getParameter

public String getParameter(String name)
The default behavior of this method is to call getParameter(String name) on the wrapped request object.

Specified by:
getParameter in interface PortletRequest
Parameters
name - a String specifying the name of the parameter
Returns
a String representing the single value of the parameter
See Also
PortletRequest.getParameterValues(java.lang.String)

getParameterMap

public Map<String,String[]> getParameterMap()
The default behavior of this method is to call getParameterMap() on the wrapped request object.

Specified by:
getParameterMap in interface PortletRequest
Returns
an immutable Map containing parameter names as keys and parameter values as map values, or an empty Map if no parameters exist. The keys in the parameter map are of type String. The values in the parameter map are of type String array (String[]).

getParameterNames

public Enumeration<String> getParameterNames()
The default behavior of this method is to call getParameterNames() on the wrapped request object.

Specified by:
getParameterNames in interface PortletRequest
Returns
an Enumeration of String objects, each String containing the name of a request parameter; or an empty Enumeration if the request has no parameters.

getParameterValues

public String[] getParameterValues(String name)
The default behavior of this method is to call getParameterValues(name) on the wrapped request object.

Specified by:
getParameterValues in interface PortletRequest
Parameters
name - a String containing the name of the parameter the value of which is requested
Returns
an array of String objects containing the parameter values.
See Also
PortletRequest.getParameter(java.lang.String)

getPortalContext

public PortalContext getPortalContext()
The default behavior of this method is to call getPortalContext() on the wrapped request object.

Specified by:
getPortalContext in interface PortletRequest
Returns
the context of the calling portal

getPortletMode

public PortletMode getPortletMode()
The default behavior of this method is to call getPortletMode() on the wrapped request object.

Specified by:
getPortletMode in interface PortletRequest
Returns
the portlet mode

getPortletSession

public PortletSession getPortletSession()
The default behavior of this method is to call getPortletSession() on the wrapped request object.

Specified by:
getPortletSession in interface PortletRequest
Returns
the portlet session

getPortletSession

public PortletSession getPortletSession(boolean create)
The default behavior of this method is to call getPortletSession(create) on the wrapped request object.

Specified by:
getPortletSession in interface PortletRequest
Parameters
create - true to create a new session,
false to return null if there is no current session
Returns
the portlet session

getPreferences

public PortletPreferences getPreferences()
The default behavior of this method is to call getPreferences() on the wrapped request object.

Specified by:
getPreferences in interface PortletRequest
Returns
the portlet preferences

getProperties

public Enumeration<String> getProperties(String name)
The default behavior of this method is to call getProperteis(name) on the wrapped request object.

Specified by:
getProperties in interface PortletRequest
Parameters
name - a String specifying the property name
Returns
a Enumeration containing the values of the requested property. If the request does not have any properties of that name return an empty Enumeration.

getProperty

public String getProperty(String name)
The default behavior of this method is to call getProperty(name) on the wrapped request object.

Specified by:
getProperty in interface PortletRequest
Parameters
name - a String specifying the property name
Returns
a String containing the value of the requested property, or null if the request does not have a property of that name.

getPropertyNames

public Enumeration<String> getPropertyNames()
The default behavior of this method is to call getPropertyNames() on the wrapped request object.

Specified by:
getPropertyNames in interface PortletRequest
Returns
an Enumeration of all the property names sent with this request; if the request has no properties, an empty Enumeration.

getRemoteUser

public String getRemoteUser()
The default behavior of this method is to call getRemoteUser() on the wrapped request object.

Specified by:
getRemoteUser in interface PortletRequest
Returns
a String specifying the login of the user making this request, or null if the user login is not known.

getRequestedSessionId

public String getRequestedSessionId()
The default behavior of this method is to call getRequestedSessionId() on the wrapped request object.

Specified by:
getRequestedSessionId in interface PortletRequest
Returns
a String specifying the session ID, or null if the request did not specify a session ID
See Also
PortletRequest.isRequestedSessionIdValid()

getResponseContentType

public String getResponseContentType()
The default behavior of this method is to call getResponseContentType() on the wrapped request object.

Specified by:
getResponseContentType in interface PortletRequest
Returns
preferred MIME type of the response

getResponseContentTypes

public Enumeration<String> getResponseContentTypes()
The default behavior of this method is to call getResponseContentTypes() on the wrapped request object.

Specified by:
getResponseContentTypes in interface PortletRequest
Returns
ordered list of MIME types for the response

getScheme

public String getScheme()
The default behavior of this method is to call getScheme() on the wrapped request object.

Specified by:
getScheme in interface PortletRequest
Returns
a String containing the name of the scheme used to make this request

getServerName

public String getServerName()
The default behavior of this method is to call getServerName() on the wrapped request object.

Specified by:
getServerName in interface PortletRequest
Returns
a String containing the name of the server to which the request was sent

getServerPort

public int getServerPort()
The default behavior of this method is to call getServerPort() on the wrapped request object.

Specified by:
getServerPort in interface PortletRequest
Returns
an integer specifying the port number

getUserPrincipal

public Principal getUserPrincipal()
The default behavior of this method is to call getUserPrincipal() on the wrapped request object.

Specified by:
getUserPrincipal in interface PortletRequest
Returns
a java.security.Principal containing the name of the user making this request, or null if the user has not been authenticated.

getWindowID

public String getWindowID()
The default behavior of this method is to call getWindowId() on the wrapped request object.

Specified by:
getWindowID in interface PortletRequest
Returns
the portlet window ID

getWindowState

public WindowState getWindowState()
The default behavior of this method is to call getWindowState() on the wrapped request object.

Specified by:
getWindowState in interface PortletRequest
Returns
the window state

isPortletModeAllowed

public boolean isPortletModeAllowed(PortletMode mode)
The default behavior of this method is to call isPortletModeAllowed(mode) on the wrapped request object.

Specified by:
isPortletModeAllowed in interface PortletRequest
Parameters
mode - portlet mode to check
Returns
true, if it is valid for this portlet in this request to change to the given portlet mode

isRequestedSessionIdValid

public boolean isRequestedSessionIdValid()
The default behavior of this method is to call isRequestedSessionIdValid() on the wrapped request object.

Specified by:
isRequestedSessionIdValid in interface PortletRequest
Returns
true if this request has an id for a valid session in the current session context; false otherwise
See Also
PortletRequest.getRequestedSessionId(), PortletRequest.getPortletSession()

isSecure

public boolean isSecure()
The default behavior of this method is to call isSecure() on the wrapped request object.

Specified by:
isSecure in interface PortletRequest
Returns
true, if the request was made using a secure channel.

isUserInRole

public boolean isUserInRole(String role)
The default behavior of this method is to call isUserInRole(role) on the wrapped request object.

Specified by:
isUserInRole in interface PortletRequest
Parameters
role - a String specifying the name of the role
Returns
a boolean indicating whether the user making this request belongs to a given role; false if the user has not been authenticated.

isWindowStateAllowed

public boolean isWindowStateAllowed(WindowState state)
The default behavior of this method is to call isWindowStateAllowed(state) on the wrapped request object.

Specified by:
isWindowStateAllowed in interface PortletRequest
Parameters
state - window state to checked
Returns
true, if it is valid for this portlet in this request to change to the given window state

removeAttribute

public void removeAttribute(String name)
The default behavior of this method is to call removeAttribute(name) on the wrapped request object.

Specified by:
removeAttribute in interface PortletRequest
Parameters
name - a String specifying the name of the attribute to be removed

setAttribute

public void setAttribute(String name,
                         Object o)
The default behavior of this method is to call setAttribute(name, o) on the wrapped request object.

Specified by:
setAttribute in interface PortletRequest
Parameters
name - a String specifying the name of the attribute
o - the Object to be stored

getRequest

public PortletRequest getRequest()
Return the wrapped request object.

Returns
the wrapped request

setRequest

public void setRequest(PortletRequest request)
Sets the request object being wrapped.

Parameters
request - the request to set
Throws
IllegalArgumentException - if the request is null.

getCookies

public javax.servlet.http.Cookie[] getCookies()
The default behavior of this method is to call getCookies() on the wrapped request object.

Specified by:
getCookies in interface PortletRequest
Returns
array of cookie properties, or null if no cookies exist.
See Also
PortletResponse.addProperty(Cookie)

getPrivateParameterMap

public Map<String,String[]> getPrivateParameterMap()
The default behavior of this method is to call getPrivateParameterMap() on the wrapped request object.

Specified by:
getPrivateParameterMap in interface PortletRequest
Returns
an immutable Map containing private parameter names as keys and private parameter values as map values, or an empty Map if no private parameters exist. The keys in the parameter map are of type String. The values in the parameter map are of type String array (String[]).

getPublicParameterMap

public Map<String,String[]> getPublicParameterMap()
The default behavior of this method is to call getPublicParameterMap() on the wrapped request object.

Specified by:
getPublicParameterMap in interface PortletRequest
Returns
an immutable Map containing public parameter names as keys and public parameter values as map values, or an empty Map if no public parameters exist. The keys in the parameter map are of type String. The values in the parameter map are of type String array (String[]).


Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.