org.apache.pluto.wrappers
Class ActionRequestWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by org.apache.pluto.wrappers.PortletRequestWrapper
              extended by org.apache.pluto.wrappers.ActionRequestWrapper
All Implemented Interfaces:
ActionRequest, ClientDataRequest, PortletRequest, javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class ActionRequestWrapper
extends PortletRequestWrapper
implements ActionRequest


Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.portlet.PortletRequest
PortletRequest.P3PUserInfos
 
Field Summary
 
Fields inherited from interface javax.portlet.ActionRequest
ACTION_NAME
 
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.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
ActionRequestWrapper(ActionRequest actionRequest)
          Creates a ServletRequest adaptor wrapping the given request object.
 
Method Summary
 ActionRequest getActionRequest()
          Return the wrapped ServletRequest object.
 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.
 String getContentType()
          Returns the MIME type of the body of the request, or null if the type is not known.
 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.
 void setCharacterEncoding(String enc)
          Overrides the name of the character encoding used in the body of this request.
 
Methods inherited from class org.apache.pluto.wrappers.PortletRequestWrapper
getAttribute, getAttributeNames, getAuthType, getContextPath, getLocale, getLocales, getParameter, getParameterMap, getParameterNames, getParameterValues, getPortalContext, getPortletMode, getPortletRequest, 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 javax.servlet.http.HttpServletRequestWrapper
getCookies, getDateHeader, getHeader, getHeaderNames, getHeaders, getIntHeader, getMethod, getPathInfo, getPathTranslated, getQueryString, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getInputStream, getLocalAddr, getLocalName, getLocalPort, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, 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.ClientDataRequest
getMethod
 
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
 
Methods inherited from interface javax.servlet.ServletRequest
getInputStream, getLocalAddr, getLocalName, getLocalPort, getProtocol, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher
 

Constructor Detail

ActionRequestWrapper

public ActionRequestWrapper(ActionRequest actionRequest)
Creates a ServletRequest adaptor wrapping the given request object.

Throws:
IllegalArgumentException - if the request is null.
Method Detail

getPortletInputStream

public InputStream getPortletInputStream()
                                  throws IOException
Description copied from interface: ClientDataRequest
Retrieves the body of the HTTP request from client to portal as binary data using an 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.

Specified by:
getPortletInputStream in interface ClientDataRequest
Returns:
an input stream containing the body of the request
Throws:
IOException - if an input or output exception occurred

setCharacterEncoding

public void setCharacterEncoding(String enc)
                          throws UnsupportedEncodingException
Description copied from interface: ClientDataRequest
Overrides the name of the character encoding used in the body of this request. This method must be called prior to reading input using ClientDataRequest.getReader() or ClientDataRequest.getPortletInputStream().

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

Specified by:
setCharacterEncoding in interface ClientDataRequest
Specified by:
setCharacterEncoding in interface javax.servlet.ServletRequest
Overrides:
setCharacterEncoding in class javax.servlet.ServletRequestWrapper
Parameters:
enc - a String containing the name of the character encoding.
Throws:
UnsupportedEncodingException - if this is not a valid encoding

getReader

public BufferedReader getReader()
                         throws UnsupportedEncodingException,
                                IOException
Description copied from interface: ClientDataRequest
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 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.

Specified by:
getReader in interface ClientDataRequest
Specified by:
getReader in interface javax.servlet.ServletRequest
Overrides:
getReader in class javax.servlet.ServletRequestWrapper
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 decoded
IOException - if an input or output exception occurred
See Also:
ClientDataRequest.getPortletInputStream()

getCharacterEncoding

public String getCharacterEncoding()
Description copied from interface: ClientDataRequest
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.

Specified by:
getCharacterEncoding in interface ClientDataRequest
Specified by:
getCharacterEncoding in interface javax.servlet.ServletRequest
Overrides:
getCharacterEncoding in class javax.servlet.ServletRequestWrapper
Returns:
a String containing the name of the character encoding, or null if the request does not specify a character encoding.

getContentType

public String getContentType()
Description copied from interface: ClientDataRequest
Returns the MIME type of the body of the request, or null if the type is not known.

Specified by:
getContentType in interface ClientDataRequest
Specified by:
getContentType in interface javax.servlet.ServletRequest
Overrides:
getContentType in class javax.servlet.ServletRequestWrapper
Returns:
a String containing the name of the MIME type of the request, or null if the type is not known.

getContentLength

public int getContentLength()
Description copied from interface: ClientDataRequest
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.

Specified by:
getContentLength in interface ClientDataRequest
Specified by:
getContentLength in interface javax.servlet.ServletRequest
Overrides:
getContentLength in class javax.servlet.ServletRequestWrapper
Returns:
an integer containing the length of the request body or -1 if the length is not known

getActionRequest

public ActionRequest getActionRequest()
Return the wrapped ServletRequest object.



Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.