Package javax.portlet.filter
Class ResourceRequestWrapper
- java.lang.Object
-
- javax.portlet.filter.PortletRequestWrapper
-
- javax.portlet.filter.ResourceRequestWrapper
-
- All Implemented Interfaces:
ClientDataRequest
,PortletRequest
,ResourceRequest
public class ResourceRequestWrapper extends PortletRequestWrapper implements ResourceRequest
TheResourceRequestWrapper
provides a convenient implementation of theResourceRequest
interface that can be subclassed by developers wishing to adapt the request. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.- Since:
- 2.0
- See Also:
ResourceRequest
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface javax.portlet.PortletRequest
PortletRequest.P3PUserInfos
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ResourceRequest
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
-
Fields inherited from interface javax.portlet.ResourceRequest
ETAG
-
-
Constructor Summary
Constructors Constructor Description ResourceRequestWrapper(ResourceRequest request)
Creates anResourceRequest
adaptor wrapping the given request object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCacheability()
The default behavior of this method is to callgetCacheability()
on the wrapped response object.java.lang.String
getCharacterEncoding()
The default behavior of this method is to callgetCharacterEncoding()
on the wrapped request object.int
getContentLength()
The default behavior of this method is to callgetContentLength()
on the wrapped request object.java.lang.String
getContentType()
The default behavior of this method is to callgetContentType()
on the wrapped request object.java.lang.String
getETag()
The default behavior of this method is to callgetETag()
on the wrapped request object.java.lang.String
getMethod()
The default behavior of this method is to callgetMethod()
on the wrapped request object.java.io.InputStream
getPortletInputStream()
The default behavior of this method is to callgetPortletInputStream()
on the wrapped request object.java.util.Map<java.lang.String,java.lang.String[]>
getPrivateRenderParameterMap()
The default behavior of this method is to callgetPrivateRenderParameterMap()
on the wrapped request object.java.io.BufferedReader
getReader()
The default behavior of this method is to callgetReader()
on the wrapped request object.ResourceRequest
getRequest()
Return the wrapped request object.java.lang.String
getResourceID()
The default behavior of this method is to callgetResourceID()
on the wrapped request object.void
setCharacterEncoding(java.lang.String enc)
The default behavior of this method is to callsetCharacterEncoding(String enc)
on the wrapped request object.void
setRequest(ResourceRequest request)
Sets the request object being wrapped.-
Methods inherited from class javax.portlet.filter.PortletRequestWrapper
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletMode, getPortletSession, getPortletSession, getPreferences, getPrivateParameterMap, getProperties, getProperty, getPropertyNames, getPublicParameterMap, getRemoteUser, getRequestedSessionId, getResponseContentType, getResponseContentTypes, getScheme, getServerName, getServerPort, getUserPrincipal, getWindowID, getWindowState, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute, 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
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletMode, getPortletSession, getPortletSession, getPreferences, getPrivateParameterMap, getProperties, getProperty, getPropertyNames, getPublicParameterMap, getRemoteUser, getRequestedSessionId, getScheme, getServerName, getServerPort, getUserPrincipal, getWindowID, getWindowState, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute
-
Methods inherited from interface javax.portlet.ResourceRequest
getResponseContentType, getResponseContentTypes
-
-
-
-
Field Detail
-
request
ResourceRequest request
-
-
Constructor Detail
-
ResourceRequestWrapper
public ResourceRequestWrapper(ResourceRequest request)
Creates anResourceRequest
adaptor wrapping the given request object.- Parameters:
request
- the resource request to wrap- Throws:
java.lang.IllegalArgumentException
- if the request isnull
-
-
Method Detail
-
getPortletInputStream
public java.io.InputStream getPortletInputStream() throws java.io.IOException
The default behavior of this method is to callgetPortletInputStream()
on the wrapped request object.- Specified by:
getPortletInputStream
in interfaceClientDataRequest
- Returns:
- an input stream containing the body of the request
- Throws:
java.io.IOException
- if an input or output exception occurred
-
getReader
public java.io.BufferedReader getReader() throws java.io.UnsupportedEncodingException, java.io.IOException
The default behavior of this method is to callgetReader()
on the wrapped request object.- Specified by:
getReader
in interfaceClientDataRequest
- Returns:
- a
BufferedReader
containing the body of the request - Throws:
java.io.UnsupportedEncodingException
- if the character set encoding used is not supported and the text cannot be decodedjava.io.IOException
- if an input or output exception occurred- See Also:
ClientDataRequest.getPortletInputStream()
-
setCharacterEncoding
public void setCharacterEncoding(java.lang.String enc) throws java.io.UnsupportedEncodingException
The default behavior of this method is to callsetCharacterEncoding(String enc)
on the wrapped request object.- Specified by:
setCharacterEncoding
in interfaceClientDataRequest
- Parameters:
enc
- aString
containing the name of the character encoding.- Throws:
java.io.UnsupportedEncodingException
- if this is not a valid encoding
-
getRequest
public ResourceRequest getRequest()
Return the wrapped request object.- Overrides:
getRequest
in classPortletRequestWrapper
- Returns:
- the wrapped request
-
setRequest
public void setRequest(ResourceRequest request)
Sets the request object being wrapped.- Parameters:
request
- the request to set- Throws:
java.lang.IllegalArgumentException
- if the request is null.
-
getCharacterEncoding
public java.lang.String getCharacterEncoding()
The default behavior of this method is to callgetCharacterEncoding()
on the wrapped request object.- Specified by:
getCharacterEncoding
in interfaceClientDataRequest
- Returns:
- a
String
containing the name of the character encoding, ornull
if the request does not specify a character encoding.
-
getContentLength
public int getContentLength()
The default behavior of this method is to callgetContentLength()
on the wrapped request object.- Specified by:
getContentLength
in interfaceClientDataRequest
- Returns:
- an integer containing the length of the request body or -1 if the length is not known
-
getContentType
public java.lang.String getContentType()
The default behavior of this method is to callgetContentType()
on the wrapped request object.- Specified by:
getContentType
in interfaceClientDataRequest
- Returns:
- a
String
containing the name of the MIME type of the request, or null if the type is not known.
-
getETag
public java.lang.String getETag()
The default behavior of this method is to callgetETag()
on the wrapped request object.- Specified by:
getETag
in interfaceResourceRequest
- Returns:
- the validation tag if the portlet container
has a cached response for this validation tag, or
null
if no cached response exists.
-
getMethod
public java.lang.String getMethod()
The default behavior of this method is to callgetMethod()
on the wrapped request object.- Specified by:
getMethod
in interfaceClientDataRequest
- Returns:
- a String specifying the name of the HTTP method with which this request was made
-
getResourceID
public java.lang.String getResourceID()
The default behavior of this method is to callgetResourceID()
on the wrapped request object.- Specified by:
getResourceID
in interfaceResourceRequest
- Returns:
- the resource ID set on the ResourceURL,or
null
if no resource ID was set on the URL.
-
getPrivateRenderParameterMap
public java.util.Map<java.lang.String,java.lang.String[]> getPrivateRenderParameterMap()
The default behavior of this method is to callgetPrivateRenderParameterMap()
on the wrapped request object.- Specified by:
getPrivateRenderParameterMap
in interfaceResourceRequest
- 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[]
).
-
getCacheability
public java.lang.String getCacheability()
The default behavior of this method is to callgetCacheability()
on the wrapped response object.- Specified by:
getCacheability
in interfaceResourceRequest
- Returns:
- the cache level of this resource request.
-
-