org.jasig.springframework.web.portlet.upload
Class CommonsPortlet2MultipartResolver
java.lang.Object
org.springframework.web.multipart.commons.CommonsFileUploadSupport
org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver
org.jasig.springframework.web.portlet.upload.CommonsPortlet2MultipartResolver
- All Implemented Interfaces:
- org.springframework.beans.factory.Aware, org.springframework.web.portlet.context.PortletContextAware, org.springframework.web.portlet.multipart.PortletMultipartResolver
public class CommonsPortlet2MultipartResolver
- extends org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver
Since DispatcherPortlet does not permit multipart request resolving in a resource request phase and tinkering
DispatcherPortlet is a fragile task, typical usage of this resolver should look like this:
- Define it in web application context:
<bean id="portletMultipartResolver" class="org.springframework.web.multipart.commons.CommonsPortlet2MultipartResolver">
<property name="maxUploadSize" value="5242880"/>
</bean>
- Autowire multipart resolver instance in a portlet controller:
@Autowired
private CommonsPortlet2MultipartResolver multipartResolver;
- Use it:
if (this.multipartResolver.isMultipart(request)) {
MultipartRequest multipartRequest = (MultipartRequest) this.multipartResolver.resolveMultipart(request);
//... do something with multipart request
}
- Author:
- Arvīds Grabovskis
| Nested classes/interfaces inherited from class org.springframework.web.multipart.commons.CommonsFileUploadSupport |
org.springframework.web.multipart.commons.CommonsFileUploadSupport.MultipartParsingResult |
| Fields inherited from class org.springframework.web.multipart.commons.CommonsFileUploadSupport |
logger |
| Methods inherited from class org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver |
cleanupMultipart, determineEncoding, isMultipart, parseRequest, resolveMultipart, setPortletContext |
| Methods inherited from class org.springframework.web.multipart.commons.CommonsFileUploadSupport |
cleanupFileItems, getDefaultEncoding, getFileItemFactory, getFileUpload, isUploadTempDirSpecified, newFileItemFactory, parseFileItems, prepareFileUpload, setDefaultEncoding, setMaxInMemorySize, setMaxUploadSize, setUploadTempDir |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CommonsPortlet2MultipartResolver
public CommonsPortlet2MultipartResolver()
setResolveLazily
public void setResolveLazily(boolean resolveLazily)
- Overrides:
setResolveLazily in class org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver
isMultipart
public boolean isMultipart(javax.portlet.ResourceRequest request)
resolveMultipart
public MultipartResourceRequest resolveMultipart(javax.portlet.ResourceRequest request)
throws org.springframework.web.multipart.MultipartException
- Throws:
org.springframework.web.multipart.MultipartException
parseRequest
protected org.springframework.web.multipart.commons.CommonsFileUploadSupport.MultipartParsingResult parseRequest(javax.portlet.ResourceRequest request)
throws org.springframework.web.multipart.MultipartException
- Throws:
org.springframework.web.multipart.MultipartException
determineEncoding
protected String determineEncoding(javax.portlet.ResourceRequest request)
cleanupMultipart
public void cleanupMultipart(MultipartResourceRequest request)
newFileUpload
protected org.apache.commons.fileupload.FileUpload newFileUpload(org.apache.commons.fileupload.FileItemFactory fileItemFactory)
- Overrides:
newFileUpload in class org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver
Copyright © 2013 Jasig. All Rights Reserved.