Package ubic.gemma.web.util.upload
Class CommonsMultipartMonitoredResolver
- java.lang.Object
-
- ubic.gemma.web.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 Constructor Description CommonsMultipartMonitoredResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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.void
setServletContext(javax.servlet.ServletContext servletContext)
-
-
-
Method Detail
-
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:
FileUploadBase.setSizeMax(long)
-
setServletContext
public void setServletContext(javax.servlet.ServletContext servletContext)
- Specified by:
setServletContext
in interfaceorg.springframework.web.context.ServletContextAware
-
determineEncoding
protected String determineEncoding(javax.servlet.http.HttpServletRequest 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.- Parameters:
request
- current HTTP request- Returns:
- the encoding for the request (never
null
) - See Also:
ServletRequest.getCharacterEncoding()
-
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
-
-