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 voidcleanupMultipart(org.springframework.web.multipart.MultipartHttpServletRequest request)protected StringdetermineEncoding(javax.servlet.http.HttpServletRequest request)Determine the encoding for the given request.booleanisMultipart(javax.servlet.http.HttpServletRequest request)protected org.apache.commons.fileupload.servlet.ServletFileUploadnewFileUpload(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.MultipartHttpServletRequestresolveMultipart(javax.servlet.http.HttpServletRequest request)voidsetMaxUploadSize(long maxUploadSize)Set the maximum allowed size (in bytes) before uploads are refused. -1 indicates no limit (the default).voidsetServletContext(javax.servlet.ServletContext servletContext)
-
-
-
Method Detail
-
cleanupMultipart
public void cleanupMultipart(org.springframework.web.multipart.MultipartHttpServletRequest request)
- Specified by:
cleanupMultipartin interfaceorg.springframework.web.multipart.MultipartResolver
-
isMultipart
public boolean isMultipart(javax.servlet.http.HttpServletRequest request)
- Specified by:
isMultipartin 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:
resolveMultipartin 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:
setServletContextin 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
-
-