javax.portlet
Interface ClientDataRequest

All Superinterfaces:
PortletRequest
All Known Subinterfaces:
ActionRequest, ResourceRequest
All Known Implementing Classes:
ActionRequestWrapper, ResourceRequestWrapper

public interface ClientDataRequest
extends PortletRequest

The ClientDataRequest represents the request information of the HTTP request issued from the client to the portal.
It extends the PortletRequest interface.

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
 
Method Summary
 java.lang.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.
 java.lang.String getContentType()
          Returns the MIME type of the body of the request, or null if the type is not known.
 java.lang.String getMethod()
          Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
 java.io.InputStream getPortletInputStream()
          Retrieves the body of the HTTP request from client to portal as binary data using an InputStream.
 java.io.BufferedReader getReader()
          Retrieves the body of the HTTP request from the client to the portal as character data using a BufferedReader.
 void setCharacterEncoding(java.lang.String enc)
          Overrides the name of the character encoding used in the body of this request.
 
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, getResponseContentType, getResponseContentTypes, getScheme, getServerName, getServerPort, getUserPrincipal, getWindowID, getWindowState, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute
 

Method Detail

getPortletInputStream

java.io.InputStream getPortletInputStream()
                                          throws java.io.IOException
Retrieves the body of the HTTP request from client to portal as binary data using an InputStream. Either this method or 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.

Returns:
an input stream containing the body of the request
Throws:
java.lang.IllegalStateException - if getReader was already called, or it is a HTTP POST data of type application/x-www-form-urlencoded
java.io.IOException - if an input or output exception occurred

setCharacterEncoding

void setCharacterEncoding(java.lang.String enc)
                          throws java.io.UnsupportedEncodingException
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading input using getReader() or getPortletInputStream().

This method only sets the character set for the Reader that the getReader() method returns.

Parameters:
enc - a String containing the name of the character encoding.
Throws:
java.io.UnsupportedEncodingException - if this is not a valid encoding
java.lang.IllegalStateException - if this method is called after reading request parameters or reading input using getReader()

getReader

java.io.BufferedReader getReader()
                                 throws java.io.UnsupportedEncodingException,
                                        java.io.IOException
Retrieves the body of the HTTP request from the client to the portal as character data using a BufferedReader. The reader translates the character data according to the character encoding used on the body. Either this method or 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.

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 decoded
java.lang.IllegalStateException - if getPortletInputStream() method has been called on this request, it is a HTTP POST data of type application/x-www-form-urlencoded.
java.io.IOException - if an input or output exception occurred
See Also:
getPortletInputStream()

getCharacterEncoding

java.lang.String getCharacterEncoding()
Returns the name of the character encoding used in the body of this request. This method returns null if the request does not specify a character encoding.

Returns:
a String containing the name of the character encoding, or null if the request does not specify a character encoding.

getContentType

java.lang.String getContentType()
Returns the MIME type of the body of the request, or null if the type is not known.

Returns:
a String containing the name of the MIME type of the request, or null if the type is not known.

getContentLength

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.

Returns:
an integer containing the length of the request body or -1 if the length is not known

getMethod

java.lang.String getMethod()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.

Returns:
a String specifying the name of the HTTP method with which this request was made
Since:
2.0