最近因项目安全漏洞,所以决定升级Jdk以及Tomcat。升级过程还算完美,环境也搭建OK,项目正常运行。
但是访问量上来以后,因为前台有保存图片到数据操作,所以总有用户反映保存失败。仔细研究后前台参数,以及抓包观察数据走
线情况,发现参数在前台存在,数据到主机也存在,但是从主机到应用这一步丢失参数。所以研究Tomcat参数配置。
找到server.xml 观察
发现 tomcat6.0的文档里说maxPostSize不限制的设置是小于等于0
原话:The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The feature can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
tomcat7.0的文档里面说maxPostSize不限制的设置是小于0
原话:The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than zero. If not specified, this attribute is set to 2097152 (2 megabytes). Note that theFailedRequestFilter can be used to reject requests that exceed this limit.
所以把maxPostSize设置成“-1”,问题就得到了解决