Package javax.portlet
Interface ActionRequest
- All Superinterfaces:
PortletRequest
The
The portlet container creates an
ActionRequest
represents the request sent to the portlet
to handle an action.
It extends the PortletRequest interface to provide action request
information to portlets.The portlet container creates an
ActionRequest
object and
passes it as argument to the portlet's processAction
method.- See Also:
-
Field Summary
Fields inherited from interface javax.portlet.PortletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH, USER_INFO
-
Method Summary
Modifier and TypeMethodDescriptionReturns the name of the character encoding used in the body of this request.int
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 the MIME type of the body of the request, or null if the type is not known.Retrieves the body of the HTTP request from client to portal as binary data using anInputStream
.Retrieves the body of the HTTP request from the client to the portal as character data using aBufferedReader
.void
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, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletMode, getPortletSession, getPortletSession, getPreferences, getProperties, getProperty, getPropertyNames, getRemoteUser, getRequestedSessionId, getResponseContentType, getResponseContentTypes, getScheme, getServerName, getServerPort, getUserPrincipal, getWindowState, isPortletModeAllowed, isRequestedSessionIdValid, isSecure, isUserInRole, isWindowStateAllowed, removeAttribute, setAttribute
-
Method Details
-
getPortletInputStream
Retrieves the body of the HTTP request from client to portal as binary data using anInputStream
. Either this method orgetReader()
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:
IllegalStateException
- if getReader was already called, or it is a HTTP POST data of type application/x-www-form-urlencodedIOException
- if an input or output exception occurred
-
setCharacterEncoding
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading input usinggetReader()
orgetPortletInputStream()
.This method only sets the character set for the Reader that the
getReader()
method returns.- Parameters:
enc
- aString
containing the name of the chararacter encoding.- Throws:
UnsupportedEncodingException
- if this is not a valid encodingIllegalStateException
- if this method is called after reading request parameters or reading input usinggetReader()
-
getReader
Retrieves the body of the HTTP request from the client to the portal as character data using aBufferedReader
. The reader translates the character data according to the character encoding used on the body. Either this method orgetPortletInputStream()
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:
UnsupportedEncodingException
- if the character set encoding used is not supported and the text cannot be decodedIllegalStateException
- ifgetPortletInputStream()
method has been called on this request, it is a HTTP POST data of type application/x-www-form-urlencoded.IOException
- if an input or output exception occurred- See Also:
-
getCharacterEncoding
String getCharacterEncoding()Returns the name of the character encoding used in the body of this request. This method returnsnull
if the request does not specify a character encoding.- Returns:
- a
String
containing the name of the chararacter encoding, ornull
if the request does not specify a character encoding.
-
getContentType
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
-