Spring Framework

org.springframework.web.portlet.multipart
Class DefaultMultipartActionRequest

java.lang.Object
  extended by javax.portlet.filter.PortletRequestWrapper
      extended by javax.portlet.filter.ActionRequestWrapper
          extended by org.springframework.web.portlet.multipart.DefaultMultipartActionRequest
All Implemented Interfaces:
javax.portlet.ActionRequest, javax.portlet.ClientDataRequest, javax.portlet.PortletRequest, MultipartRequest, MultipartActionRequest

public class DefaultMultipartActionRequest
extends javax.portlet.filter.ActionRequestWrapper
implements MultipartActionRequest

Default implementation of the MultipartActionRequest interface. Provides management of pre-generated parameter values.

Since:
2.0
Author:
Juergen Hoeller, Arjen Poutsma
See Also:
PortletMultipartResolver

Nested Class Summary
 
Nested classes/interfaces inherited from interface javax.portlet.PortletRequest
javax.portlet.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
 
Constructor Summary
protected DefaultMultipartActionRequest(javax.portlet.ActionRequest request)
          Wrap the given Portlet ActionRequest in a MultipartActionRequest.
  DefaultMultipartActionRequest(javax.portlet.ActionRequest request, MultiValueMap<java.lang.String,MultipartFile> mpFiles, java.util.Map<java.lang.String,java.lang.String[]> mpParams, java.util.Map<java.lang.String,java.lang.String> mpParamContentTypes)
          Wrap the given Portlet ActionRequest in a MultipartActionRequest.
 
Method Summary
 MultipartFile getFile(java.lang.String name)
          Return the contents plus description of an uploaded file in this request, or null if it does not exist.
 java.util.Map<java.lang.String,MultipartFile> getFileMap()
          Return a Map of the multipart files contained in this request.
 java.util.Iterator<java.lang.String> getFileNames()
          Return an Iterator of String objects containing the parameter names of the multipart files contained in this request.
 java.util.List<MultipartFile> getFiles(java.lang.String name)
          Return the contents plus description of uploaded files in this request, or an empty list if it does not exist.
 MultiValueMap<java.lang.String,MultipartFile> getMultiFileMap()
          Return a MultiValueMap of the multipart files contained in this request.
 java.lang.String getMultipartContentType(java.lang.String paramOrFileName)
          Determine the content type of the specified request part.
protected  MultiValueMap<java.lang.String,MultipartFile> getMultipartFiles()
          Obtain the MultipartFile Map for retrieval, lazily initializing it if necessary.
protected  java.util.Map<java.lang.String,java.lang.String> getMultipartParameterContentTypes()
          Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.
protected  java.util.Map<java.lang.String,java.lang.String[]> getMultipartParameters()
          Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.
 java.lang.String getParameter(java.lang.String name)
           
 java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
           
 java.util.Enumeration<java.lang.String> getParameterNames()
           
 java.lang.String[] getParameterValues(java.lang.String name)
           
protected  void initializeMultipart()
          Lazily initialize the multipart request, if possible.
protected  void setMultipartFiles(MultiValueMap<java.lang.String,MultipartFile> multipartFiles)
          Set a Map with parameter names as keys and list of MultipartFile objects as values.
protected  void setMultipartParameterContentTypes(java.util.Map<java.lang.String,java.lang.String> multipartParameterContentTypes)
          Set a Map with parameter names as keys and content type Strings as values.
protected  void setMultipartParameters(java.util.Map<java.lang.String,java.lang.String[]> multipartParameters)
          Set a Map with parameter names as keys and String array objects as values.
 
Methods inherited from class javax.portlet.filter.ActionRequestWrapper
getCharacterEncoding, getContentLength, getContentType, getMethod, getPortletInputStream, getReader, getRequest, setCharacterEncoding, setRequest
 
Methods inherited from class javax.portlet.filter.PortletRequestWrapper
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, 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, 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
getCharacterEncoding, getContentLength, getContentType, getMethod, getPortletInputStream, getReader, setCharacterEncoding
 
Methods inherited from interface javax.portlet.PortletRequest
getAttribute, getAttributeNames, getAuthType, getContextPath, getCookies, getLocale, getLocales, 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
 

Constructor Detail

DefaultMultipartActionRequest

public DefaultMultipartActionRequest(javax.portlet.ActionRequest request,
                                     MultiValueMap<java.lang.String,MultipartFile> mpFiles,
                                     java.util.Map<java.lang.String,java.lang.String[]> mpParams,
                                     java.util.Map<java.lang.String,java.lang.String> mpParamContentTypes)
Wrap the given Portlet ActionRequest in a MultipartActionRequest.

Parameters:
request - the request to wrap
mpFiles - a map of the multipart files
mpParams - a map of the parameters to expose, with Strings as keys and String arrays as values

