tomcat7以上,设置maxPostSize="0"参数后台获取不到的问题

遇到两次这个问题,记录一下。
登录的时候后台获取不到验证码,本地环境是tomcat7.32,服务器是tomcat7.82,一样的配置,本地没有发生这样的情况。查询资料发现tomcat7配置的时候,把maxPostSize=”0”的配置去掉的时候问题消失。

根据以往的经验,maxPostSize=”0”不就是不限制post数据的大小的么,怎么还反倒限制了数据的大小了呢?

因为项目里面要post一个数据到后台保存(大小可能大于2M),所以这大小就不能限制。

再后来在tomcat的官方文档里发现了这个maxPostSize的变动。

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”,问题就得到了解决

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值