允许在 struts2 中上传超过 2 GB 的文件
Allow more than 2 gb file upload in struts2
我在我的项目中使用 Struts 2.1。
在struts.xml我项目中的maxsize元素如下:
<constant name="struts.multipart.maxSize" value="2147483648" />
对于文件上传过程,
是否可以取代 Struts2 的正常 2 Gb 文件限制?
您应该迁移到最新版本的 Struts2。
从2.3.20
及更高版本开始,a new MulitpartRequest implementation 可以用于上传大文件:
Alternate Libraries
The struts.multipart.parser
used by the fileUpload interceptor to
handle HTTP POST requests, encoded using the MIME-type
multipart/form-data, can be changed out. Currently there are two
choices, jakarta and pell. The jakarta parser is a standard part of
the Struts 2 framework needing only its required libraries added to a
project. The pell parser uses Jason Pell's multipart parser instead of
the Commons-FileUpload library. The pell parser is a Struts 2 plugin,
for more details see:
http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html. There
was a third alternative, cos, but it was removed due to licensing
incompatibilities.
As from Struts version 2.3.18 a new implementation of MultiPartRequest
was added - JakartaStreamMultiPartRequest. It can be used to handle
large files, see WW-3025 for more details, but you can simple set
<constant name="struts.multipart.parser" value="jakarta-stream" />
> in struts.xml to start using it.
我在我的项目中使用 Struts 2.1。
在struts.xml我项目中的maxsize元素如下:
<constant name="struts.multipart.maxSize" value="2147483648" />
对于文件上传过程,
是否可以取代 Struts2 的正常 2 Gb 文件限制?
您应该迁移到最新版本的 Struts2。
从2.3.20
及更高版本开始,a new MulitpartRequest implementation 可以用于上传大文件:
Alternate Libraries
The
struts.multipart.parser
used by the fileUpload interceptor to handle HTTP POST requests, encoded using the MIME-type multipart/form-data, can be changed out. Currently there are two choices, jakarta and pell. The jakarta parser is a standard part of the Struts 2 framework needing only its required libraries added to a project. The pell parser uses Jason Pell's multipart parser instead of the Commons-FileUpload library. The pell parser is a Struts 2 plugin, for more details see: http://cwiki.apache.org/S2PLUGINS/pell-multipart-plugin.html. There was a third alternative, cos, but it was removed due to licensing incompatibilities.As from Struts version 2.3.18 a new implementation of MultiPartRequest was added - JakartaStreamMultiPartRequest. It can be used to handle large files, see WW-3025 for more details, but you can simple set
<constant name="struts.multipart.parser" value="jakarta-stream" />
> in struts.xml to start using it.