DefaultMultipartActionRequest

protected DefaultMultipartActionRequest(javax.portlet.ActionRequest request)
Wrap the given Portlet ActionRequest in a MultipartActionRequest.

Parameters:
request - the request to wrap
Method Detail

getFileNames

public java.util.Iterator<java.lang.String> getFileNames()
Description copied from interface: MultipartRequest
Return an Iterator of String objects containing the parameter names of the multipart files contained in this request. These are the field names of the form (like with normal parameters), not the original file names.

Specified by:
getFileNames in interface MultipartRequest
Returns:
the names of the files

getFile

public MultipartFile getFile(java.lang.String name)
Description copied from interface: MultipartRequest
Return the contents plus description of an uploaded file in this request, or null if it does not exist.

Specified by:
getFile in interface MultipartRequest
Parameters:
name - a String specifying the parameter name of the multipart file
Returns:
the uploaded content in the form of a MultipartFile object

getFiles

public java.util.List<MultipartFile> getFiles(java.lang.String name)
Description copied from interface: MultipartRequest
Return the contents plus description of uploaded files in this request, or an empty list if it does not exist.

Specified by:
getFiles in interface MultipartRequest
Parameters:
name - a String specifying the parameter name of the multipart file
Returns:
the uploaded content in the form of a MultipartFile list

getFileMap

public java.util.Map<java.lang.String,MultipartFile> getFileMap()
Description copied from interface: MultipartRequest
Return a Map of the multipart files contained in this request.

Specified by:
getFileMap in interface MultipartRequest
Returns:
a map containing the parameter names as keys, and the MultipartFile objects as values

getMultiFileMap

public MultiValueMap<java.lang.String,MultipartFile> getMultiFileMap()
Description copied from interface: MultipartRequest
Return a MultiValueMap of the multipart files contained in this request.

Specified by:
getMultiFileMap in interface MultipartRequest
Returns:
a map containing the parameter names as keys, and a list of MultipartFile objects as values

getParameterNames

public java.util.Enumeration<java.lang.String> getParameterNames()
Specified by:
getParameterNames in interface javax.portlet.PortletRequest
Overrides:
getParameterNames in class javax.portlet.filter.PortletRequestWrapper

getParameter

public java.lang.String getParameter(java.lang.String name)
Specified by:
getParameter in interface javax.portlet.PortletRequest
Overrides:
getParameter in class javax.portlet.filter.PortletRequestWrapper

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Specified by:
getParameterValues in interface javax.portlet.PortletRequest
Overrides:
getParameterValues in class javax.portlet.filter.PortletRequestWrapper

getParameterMap

public java.util.Map<java.lang.String,java.lang.String[]> getParameterMap()
Specified by:
getParameterMap in interface javax.portlet.PortletRequest
Overrides:
getParameterMap in class javax.portlet.filter.PortletRequestWrapper

getMultipartContentType

public java.lang.String getMultipartContentType(java.lang.String paramOrFileName)
Description copied from interface: MultipartRequest
Determine the content type of the specified request part.

Specified by:
getMultipartContentType in interface MultipartRequest
Parameters:
paramOrFileName - the name of the part
Returns:
the associated content type, or null if not defined

setMultipartFiles

protected final void setMultipartFiles(MultiValueMap<java.lang.String,MultipartFile> multipartFiles)
Set a Map with parameter names as keys and list of MultipartFile objects as values. To be invoked by subclasses on initialization.


getMultipartFiles

protected MultiValueMap<java.lang.String,MultipartFile> getMultipartFiles()
Obtain the MultipartFile Map for retrieval, lazily initializing it if necessary.

See Also:
initializeMultipart()

setMultipartParameters

protected final void setMultipartParameters(java.util.Map<java.lang.String,java.lang.String[]> multipartParameters)
Set a Map with parameter names as keys and String array objects as values. To be invoked by subclasses on initialization.


getMultipartParameters

protected java.util.Map<java.lang.String,java.lang.String[]> getMultipartParameters()
Obtain the multipart parameter Map for retrieval, lazily initializing it if necessary.

See Also:
initializeMultipart()

setMultipartParameterContentTypes

protected final void setMultipartParameterContentTypes(java.util.Map<java.lang.String,java.lang.String> multipartParameterContentTypes)
Set a Map with parameter names as keys and content type Strings as values. To be invoked by subclasses on initialization.


getMultipartParameterContentTypes

protected java.util.Map<java.lang.String,java.lang.String> getMultipartParameterContentTypes()
Obtain the multipart parameter content type Map for retrieval, lazily initializing it if necessary.

See Also:
initializeMultipart()

initializeMultipart

protected void initializeMultipart()
Lazily initialize the multipart request, if possible. Only called if not already eagerly initialized.


Spring Framework