Class ClientDataRequestWrapper
- java.lang.Object
-
- jakarta.portlet.filter.RenderStateWrapper
-
- jakarta.portlet.filter.PortletRequestWrapper
-
- jakarta.portlet.filter.ClientDataRequestWrapper
-
- All Implemented Interfaces:
ClientDataRequest,PortletRequest,RenderState
- Direct Known Subclasses:
ActionRequestWrapper,ResourceRequestWrapper
public class ClientDataRequestWrapper extends PortletRequestWrapper implements ClientDataRequest
TheClientDataRequestWrapperprovides a convenient implementation of theClientDataRequestinterface that can be subclassed by developers. This class implements the Wrapper or Decorator pattern. Methods default to calling through to the wrapped request object.- Since:
- 3.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jakarta.portlet.PortletRequest
PortletRequest.P3PUserInfos
-
-
Field Summary
-
Fields inherited from class jakarta.portlet.filter.RenderStateWrapper
wrapped
-
Fields inherited from interface jakarta.portlet.PortletRequest
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 Summary
Constructors Constructor Description ClientDataRequestWrapper(ClientDataRequest request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetCharacterEncoding()Returns the name of the character encoding used in the body of this request.intgetContentLength()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.longgetContentLengthLong()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.StringgetContentType()Returns the MIME type of the body of the request, or null if the type is not known.StringgetMethod()Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.jakarta.servlet.http.PartgetPart(String name)Gets the Part with the given name.Collection<jakarta.servlet.http.Part>getParts()Gets all the Part components of this request, provided that it is of type multipart/form-data.InputStreamgetPortletInputStream()Retrieves the body of the HTTP request from client to portal as binary data using anInputStream.BufferedReadergetReader()Retrieves the body of the HTTP request from the client to the portal as character data using aBufferedReader.ClientDataRequestgetRequest()Return the wrapped request object.voidsetCharacterEncoding(String enc)Overrides the name of the character encoding used in the body of this request.voidsetRequest(ClientDataRequest request)Sets the request object being wrapped.-
Methods inherited from class jakarta.portlet.filter.PortletRequestWrapper
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
-
Methods inherited from class jakarta.portlet.filter.RenderStateWrapper
getWrapped, setWrapped
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jakarta.portlet.PortletRequest
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
-
Methods inherited from interface jakarta.portlet.RenderState
getPortletMode, getRenderParameters, getWindowState
-
-
-
-
Constructor Detail
-
ClientDataRequestWrapper
public ClientDataRequestWrapper(ClientDataRequest request)
- Parameters:
request- the wrapped request
-
-
Method Detail
-
getRequest
public ClientDataRequest getRequest()
Return the wrapped request object.- Overrides:
getRequestin classPortletRequestWrapper- Returns:
- the wrapped request
-
setRequest
public void setRequest(ClientDataRequest request)
Sets the request object being wrapped.- Parameters:
request- the request to set- Throws:
IllegalArgumentException- if the request is null.
-
getPortletInputStream
public InputStream getPortletInputStream() throws IOException
Description copied from interface:ClientDataRequestRetrieves the body of the HTTP request from client to portal as binary data using anInputStream. Either this method orClientDataRequest.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
IllegalStateExceptionas this data has been already processed by the portal/portlet-container and is available as request parameters.- Specified by:
getPortletInputStreamin interfaceClientDataRequest- 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:ClientDataRequestOverrides the name of the character encoding used in the body of this request. This method must be called prior to reading input usingClientDataRequest.getReader()orClientDataRequest.getPortletInputStream().This method only sets the character set for the Reader that the
ClientDataRequest.getReader()method returns.- Specified by:
setCharacterEncodingin interfaceClientDataRequest- Parameters:
enc- aStringcontaining 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:ClientDataRequestRetrieves 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 orClientDataRequest.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
IllegalStateExceptionas this data has been already processed by the portal/portlet-container and is available as request parameters.- Specified by:
getReaderin interfaceClientDataRequest- Returns:
- a
BufferedReadercontaining the body of the request - Throws:
UnsupportedEncodingException- if the character set encoding used is not supported and the text cannot be decodedIOException- if an input or output exception occurred- See Also:
ClientDataRequest.getPortletInputStream()
-
getCharacterEncoding
public String getCharacterEncoding()
Description copied from interface:ClientDataRequestReturns the name of the character encoding used in the body of this request. This method returnsnullif the request does not specify a character encoding.- Specified by:
getCharacterEncodingin interfaceClientDataRequest- Returns:
- a
Stringcontaining the name of the character encoding, ornullif the request does not specify a character encoding.
-
getContentType
public String getContentType()
Description copied from interface:ClientDataRequestReturns the MIME type of the body of the request, or null if the type is not known.- Specified by:
getContentTypein interfaceClientDataRequest- Returns:
- a
Stringcontaining 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:ClientDataRequestReturns 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:
getContentLengthin interfaceClientDataRequest- Returns:
- an integer containing the length of the request body or -1 if the length is not known
-
getContentLengthLong
public long getContentLengthLong()
Description copied from interface:ClientDataRequestReturns 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:
getContentLengthLongin interfaceClientDataRequest- Returns:
- a
longcontaining the length of the request body or -1 if the length is not known
-
getMethod
public String getMethod()
Description copied from interface:ClientDataRequestReturns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.- Specified by:
getMethodin interfaceClientDataRequest- Returns:
- a String specifying the name of the HTTP method with which this request was made
-
getPart
public jakarta.servlet.http.Part getPart(String name) throws IOException, PortletException
Description copied from interface:ClientDataRequestGets the Part with the given name.- Specified by:
getPartin interfaceClientDataRequest- Parameters:
name- - the name of the requested Part- Returns:
- The Part with the given name, or null if this request is of type multipart/form-data, but does not contain the requested Part
- Throws:
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-data
-
getParts
public Collection<jakarta.servlet.http.Part> getParts() throws IOException, PortletException
Description copied from interface:ClientDataRequestGets all the Part components of this request, provided that it is of type multipart/form-data.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.
- Specified by:
getPartsin interfaceClientDataRequest- Returns:
- a (possibly empty) Collection of the Part components of this request
- Throws:
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-data
-
-