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
ThePortletRequestWrapperprovides a convenient implementation of thePortletRequestinterface 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
Constructors Constructor Description PortletRequestWrapper(PortletRequest request)Creates anPortletRequestadaptor wrapping the given request object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(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.StringgetAuthType()The default behavior of this method is to callgetAuthType()on the wrapped request object.java.lang.StringgetContextPath()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.LocalegetLocale()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.StringgetParameter(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.PortalContextgetPortalContext()The default behavior of this method is to callgetPortalContext()on the wrapped request object.PortletModegetPortletMode()The default behavior of this method is to callgetPortletMode()on the wrapped request object.PortletSessiongetPortletSession()The default behavior of this method is to callgetPortletSession()on the wrapped request object.PortletSessiongetPortletSession(boolean create)The default behavior of this method is to callgetPortletSession(create)on the wrapped request object.PortletPreferencesgetPreferences()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.StringgetProperty(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.StringgetRemoteUser()The default behavior of this method is to callgetRemoteUser()on the wrapped request object.PortletRequestgetRequest()Return the wrapped request object.java.lang.StringgetRequestedSessionId()The default behavior of this method is to callgetRequestedSessionId()on the wrapped request object.java.lang.StringgetResponseContentType()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.StringgetScheme()The default behavior of this method is to callgetScheme()on the wrapped request object.java.lang.StringgetServerName()The default behavior of this method is to callgetServerName()on the wrapped request object.intgetServerPort()The default behavior of this method is to callgetServerPort()on the wrapped request object.java.security.PrincipalgetUserPrincipal()The default behavior of this method is to callgetUserPrincipal()on the wrapped request object.java.lang.StringgetWindowID()The default behavior of this method is to callgetWindowId()on the wrapped request object.WindowStategetWindowState()The default behavior of this method is to callgetWindowState()on the wrapped request object.booleanisPortletModeAllowed(PortletMode mode)The default behavior of this method is to callisPortletModeAllowed(mode)on the wrapped request object.booleanisRequestedSessionIdValid()The default behavior of this method is to callisRequestedSessionIdValid()on the wrapped request object.booleanisSecure()The default behavior of this method is to callisSecure()on the wrapped request object.booleanisUserInRole(java.lang.String role)The default behavior of this method is to callisUserInRole(role)on the wrapped request object.booleanisWindowStateAllowed(WindowState state)The default behavior of this method is to callisWindowStateAllowed(state)on the wrapped request object.voidremoveAttribute(java.lang.String name)The default behavior of this method is to callremoveAttribute(name)on the wrapped request object.voidsetAttribute(java.lang.String name, java.lang.Object o)The default behavior of this method is to callsetAttribute(name, o)on the wrapped request object.voidsetRequest(PortletRequest request)Sets the request object being wrapped.
-
-
-
Constructor Detail
-
PortletRequestWrapper
public PortletRequestWrapper(PortletRequest request)
Creates anPortletRequestadaptor 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:
getAttributein interfacePortletRequest- Parameters:
name- aStringspecifying the name of the attribute- Returns:
- an
Objectcontaining the value of the attribute, ornullif 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:
getAttributeNamesin interfacePortletRequest- Returns:
- an
Enumerationof strings containing the names of the request attributes, or an emptyEnumerationif 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:
getAuthTypein 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, ornullif 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:
getContextPathin interfacePortletRequest- Returns:
- a
Stringspecifying 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:
getLocalein 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:
getLocalesin 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:
getParameterin interfacePortletRequest- Parameters:
name- aStringspecifying the name of the parameter- Returns:
- a
Stringrepresenting 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:
getParameterMapin interfacePortletRequest- Returns:
- an immutable
Mapcontaining parameter names as keys and parameter values as map values, or an emptyMapif 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:
getParameterNamesin interfacePortletRequest- Returns:
- an
EnumerationofStringobjects, eachStringcontaining the name of a request parameter; or an emptyEnumerationif 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:
getParameterValuesin interfacePortletRequest- Parameters:
name- aStringcontaining the name of the parameter the value of which is requested- Returns:
- an array of
Stringobjects 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:
getPortalContextin 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:
getPortletModein 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:
getPortletSessionin 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:
getPortletSessionin interfacePortletRequest- Parameters:
create-trueto create a new session,
falseto returnnullif 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:
getPreferencesin 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:
getPropertiesin interfacePortletRequest- Parameters:
name- aStringspecifying the property name- Returns:
- a
Enumerationcontaining 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:
getPropertyin interfacePortletRequest- Parameters:
name- aStringspecifying the property name- Returns:
- a
Stringcontaining the value of the requested property, ornullif 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:
getPropertyNamesin interfacePortletRequest- Returns:
- an
Enumerationof 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:
getRemoteUserin interfacePortletRequest- Returns:
- a
Stringspecifying the login of the user making this request, ornullif 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:
getRequestedSessionIdin interfacePortletRequest- Returns:
- a
Stringspecifying the session ID, ornullif 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:
getResponseContentTypein 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:
getResponseContentTypesin 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:
getSchemein interfacePortletRequest- Returns:
- a
Stringcontaining 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:
getServerNamein interfacePortletRequest- Returns:
- a
Stringcontaining 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:
getServerPortin 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:
getUserPrincipalin interfacePortletRequest- Returns:
- a
java.security.Principalcontaining the name of the user making this request, ornullif 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:
getWindowIDin 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:
getWindowStatein 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:
isPortletModeAllowedin 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:
isRequestedSessionIdValidin interfacePortletRequest- Returns:
trueif this request has an id for a valid session in the current session context;falseotherwise- 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:
isSecurein 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:
isUserInRolein interfacePortletRequest- Parameters:
role- aStringspecifying the name of the role- Returns:
- a
booleanindicating whether the user making this request belongs to a given role;falseif 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:
isWindowStateAllowedin 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:
removeAttributein interfacePortletRequest- Parameters:
name- aStringspecifying 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:
setAttributein interfacePortletRequest- Parameters:
name- aStringspecifying the name of the attributeo- theObjectto 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:
getCookiesin interfacePortletRequest- Returns:
- array of cookie properties, or
nullif 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:
getPrivateParameterMapin interfacePortletRequest- Returns:
- an immutable
Mapcontaining private parameter names as keys and private parameter values as map values, or an emptyMapif 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:
getPublicParameterMapin interfacePortletRequest- Returns:
- an immutable
Mapcontaining public parameter names as keys and public parameter values as map values, or an emptyMapif 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[]).
-
-