jetty post 提交的数据太大
jetty容器,post 提交数据时,报java.lang.IllegalStateException: Form too large: 44 > 10异常
·
jetty容器,post 提交数据时,报java.lang.IllegalStateException: Form too large: 44 > 10 异常;
原因:jetty容器对提交的数据进行了限制,默认为200000 bytes(约2K)。(上面异常为了测试效果,已改成了10)
解决:在工程的WEB-INF下添加jetty-web.xml 文件,并配置如下:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN"
"http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<!-- Max Form Size -->
<Set name="maxFormContentSize">10</Set>
</Configure>
把maxFormContentSize设置为0 ,即不限制。
jetty 9.x适用,从网上查到其他8.x, 7.x版本好像是设置为-1。9.x设置为-1仍以200000 为默认值。
参考:http://www.eclipse.org/jetty/documentation/current/setting-form-size.html
更多推荐
已为社区贡献1条内容
所有评论(0)