Package javax.portlet.filter
Class PortletRequestWrapper
- java.lang.Object
-
- javax.portlet.filter.PortletRequestWrapper
-
- All Implemented Interfaces:
PortletRequest
- Direct Known Subclasses:
ActionRequestWrapper
,EventRequestWrapper
,RenderRequestWrapper
,ResourceRequestWrapper
public class PortletRequestWrapper extends java.lang.Object implements PortletRequest
ThePortletRequestWrapper
provides a convenient implementation of thePortletRequest
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 Modifier and Type Field Description (package private) PortletRequest
request
-
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
Constructors Modifier Constructor Description private
PortletRequestWrapper()
Require having a request for constructing the wrapper.PortletRequestWrapper(PortletRequest request)
Creates anPortletRequest
adaptor wrapping the given request object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
getAttribute(java.lang.String name)
The default behavior of this method is to callgetAttribute(String name)
on the wrapped request object.java.util.Enumeration<java.lang.String>
getAttributeNames()
The default behavior of this method is to callgetAttributeNames()
on the wrapped request object.java.lang.String
getAuthType()
The default behavior of this method is to callgetAuthType()
on the wrapped request object.java.lang.String
getContextPath()
The default behavior of this method is to callgetContextPath()
on the wrapped request object.javax.servlet.http.Cookie[]
getCookies()
The default behavior of this method is to callgetCookies()
on the wrapped request object.java.util.Locale
getLocale()
The default behavior of this method is to callgetLocale()
on the wrapped request object.java.util.Enumeration<java.util.Locale>
getLocales()
The default behavior of this method is to callgetLocales()
on the wrapped request object.java.lang.String
getParameter(java.lang.String name)
The default behavior of this method is to callgetParameter(String name)
on the wrapped request object.java.util.Map<java.lang.String,java.lang.String[]>
getParameterMap()
The default behavior of this method is to callgetParameterMap()
on the wrapped request object.java.util.Enumeration<java.lang.String>
getParameterNames()
The default behavior of this method is to callgetParameterNames()
on the wrapped request object.java.lang.String[]
getParameterValues(java.lang.String name)
The default behavior of this method is to callgetParameterValues(name)
on the wrapped request object.PortalContext
getPortalContext()
The default behavior of this method is to callgetPortalContext()
on the wrapped request object.PortletMode
getPortletMode()
The default behavior of this method is to callgetPortletMode()
on the wrapped request object.PortletSession
getPortletSession()
The default behavior of this method is to callgetPortletSession()
on the wrapped request object.PortletSession
getPortletSession(boolean create)
The default behavior of this method is to callgetPortletSession(create)
on the wrapped request object.PortletPreferences
getPreferences()
The default behavior of this method is to callgetPreferences()
on the wrapped request object.java.util.Map<java.lang.String,java.lang.String[]>
getPrivateParameterMap()
The default behavior of this method is to callgetPrivateParameterMap()
on the wrapped request object.java.util.Enumeration<java.lang.String>
getProperties(java.lang.String name)
The default behavior of this method is to callgetProperteis(name)
on the wrapped request object.java.lang.String
getProperty(java.lang.String name)
The default behavior of this method is to callgetProperty(name)
on the wrapped request object.java.util.Enumeration<java.lang.String>
getPropertyNames()
The default behavior of this method is to callgetPropertyNames()
on the wrapped request object.java.util.Map<java.lang.String,java.lang.String[]>
getPublicParameterMap()
The default behavior of this method is to callgetPublicParameterMap()
on the wrapped request object.java.lang.String
getRemoteUser()
The default behavior of this method is to callgetRemoteUser()
on the wrapped request object.PortletRequest
getRequest()
Return the wrapped request object.java.lang.String
getRequestedSessionId()
The default behavior of this method is to callgetRequestedSessionId()
on the wrapped request object.java.lang.String
getResponseContentType()
The default behavior of this method is to callgetResponseContentType()
on the wrapped request object.java.util.Enumeration<java.lang.String>
getResponseContentTypes()
The default behavior of this method is to callgetResponseContentTypes()
on the wrapped request object.java.lang.String
getScheme()
The default behavior of this method is to callgetScheme()
on the wrapped request object.java.lang.String
getServerName()
The default behavior of this method is to callgetServerName()
on the wrapped request object.int
getServerPort()
The default behavior of this method is to callgetServerPort()
on the wrapped request object.java.security.Principal
getUserPrincipal()
The default behavior of this method is to callgetUserPrincipal()
on the wrapped request object.java.lang.String
getWindowID()
The default behavior of this method is to callgetWindowId()
on the wrapped request object.WindowState
getWindowState()
The default behavior of this method is to callgetWindowState()
on the wrapped request object.boolean
isPortletModeAllowed(PortletMode mode)
The default behavior of this method is to callisPortletModeAllowed(mode)
on the wrapped request object.boolean
isRequestedSessionIdValid()
The default behavior of this method is to callisRequestedSessionIdValid()
on the wrapped request object.boolean
isSecure()
The default behavior of this method is to callisSecure()
on the wrapped request object.boolean
isUserInRole(java.lang.String role)
The default behavior of this method is to callisUserInRole(role)
on the wrapped request object.boolean
isWindowStateAllowed(WindowState state)
The default behavior of this method is to callisWindowStateAllowed(state)
on the wrapped request object.void
removeAttribute(java.lang.String name)
The default behavior of this method is to callremoveAttribute(name)
on the wrapped request object.void
setAttribute(java.lang.String name, java.lang.Object o)
The default behavior of this method is to callsetAttribute(name, o)
on the wrapped request object.void
setRequest(PortletRequest request)
Sets the request object being wrapped.
-
-
-
Field Detail
-
request
PortletRequest request
-
-
Constructor Detail
-
PortletRequestWrapper
private PortletRequestWrapper()
Require having a request for constructing the wrapper.
-
PortletRequestWrapper
public PortletRequestWrapper(PortletRequest request)
Creates anPortletRequest
adaptor wrapping the given request object.- Parameters:
request
- the portlet request to wrap- Throws:
java.lang.IllegalArgumentException
- if the request isnull
-
-
Method Detail
-
getAttribute
public java.lang.Object getAttribute(java.lang.String name)
The default behavior of this method is to callgetAttribute(String name)
on the wrapped request object.- Specified by:
getAttribute
in interfacePortletRequest
- Parameters:
name
- aString
specifying the name of the attribute- Returns:
- an
Object
containing the value of the attribute, ornull
if the attribute does not exist.
-
getAttributeNames
public java.util.Enumeration<java.lang.String> getAttributeNames()
The default behavior of this method is to callgetAttributeNames()
on the wrapped request object.- Specified by:
getAttributeNames
in interfacePortletRequest
- Returns:
- an
Enumeration
of strings containing the names of the request attributes, or an emptyEnumeration
if the request has no attributes available to it.
-
getAuthType
public java.lang.String getAuthType()
The default behavior of this method is to callgetAuthType()
on the wrapped request object.- Specified by:
getAuthType
in interfacePortletRequest
- 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, ornull
if the request was not authenticated.
-
getContextPath
public java.lang.String getContextPath()
The default behavior of this method is to callgetContextPath()
on the wrapped request object.- Specified by:
getContextPath
in interfacePortletRequest
- 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 java.util.Locale getLocale()
The default behavior of this method is to callgetLocale()
on the wrapped request object.- Specified by:
getLocale
in interfacePortletRequest
- Returns:
- the preferred Locale in which the portal will accept content.
-
getLocales
public java.util.Enumeration<java.util.Locale> getLocales()
The default behavior of this method is to callgetLocales()
on the wrapped request object.- Specified by:
getLocales
in interfacePortletRequest
- Returns:
- an Enumeration of Locales, in decreasing order, in which the portal will accept content for this request
-
getParameter
public java.lang.String getParameter(java.lang.String name)
The default behavior of this method is to callgetParameter(String name)
on the wrapped request object.- Specified by:
getParameter
in interfacePortletRequest
- Parameters:
name
- aString
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 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
The default behavior of this method is to callgetParameterMap()
on the wrapped request object.- Specified by:
getParameterMap
in interfacePortletRequest
- Returns:
- an immutable
Map
containing parameter names as keys and parameter values as map values, or an emptyMap
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 java.util.Enumeration<java.lang.String> getParameterNames()
The default behavior of this method is to callgetParameterNames()
on the wrapped request object.- Specified by:
getParameterNames
in interfacePortletRequest
- Returns:
- an
Enumeration
ofString
objects, eachString
containing the name of a request parameter; or an emptyEnumeration
if the request has no parameters.
-
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
The default behavior of this method is to callgetParameterValues(name)
on the wrapped request object.- Specified by:
getParameterValues
in interfacePortletRequest
- Parameters:
name
- aString
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 callgetPortalContext()
on the wrapped request object.- Specified by:
getPortalContext
in interfacePortletRequest
- Returns:
- the context of the calling portal
-
getPortletMode
public PortletMode getPortletMode()
The default behavior of this method is to callgetPortletMode()
on the wrapped request object.- Specified by:
getPortletMode
in interfacePortletRequest
- Returns:
- the portlet mode
-
getPortletSession
public PortletSession getPortletSession()
The default behavior of this method is to callgetPortletSession()
on the wrapped request object.- Specified by:
getPortletSession
in interfacePortletRequest
- Returns:
- the portlet session
-
getPortletSession
public PortletSession getPortletSession(boolean create)
The default behavior of this method is to callgetPortletSession(create)
on the wrapped request object.- Specified by:
getPortletSession
in interfacePortletRequest
- Parameters:
create
-true
to create a new session,
false
to returnnull
if there is no current session- Returns:
- the portlet session
-
getPreferences
public PortletPreferences getPreferences()
The default behavior of this method is to callgetPreferences()
on the wrapped request object.- Specified by:
getPreferences
in interfacePortletRequest
- Returns:
- the portlet preferences
-
getProperties
public java.util.Enumeration<java.lang.String> getProperties(java.lang.String name)
The default behavior of this method is to callgetProperteis(name)
on the wrapped request object.- Specified by:
getProperties
in interfacePortletRequest
- Parameters:
name
- aString
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 emptyEnumeration
.
-
getProperty
public java.lang.String getProperty(java.lang.String name)
The default behavior of this method is to callgetProperty(name)
on the wrapped request object.- Specified by:
getProperty
in interfacePortletRequest
- Parameters:
name
- aString
specifying the property name- Returns:
- a
String
containing the value of the requested property, ornull
if the request does not have a property of that name.
-
getPropertyNames
public java.util.Enumeration<java.lang.String> getPropertyNames()
The default behavior of this method is to callgetPropertyNames()
on the wrapped request object.- Specified by:
getPropertyNames
in interfacePortletRequest
- Returns:
- an
Enumeration
of all the property names sent with this request; if the request has no properties, an emptyEnumeration
.
-
getRemoteUser
public java.lang.String getRemoteUser()
The default behavior of this method is to callgetRemoteUser()
on the wrapped request object.- Specified by:
getRemoteUser
in interfacePortletRequest
- Returns:
- a
String
specifying the login of the user making this request, ornull
if the user login is not known.
-
getRequestedSessionId
public java.lang.String getRequestedSessionId()
The default behavior of this method is to callgetRequestedSessionId()
on the wrapped request object.- Specified by:
getRequestedSessionId
in interfacePortletRequest
- Returns:
- a
String
specifying the session ID, ornull
if the request did not specify a session ID - See Also:
PortletRequest.isRequestedSessionIdValid()
-
getResponseContentType
public java.lang.String getResponseContentType()
The default behavior of this method is to callgetResponseContentType()
on the wrapped request object.- Specified by:
getResponseContentType
in interfacePortletRequest
- Returns:
- preferred MIME type of the response
-
getResponseContentTypes
public java.util.Enumeration<java.lang.String> getResponseContentTypes()
The default behavior of this method is to callgetResponseContentTypes()
on the wrapped request object.- Specified by:
getResponseContentTypes
in interfacePortletRequest
- Returns:
- ordered list of MIME types for the response
-
getScheme
public java.lang.String getScheme()
The default behavior of this method is to callgetScheme()
on the wrapped request object.- Specified by:
getScheme
in interfacePortletRequest
- Returns:
- a
String
containing the name of the scheme used to make this request
-
getServerName
public java.lang.String getServerName()
The default behavior of this method is to callgetServerName()
on the wrapped request object.- Specified by:
getServerName
in interfacePortletRequest
- 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 callgetServerPort()
on the wrapped request object.- Specified by:
getServerPort
in interfacePortletRequest
- Returns:
- an integer specifying the port number
-
getUserPrincipal
public java.security.Principal getUserPrincipal()
The default behavior of this method is to callgetUserPrincipal()
on the wrapped request object.- Specified by:
getUserPrincipal
in interfacePortletRequest
- Returns:
- a
java.security.Principal
containing the name of the user making this request, ornull
if the user has not been authenticated.
-
getWindowID
public java.lang.String getWindowID()
The default behavior of this method is to callgetWindowId()
on the wrapped request object.- Specified by:
getWindowID
in interfacePortletRequest
- Returns:
- the portlet window ID
-
getWindowState
public WindowState getWindowState()
The default behavior of this method is to callgetWindowState()
on the wrapped request object.- Specified by:
getWindowState
in interfacePortletRequest
- Returns:
- the window state
-
isPortletModeAllowed
public boolean isPortletModeAllowed(PortletMode mode)
The default behavior of this method is to callisPortletModeAllowed(mode)
on the wrapped request object.- Specified by:
isPortletModeAllowed
in interfacePortletRequest
- 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 callisRequestedSessionIdValid()
on the wrapped request object.- Specified by:
isRequestedSessionIdValid
in interfacePortletRequest
- 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 callisSecure()
on the wrapped request object.- Specified by:
isSecure
in interfacePortletRequest
- Returns:
- true, if the request was made using a secure channel.
-
isUserInRole
public boolean isUserInRole(java.lang.String role)
The default behavior of this method is to callisUserInRole(role)
on the wrapped request object.- Specified by:
isUserInRole
in interfacePortletRequest
- Parameters:
role
- aString
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 callisWindowStateAllowed(state)
on the wrapped request object.- Specified by:
isWindowStateAllowed
in interfacePortletRequest
- 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(java.lang.String name)
The default behavior of this method is to callremoveAttribute(name)
on the wrapped request object.- Specified by:
removeAttribute
in interfacePortletRequest
- Parameters:
name
- aString
specifying the name of the attribute to be removed
-
setAttribute
public void setAttribute(java.lang.String name, java.lang.Object o)
The default behavior of this method is to callsetAttribute(name, o)
on the wrapped request object.- Specified by:
setAttribute
in interfacePortletRequest
- Parameters:
name
- aString
specifying the name of the attributeo
- theObject
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:
java.lang.IllegalArgumentException
- if the request is null.
-
getCookies
public javax.servlet.http.Cookie[] getCookies()
The default behavior of this method is to callgetCookies()
on the wrapped request object.- Specified by:
getCookies
in interfacePortletRequest
- Returns:
- array of cookie properties, or
null
if no cookies exist. - See Also:
PortletResponse.addProperty(Cookie)
-
getPrivateParameterMap
public java.util.Map<java.lang.String,java.lang.String[]> getPrivateParameterMap()
The default behavior of this method is to callgetPrivateParameterMap()
on the wrapped request object.- Specified by:
getPrivateParameterMap
in interfacePortletRequest
- Returns:
- an immutable
Map
containing private parameter names as keys and private parameter values as map values, or an emptyMap
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 java.util.Map<java.lang.String,java.lang.String[]> getPublicParameterMap()
The default behavior of this method is to callgetPublicParameterMap()
on the wrapped request object.- Specified by:
getPublicParameterMap
in interfacePortletRequest
- Returns:
- an immutable
Map
containing public parameter names as keys and public parameter values as map values, or an emptyMap
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[]
).
-
-