类 CommonsPortletMultipartResolver
- java.lang.Object
- org.springframework.web.multipart.commons.CommonsFileUploadSupport
- org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver
- 所有已实现的接口:
Aware
,PortletContextAware
,PortletMultipartResolver
public class CommonsPortletMultipartResolver extends CommonsFileUploadSupport implements PortletMultipartResolver, PortletContextAware
PortletMultipartResolver
implementation for Apache Commons FileUpload 1.2 or above.Provides "maxUploadSize", "maxInMemorySize" and "defaultEncoding" settings as bean properties (inherited from
CommonsFileUploadSupport
). See corresponding PortletFileUpload / DiskFileItemFactory properties ("sizeMax", "sizeThreshold", "headerEncoding") for details in terms of defaults and accepted values.Saves temporary files to the portlet container's temporary directory. Needs to be initialized either by an application context or via the constructor that takes a PortletContext (for standalone usage).
- 从以下版本开始:
- 2.0
- 作者:
- Juergen Hoeller
- 另请参阅:
CommonsPortletMultipartResolver(javax.portlet.PortletContext)
,setResolveLazily(boolean)
,CommonsMultipartResolver
,PortletFileUpload
,DiskFileItemFactory
嵌套类概要
从类继承的嵌套类/接口 org.springframework.web.multipart.commons.CommonsFileUploadSupport
CommonsFileUploadSupport.MultipartParsingResult
字段概要
从类继承的字段 org.springframework.web.multipart.commons.CommonsFileUploadSupport
logger
构造器概要
构造器 构造器 说明 CommonsPortletMultipartResolver()
Constructor for use as bean.CommonsPortletMultipartResolver(PortletContext portletContext)
Constructor for standalone usage.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
cleanupMultipart(MultipartActionRequest request)
Cleanup any resources used for the multipart handling, such as storage for any uploaded file(s).protected String
determineEncoding(ActionRequest request)
Determine the encoding for the given request.boolean
isMultipart(ActionRequest request)
Determine if the given request contains multipart content.protected org.apache.commons.fileupload.FileUpload
newFileUpload(org.apache.commons.fileupload.FileItemFactory fileItemFactory)
Initialize the underlyingorg.apache.commons.fileupload.portlet.PortletFileUpload
instance.protected CommonsFileUploadSupport.MultipartParsingResult
parseRequest(ActionRequest request)
Parse the given portlet request, resolving its multipart elements.MultipartActionRequest
resolveMultipart(ActionRequest request)
Parse the given portlet request into multipart files and parameters, and wrap the request inside a MultipartActionRequest object that provides access to file descriptors and makes contained parameters accessible via the standard PortletRequest methods.void
setPortletContext(PortletContext portletContext)
Set the PortletContext that this object runs in.void
setResolveLazily(boolean resolveLazily)
Set whether to resolve the multipart request lazily at the time of file or parameter access.从类继承的方法 org.springframework.web.multipart.commons.CommonsFileUploadSupport
cleanupFileItems, createMultipartFile, getDefaultEncoding, getFileItemFactory, getFileUpload, isUploadTempDirSpecified, newFileItemFactory, parseFileItems, prepareFileUpload, setDefaultEncoding, setMaxInMemorySize, setMaxUploadSize, setMaxUploadSizePerFile, setPreserveFilename, setUploadTempDir
构造器详细资料
CommonsPortletMultipartResolver
public CommonsPortletMultipartResolver()
Constructor for use as bean. Determines the portlet container's temporary directory via the PortletContext passed in as through the PortletContextAware interface (typically by an ApplicationContext).
CommonsPortletMultipartResolver
public CommonsPortletMultipartResolver(PortletContext portletContext)
Constructor for standalone usage. Determines the portlet container's temporary directory via the given PortletContext.- 参数:
portletContext
- the PortletContext to use
方法详细资料
setResolveLazily
public void setResolveLazily(boolean resolveLazily)
Set whether to resolve the multipart request lazily at the time of file or parameter access.Default is "false", resolving the multipart elements immediately, throwing corresponding exceptions at the time of the
resolveMultipart(javax.portlet.ActionRequest)
call. Switch this to "true" for lazy multipart parsing, throwing parse exceptions once the application attempts to obtain multipart files or parameters.
newFileUpload
protected org.apache.commons.fileupload.FileUpload newFileUpload(org.apache.commons.fileupload.FileItemFactory fileItemFactory)
Initialize the underlyingorg.apache.commons.fileupload.portlet.PortletFileUpload
instance. Can be overridden to use a custom subclass, e.g. for testing purposes.- 指定者:
newFileUpload
在类中CommonsFileUploadSupport
- 参数:
fileItemFactory
- the Commons FileItemFactory to build upon- 返回:
- the new PortletFileUpload instance
setPortletContext
public void setPortletContext(PortletContext portletContext)
从接口复制的说明:PortletContextAware
Set the PortletContext that this object runs in.Invoked after population of normal bean properties but before an init callback like InitializingBean's afterPropertiesSet or a custom init-method. Invoked after ApplicationContextAware's setApplicationContext.
- 指定者:
setPortletContext
在接口中PortletContextAware
- 参数:
portletContext
- PortletContext object to be used by this object
isMultipart
public boolean isMultipart(ActionRequest request)
从接口复制的说明:PortletMultipartResolver
Determine if the given request contains multipart content.Will typically check for content type "
multipart/form-data
", but the actually accepted requests might depend on the capabilities of the resolver implementation.- 指定者:
isMultipart
在接口中PortletMultipartResolver
- 参数:
request
- the portlet request to be evaluated- 返回:
- whether the request contains multipart content
resolveMultipart
public MultipartActionRequest resolveMultipart(ActionRequest request) throws MultipartException
从接口复制的说明:PortletMultipartResolver
Parse the given portlet request into multipart files and parameters, and wrap the request inside a MultipartActionRequest object that provides access to file descriptors and makes contained parameters accessible via the standard PortletRequest methods.- 指定者:
resolveMultipart
在接口中PortletMultipartResolver
- 参数:
request
- the portlet request to wrap (must be of a multipart content type)- 返回:
- the wrapped portlet request
- 抛出:
MultipartException
- if the portlet request is not multipart, or if implementation-specific problems are encountered (such as exceeding file size limits)- 另请参阅:
MultipartRequest.getFile(java.lang.String)
,MultipartRequest.getFileNames()
,MultipartRequest.getFileMap()
,PortletRequest.getParameter(java.lang.String)
,PortletRequest.getParameterNames()
,PortletRequest.getParameterMap()
parseRequest
protected CommonsFileUploadSupport.MultipartParsingResult parseRequest(ActionRequest request) throws MultipartException
Parse the given portlet request, resolving its multipart elements.- 参数:
request
- the request to parse- 返回:
- the parsing result
- 抛出:
MultipartException
- if multipart resolution failed.
determineEncoding
protected String determineEncoding(ActionRequest request)
Determine the encoding for the given request. Can be overridden in subclasses.The default implementation checks the request encoding, falling back to the default encoding specified for this resolver.
- 参数:
request
- current portlet request- 返回:
- the encoding for the request (never
null
) - 另请参阅:
ClientDataRequest.getCharacterEncoding()
,CommonsFileUploadSupport.setDefaultEncoding(java.lang.String)
cleanupMultipart
public void cleanupMultipart(MultipartActionRequest request)
从接口复制的说明:PortletMultipartResolver
Cleanup any resources used for the multipart handling, such as storage for any uploaded file(s).- 指定者:
cleanupMultipart
在接口中PortletMultipartResolver
- 参数:
request
- the request to cleanup resources for