当前位置:网站首页>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
边栏推荐
- 冈萨雷斯 数字图像处理 第一章绪论
- Login of MySQL [database system]
- PHP 通过原生CURL实现非阻塞(并发)请求模式
- Leetcode combination sum + pruning
- Go语言创始人从Google离职
- 物理量与单位符号的书写标准
- IP address classification, which determines whether a network segment is a subnet supernetwork
- [MySQL series] - how much do you know about the index
- SSH服务器拒绝了密码
- awk从入门到入土(21)awk脚本调试
猜你喜欢

LeetCode-198-打家劫舍

37 element mode (inline element, block element, inline block element)

Yarn: the file yarn.ps1 cannot be loaded because running scripts is prohibited on this system.

41 图片背景综合-五彩导航图

Syntax summary of easygui

51 single chip microcomputer learning notes (1)

Ssh server rejected password
![[MySQL must know and know] trigger | permission management](/img/59/cb805d972097a6a8ed7f3ae454a91d.png)
[MySQL must know and know] trigger | permission management

Client error: invalid param endpoint is blank

SSH服务器拒绝了密码
随机推荐
SSM framework integration, simple case
LeetCode_ Factorization_ Simple_ 263. Ugly number
(原创)自定义一个滚屏的RecyclerView
"Ask every day" what is volatile
How many ways can you assign initial values to a two-dimensional array?
Thymeleaf notes
SSM Advanced Integration
"Ask every day" briefly talk about JMM / talk about your understanding of JMM
39 简洁版小米侧边栏练习
[C题目]力扣876. 链表的中间结点
(original) customize a scrolling recyclerview
Qt connect 中, SIGNAL,SLOT 与 lambda 对比
Splice a field of the list set into a single string
Gameframework making games (II) making UI interface
45padding不会撑开盒子的情况
软件测试 -- 1 软件测试知识大纲梳理
spark参数调整调优
Ten common application scenarios of redis
System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏
[MySQL series] - how much do you know about the index