post请求的时候数据太长导致报错,特别是用base64编码上传图片的时候经常遇到这个问题
不同版本tomcat设置
tomcat 7.0.63之前的版本
<Connector maxPostSize="0"
tomcat 7.0.63之后(包含)的版本
<Connector maxPostSize="-1"
maven中配置的tomcat设置
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<hostName>localhost</hostName> <!-- Default: localhost -->
<port>8080</port> <!-- 启动端口 Default:8080 -->
<path>/api</path> <!-- 访问应用路径 Default: /${project.artifactId}-->
<uriEncoding>UTF-8</uriEncoding> <!-- uri编码 Default: ISO-8859-1 -->
<strong> <span style="color: #FF0000;"><maxPostSize>0</maxPostSize></span></strong>
</configuration>
</plugin>