public class ClientDataRequestWrapper extends PortletRequestWrapper implements ClientDataRequest
ClientDataRequestWrapper
provides a convenient implementation of the ClientDataRequest
interface that can be subclassed by developers.
This class implements the Wrapper or Decorator pattern. Methods default to
calling through to the wrapped request object. PortletRequest.P3PUserInfos
wrapped
ACTION_PHASE, ACTION_SCOPE_ID, BASIC_AUTH, CCPP_PROFILE, CLIENT_CERT_AUTH, DIGEST_AUTH, EVENT_PHASE, FORM_AUTH, HEADER_PHASE, LIFECYCLE_PHASE, RENDER_HEADERS, RENDER_MARKUP, RENDER_PART, RENDER_PHASE, RESOURCE_PHASE, USER_INFO
Constructor and Description |
---|
ClientDataRequestWrapper(ClientDataRequest request) |
Modifier and Type | Method and Description |
---|---|
String |
getCharacterEncoding()
Returns the name of the character encoding used in the body of this request.
|
int |
getContentLength()
Returns the length, in bytes, of the request body
which is made available by the input stream, or -1 if the
length is not known.
|
long |
getContentLengthLong()
Returns the length, in bytes, of the request body
which is made available by the input stream, or -1 if the
length is not known.
|
String |
getContentType()
Returns the MIME type of the body of the request,
or null if the type is not known.
|
String |
getMethod()
Returns the name of the HTTP method with which this request was made,
for example, GET, POST, or PUT.
|
javax.servlet.http.Part |
getPart(String name)
Gets the Part with the given name.
|
Collection<javax.servlet.http.Part> |
getParts()
Gets all the Part components of this request, provided that it is of type multipart/form-data.
|
InputStream |
getPortletInputStream()
Retrieves the body of the HTTP request from client to
portal as binary data using
an
InputStream . |
BufferedReader |
getReader()
Retrieves the body of the HTTP request from the client to the portal
as character data using
a
BufferedReader . |
ClientDataRequest |
getRequest()
Return the wrapped request object.
|
void |
setCharacterEncoding(String enc)
Overrides the name of the character encoding used in the body of this
request.
|
void |
setRequest(ClientDataRequest request)
Sets the request object being wrapped.
|
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletContext, getPortletMode, getPortletSession, getPortletSession, getPreferences, getPrivateParameterMap, getProperties, getProperty, getPropertyNames, getPublicParameterMap, getRemoteUser, getRenderParameters, getRequestedSessionId, getResponseContentType, getResponseContentTypes, getScheme, getServerName, getServerPort, getUserAgent, getUserPrincipal, getWindowID, getWindowState, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute, setRequest
getWrapped, setWrapped
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletContext, getPortletSession, getPortletSession, getPreferences, getPrivateParameterMap, getProperties, getProperty, getPropertyNames, getPublicParameterMap, getRemoteUser, getRequestedSessionId, getResponseContentType, getResponseContentTypes, getScheme, getServerName, getServerPort, getUserAgent, getUserPrincipal, getWindowID, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute
getPortletMode, getRenderParameters, getWindowState
public ClientDataRequestWrapper(ClientDataRequest request)
request
- public ClientDataRequest getRequest()
getRequest
in class PortletRequestWrapper
public void setRequest(ClientDataRequest request)
request
- the request to setIllegalArgumentException
- if the request is null.public InputStream getPortletInputStream() throws IOException
ClientDataRequest
InputStream
. Either this method or
ClientDataRequest.getReader()
may be called to read the body, but not both.
For HTTP POST data of type application/x-www-form-urlencoded
this method throws an IllegalStateException
as this data has been already processed by the
portal/portlet-container and is available as request parameters.
getPortletInputStream
in interface ClientDataRequest
IOException
- if an input or output exception occurredpublic void setCharacterEncoding(String enc) throws UnsupportedEncodingException
ClientDataRequest
ClientDataRequest.getReader()
or ClientDataRequest.getPortletInputStream()
.
This method only sets the character set for the Reader that the
ClientDataRequest.getReader()
method returns.
setCharacterEncoding
in interface ClientDataRequest
enc
- a String
containing the name of
the character encoding.UnsupportedEncodingException
- if this is not a valid encodingpublic BufferedReader getReader() throws UnsupportedEncodingException, IOException
ClientDataRequest
BufferedReader
. The reader translates the character
data according to the character encoding used on the body.
Either this method or ClientDataRequest.getPortletInputStream()
may be called to read the
body, not both.
For HTTP POST data of type application/x-www-form-urlencoded
this method throws an IllegalStateException
as this data has been already processed by the
portal/portlet-container and is available as request parameters.
getReader
in interface ClientDataRequest
BufferedReader
containing the body of the requestUnsupportedEncodingException
- if the character set encoding used is
not supported and the text cannot be decodedIOException
- if an input or output exception occurredClientDataRequest.getPortletInputStream()
public String getCharacterEncoding()
ClientDataRequest
null
if the request
does not specify a character encoding.getCharacterEncoding
in interface ClientDataRequest
String
containing the name of
the character encoding, or null
if the request does not specify a character encoding.public String getContentType()
ClientDataRequest
getContentType
in interface ClientDataRequest
String
containing the name
of the MIME type of the request, or null
if the type is not known.public int getContentLength()
ClientDataRequest
getContentLength
in interface ClientDataRequest
public long getContentLengthLong()
ClientDataRequest
getContentLengthLong
in interface ClientDataRequest
long
containing the length of the
request body or -1 if the length is not knownpublic String getMethod()
ClientDataRequest
getMethod
in interface ClientDataRequest
public javax.servlet.http.Part getPart(String name) throws IOException, PortletException
ClientDataRequest
getPart
in interface ClientDataRequest
name
- - the name of the requested PartIOException
- if an I/O error occurred during the retrieval of the Part components of
this requestPortletException
- if this request is not of type multipart/form-datapublic Collection<javax.servlet.http.Part> getParts() throws IOException, PortletException
ClientDataRequest
If this request is of type multipart/form-data, but does not contain any Part components, the returned Collection will be empty.
Any changes to the returned Collection must not affect this request object.
getParts
in interface ClientDataRequest
IOException
- if an I/O error occurred during the retrieval of the Part components of
this requestPortletException
- if this request is not of type multipart/form-dataJava Portlet 3.0 API Specification. See the Copyright and License provided with this distribution. Use is subject to license terms.