Class CommonsMultipartMonitoredResolver
java.lang.Object
ubic.gemma.web.controller.util.upload.CommonsMultipartMonitoredResolver
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.web.context.ServletContextAware
,org.springframework.web.multipart.MultipartResolver
public class CommonsMultipartMonitoredResolver
extends Object
implements org.springframework.web.multipart.MultipartResolver, org.springframework.web.context.ServletContextAware
An adaptation of the standard Spring CommonsMultipartResolver that uses a MonitoredOutputStream. This allows
asynchronous client-side monitoring of the upload process.
- Author:
- pavlidis
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanupMultipart
(org.springframework.web.multipart.MultipartHttpServletRequest request) protected String
determineEncoding
(javax.servlet.http.HttpServletRequest request) Determine the encoding for the given request.boolean
isMultipart
(javax.servlet.http.HttpServletRequest request) protected org.apache.commons.fileupload.servlet.ServletFileUpload
newFileUpload
(javax.servlet.http.HttpServletRequest request) Create a factory for disk-based file items with a listener we can check for progress.org.springframework.web.multipart.MultipartHttpServletRequest
resolveMultipart
(javax.servlet.http.HttpServletRequest request) void
setMaxUploadSize
(long maxUploadSize) Set the maximum allowed size (in bytes) before uploads are refused. -1 indicates no limit (the default).void
setServletContext
(javax.servlet.ServletContext servletContext)
-
Constructor Details
-
CommonsMultipartMonitoredResolver
public CommonsMultipartMonitoredResolver()
-
-
Method Details
-
cleanupMultipart
public void cleanupMultipart(org.springframework.web.multipart.MultipartHttpServletRequest request) - Specified by:
cleanupMultipart
in interfaceorg.springframework.web.multipart.MultipartResolver
-
isMultipart
public boolean isMultipart(javax.servlet.http.HttpServletRequest request) - Specified by:
isMultipart
in interfaceorg.springframework.web.multipart.MultipartResolver
-
resolveMultipart
public org.springframework.web.multipart.MultipartHttpServletRequest resolveMultipart(javax.servlet.http.HttpServletRequest request) throws org.springframework.web.multipart.MultipartException - Specified by:
resolveMultipart
in interfaceorg.springframework.web.multipart.MultipartResolver
- Throws:
org.springframework.web.multipart.MultipartException
-
setMaxUploadSize
public void setMaxUploadSize(long maxUploadSize) Set the maximum allowed size (in bytes) before uploads are refused. -1 indicates no limit (the default).- Parameters:
maxUploadSize
- the maximum upload size allowed- See Also:
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext) - Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
determineEncoding
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.- Parameters:
request
- current HTTP request- Returns:
- the encoding for the request (never
null
) - See Also:
-
newFileUpload
protected org.apache.commons.fileupload.servlet.ServletFileUpload newFileUpload(javax.servlet.http.HttpServletRequest request) Create a factory for disk-based file items with a listener we can check for progress.- Parameters:
request
- request- Returns:
- the new FileUpload instance
-