Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Configure Max File Size for 1 Action  RSS feed

Posts: 1
  • Mark post as helpful
  • send pies
  • 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?

Posts: 9551
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!