迁移到struts 2.3.24后,文件上传仍然不支持大于2GB [英] After migration to struts 2.3.24, file upload still not supported for greater than 2gb
问题描述
在struts2.3.24中添加如下的struts.xml:
Adding the following the to struts.xml in struts2.3.24:
<constant name="struts.multipart.parser" value="jakarta-stream" />
<constant name="struts.multipart.maxSize" value="3147483648" />
作为参考,上传在jsp中工作如下:
For reference the upload works as follows in the jsp:
<s:form id="uploadData" action="abc_UploadAction?method=Upload" namespace="xyz" validateFields="false" method="post" enctype="multipart/form-data">
对于动作映射,我们使用DMI的概念。操作配置如下:
For action mapping we use the concept of DMI. The action configuration is as follows:
<action name="abc_*" class="ABCAction">
<result type="chain">invoke_${module}_{1}_${method}</result>
</action>
但是对于大于2GB的大文件,文件上传仍然不起作用。但是,上面的代码工作正常,为较小的大小上传,
But file upload still not working for large files of greater than 2gb. But the above code works fine for lesser size uploads,
推荐答案
为什么你声明一个bean ,如果文档没有告诉你这样做?
Why are you declaring a bean, if the documentation is not telling you to do so ?
只要更改
Just change
<bean type="org.apache.struts2.dispatcher.multipart.MultiPartRequest" name="jakartaStream"
class="org.apache.struts2.dispatcher.multipart.JakartaStreamMultiPartRequest"
scope="default" />
<constant name="struts.multipart.parser" value="jakartaStream" />
到正确的配置,应该是(hyphenized,不是大写):
to the right configuration that should be (hyphenized, not capitalized):
<constant name="struts.multipart.parser" value="jakarta-stream" />
这篇关于迁移到struts 2.3.24后,文件上传仍然不支持大于2GB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!