Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Properties can be set by putting a actionstruts.properties file in WEB-INF/classes. Any property found in the properties file will override the default value.

  1. actionstruts.multipart.parser - This property should be set to a class that extends MultiPartRequest. Currently, the framework ships with two implementations. org.struts.apache.action2struts2.dispatcher.multipart.PellMultiPartRequest and org.struts.apache.action2struts2.dispatcher.multipart.CosMultiPartRequest. If the property is not found the Pell parser is used.
  2. actionstruts.multipart.saveDir - The directory where the uploaded files will be placed. If this property is not set it defaults to javax.servlet.context.tempdir.
  3. actionstruts.multipart.maxSize - The maximum file size in bytes to allow for upload. This helps prevent system abuse by someone uploading lots of large files. The default value is 2 Megabytes and can be set as high as 2 Gigabytes (higher if you want to edit the Pell multipart source but you really need to rethink things if you need to upload files larger then 2 Gigabytes!) If you are uploading more than one file on a form the maxSize applies to the combined total, not the individual file sizes.

If you're happy with the defaults, there is no need to put any of the properties in actionstruts.properties.

Code Block
titleactionstruts.properties
# put the uploaded files in /tmp. My application will move them to their
# final destination
actionstruts.multipart.saveDir=/tmp

Note, while you can set these properties to new values at runtime the MultiPartRequestWrapper is created and the file handled before your Action code is called. So if you want to change values you must do so before this Action.

...