Package ubic.gemma.web.util.upload
Class CommonsMultipartMonitoredResolver
- java.lang.Object
-
- ubic.gemma.web.util.upload.CommonsMultipartMonitoredResolver
-
- All Implemented Interfaces:
Aware
,ServletContextAware
,MultipartResolver
public class CommonsMultipartMonitoredResolver extends Object implements MultipartResolver, 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(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.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(MultipartHttpServletRequest request)
- Specified by:
cleanupMultipart
in interfaceMultipartResolver
-
isMultipart
public boolean isMultipart(javax.servlet.http.HttpServletRequest request)
- Specified by:
isMultipart
in interfaceMultipartResolver
-
resolveMultipart
public MultipartHttpServletRequest resolveMultipart(javax.servlet.http.HttpServletRequest request) throws MultipartException
- Specified by:
resolveMultipart
in interfaceMultipartResolver
- Throws:
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 interfaceServletContextAware
-
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
-
-