When I try to upload a file that exceeds the configured 2M max then no
parameters get set on my action.

I can't present the user with a pretty error message since all context is
missing without the rest of the parameters.

The file upload is part of a form post that include a bunch of other
parameters my app needs to understand the context of the request.

I've spent all morning in the debugger, the ParametersInterceptor is being
called but the ActionContext.getParameters() is returning null.

It appears that when
org.apache.commons.fileupload.servlet.ServletFileUpload throws
SizeLimitExceededException all parameter parsing is aborted and the multi
part request wrapper thinks there are no parameters.

Is this expected behavior?

Can anyone help?

Greg

Struts 2.3.16.3


2014-05-09 11:28:40,085 WARN
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest:64 -
Request exceeded size limit!
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException:
the request was rejected because its size (18652294) exceeds the configured
maximum (2097152)
    at
org.apache.commons.fileupload.FileUploadBase$FileItemIteratorImpl.<init>(FileUploadBase.java:965)
    at
org.apache.commons.fileupload.FileUploadBase.getItemIterator(FileUploadBase.java:310)
    at
org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:334)
    at
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.parseRequest(JakartaMultiPartRequest.java:189)
    at
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.processUpload(JakartaMultiPartRequest.java:127)
    at
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequest.parse(JakartaMultiPartRequest.java:92)
    at
org.apache.struts2.dispatcher.multipart.MultiPartRequestWrapper.<init>(MultiPartRequestWrapper.java:81)
    at
org.apache.struts2.dispatcher.Dispatcher.wrapRequest(Dispatcher.java:803)
    at
org.apache.struts2.dispatcher.ng.PrepareOperations.wrapRequest(PrepareOperations.java:134)
    at
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter.doFilter(StrutsPrepareFilter.java:88)

Reply via email to