POST數(shù)據(jù)過大時(shí),JAVA后端會(huì)無法收到,收到的數(shù)據(jù)為null,導(dǎo)致程序異常。此時(shí)需要進(jìn)行配置修改,tomcat的版本大于等于8,設(shè)置maxPostSize=“104857600” 表示post參數(shù)最大100MB;設(shè)置maxPostSize=“-1” 表示無限大(設(shè)置為復(fù)數(shù)即可);設(shè)置maxPostSize=“0” 表示不允許接收。不設(shè)置表示默認(rèn)大小為2MB
需要在節(jié)點(diǎn)增加該配置即可:
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
maxParameterCount="1000"
maxPostSize="-1"
/>