• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Configure Max File Size for 1 Action

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have one struts 2.3 action which should be permitted to have very large file uploads and all of the other actions have a much smaller max file upload limit.

The first thing that I tried was adding the following to the action:



However, my 2 MB test file was still rejected as being too large (the large number as a parameter is 500 MB).

The next thing that I tried was defining a completely new interceptor-stack like this:



I then switched the action to use this interceptor-stack:



However, my 2 MB test file was still rejected for being too large. The rejection was by Struts - not tomcat or the web server. I get the following struts action error:

"Request exceeded allowed size limit! Max size allowed is: 2,097,152 but request was: 2,631,140!"

Does anyone see what I did wrong in the configuration? Or how I should configure struts to let one action upload large files?

Thanks!
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The way I understand it, to set the maximum upload size and maximum file size for the entire application, one would declare (for a 1GB limit):



If you were going to configure the interceptor, the documentation says to do the following:


Note that the interceptor does not have properties named fileUpload.maximumSize (I've never seen that one) or struts.multipart.maximumSize (which is a Struts property, not an interceptor property)
I don't know for certain that doing both would allow the action to override the global setting, but the documentation seems to say that it can.
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic