当前位置:网站首页>When using jetty to run items, an error is reported: form too large or form too many keys
When using jetty to run items, an error is reported: form too large or form too many keys
2022-07-25 15:00:00 【Hua Weiyun】
use Jetty As a server Web Project time ,Form If the submitted data is too large, the following two errors will be reported :
java.lang.IllegalStateException: Form too large 205685>200000java.lang.IllegalStateException: Form too many keysUnder the baidu , The two anomalies found are
jettyThrow the jetty LimitFormThe size of the submitted data , The source class comes fromjetty libUnder the Treasuryjetty-server-7.6.16.v20140903.jarUnder bagorg.eclipse.jetty.server.Requestclass .jettyLimitformThe largest number of submitted data size And the biggest keys Count , You can see in the code ,jettyDefaultmaxFormContentSizeby200000,maxFormKeysby1000; And if the data we submit exceeds these two values , It's the two aboveJavaabnormal .
Jetty There are two ways to solve this problem , Choose one of them :
1. modify Jetty Of jetty.xml file ,jetty.xml The file in jetty In the root directory etc Catalog , stay jetty.xml Add the following configuration... To the file :
<Call name="setAttribute"> <Arg>org.eclipse.jetty.server.Request.maxFormContentSize</Arg> <Arg>-1</Arg></Call> <Call name="setAttribute"> <Arg>org.eclipse.jetty.server.Request.maxFormKeys</Arg> <Arg>-1</Arg></Call>maxFormContentSize The default is 200000,maxFormKeys yes 1000, We just need to change these two values to the maximum value we need , Another value is to set both values to less than 0 Any value , It's usually -1, Means unrestricted Form The size of the submitted data .
2. stay web In the project WEB-INF Create a new folder jetty-web.xml file , stay jetty-web.xml Add the following to the file :
<?xml version="1.0”encoding="UTF-8"?><!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN""http://jetty.mortbay.org/configure.dtd"><Configure id="WebAppContext" class="org.eclipse.jetty.webapp.WebAppContext"> <Set name="maxFormContentSize">200000</Set> <Set name="maxFormKeys">1000</Set></Configure>| take maxFormContentSize and maxFormKeys Change the value of to the value you want .
3.Spring Boot Project configuration :
stay application.yml or application.properties or bootstrap.yml or bootstrap.properties Configure the following methods in :
propertiesConfiguration mode#POST Form length limit (5MB)server.jetty.max-http-post-size=5000000ymlConfiguration mode#POST Form length limit (5MB)server: jetty: max-http-post-size:5000000
边栏推荐
- QObject source code analysis -d pointer and Q pointer
- "Ask every day" how locksupport realizes thread waiting and wakeup
- 阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
- Gameframework making games (II) making UI interface
- 45padding不会撑开盒子的情况
- System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏
- Go language founder leaves Google
- Gson and fastjson
- Software testing -- 1. Outline of software testing knowledge
- "Ask every day" briefly talk about JMM / talk about your understanding of JMM
猜你喜欢

I2C device driver hierarchy

L1和L2正则化

51 single chip microcomputer learning notes (2)

"Ask every day" briefly talk about JMM / talk about your understanding of JMM

06. Neural network like

32 use of chrome debugging tools

oracle_12505错误解决方法

The solution to the problem that the progress bar of ros2 installation connext RMW is stuck at 13%

51单片机学习笔记(2)

云安全技术发展综述
随机推荐
pl/sql 创建并执行oralce存储过程,并返回结果集
String type time comparison method with error string.compareto
(original) customize a scrolling recyclerview
44 Sina navigation, Xiaomi sidebar exercise
Gameframework making games (II) making UI interface
"How to use" agent mode
MySQL 45 talks about | 06 global locks and table locks: Why are there so many obstacles to adding a field to a table?
Gonzalez Digital Image Processing Chapter 1 Introduction
[C题目]力扣206. 反转链表
How many ways can you assign initial values to a two-dimensional array?
SSH服务器拒绝了密码
各种平台dpkg包下载地址(包括arm64)
Go语言创始人从Google离职
[MySQL series] - how much do you know about the index
kibana操作es
EDA chip design solution based on AMD epyc server
I hope some suggestions on SQL optimization can help you who are tortured by SQL like me
Ssh server rejected password
阿里云技术专家邓青琳:云上跨可用区容灾和异地多活最佳实践
27 选择器的分类