简体   繁体   English

如何从java struts 1.1应用程序覆盖Tomcat的xml文件属性。 特别是maxPostSIze

[英]How to over write Tomcat's xml file properties from java struts 1.1 application. Specifically maxPostSIze

I am trying to upload a file through my JAVA Struts 1.1 Application. 我正在尝试通过我的JAVA Struts 1.1应用程序上传文件。 Using the Tomcat Server. 使用Tomcat服务器。 The problem I was facing was : file size was greater than the default size of the Tomcat allowed size. 我面临的问题是:文件大小大于Tomcat允许大小的默认大小。 So we need to change the "maxPostSize" parameter of server.xml 因此,我们需要更改server.xml的“ maxPostSize”参数

After changing the maxPostSize and the connectionTimeout in Server.xml, the issue is resolved. 在Server.xml中更改maxPostSize和connectionTimeout之后,此问题已解决。 However what if we do not have the permission to make changes to server.xml 但是,如果我们没有权限更改server.xml,该怎么办

Is there a way around for this through Java code. 是否有办法通过Java代码解决此问题。 Any way by which we can overwrite the "maxPostSize" parameter of server.xml any way I can cofigure my application to ignore the Tomcat Size and take the specified size limit. 我们可以通过任何方式将应用程序配置为忽略Tomcat大小并采用指定的大小限制的任何方式来覆盖server.xml的“ maxPostSize”参数。

Please Help! 请帮忙!

Please check your controller (in struts-config) has something like this (I think it's optional actually), 请检查您的控制器(在struts-config中)是否具有类似内容(我认为它实际上是可选的),

<controller
maxFileSize="300K" />

change size and check whether it is working or not. 更改大小并检查其是否正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM