当前位置:网站首页>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
边栏推荐
- [C题目]力扣206. 反转链表
- Software testing -- 1. Outline of software testing knowledge
- Gson and fastjson
- BigDecimal rounds the data
- MySQL 45 talks about | 06 global locks and table locks: Why are there so many obstacles to adding a field to a table?
- Thymeleaf notes
- Educational Codeforces Round 132 (Rated for Div. 2) C,D+AC自动机
- Kibana operation es
- 关于RDBMS和非RDBMS【数据库系统】
- 43 盒子模型
猜你喜欢

河源市区推出消防安全主题奶茶 助推夏季火灾防控

L1 and L2 regularization

AS查看依赖关系和排除依赖关系的办法
![[MySQL series] - how much do you know about the index](/img/d7/5045a846580be106e2bf16d7b30581.png)
[MySQL series] - how much do you know about the index

Gonzalez Digital Image Processing Chapter 1 Introduction

27 classification of selectors

Gameframework making games (II) making UI interface

String type time comparison method with error string.compareto

51 single chip microcomputer learning notes (2)

Live classroom system 05 background management system
随机推荐
C language and SQL Server database technology
LeetCode_ String_ Medium_ 151. Reverse the words in the string
27 classification of selectors
35 quick format code
解决asp.net上传文件时文件太大导致的错误
变分(Calculus of variations)的概念及运算规则
Application practice: Great integrator of the paddy classification model [paddlehub, finetune, prompt]
优质数对的数目[位运算特点+抽象能力考察+分组快速统计]
System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏
Ten common application scenarios of redis
Realsense ROS installation configuration introduction and problem solving
pkg_resources动态加载插件
Go语言创始人从Google离职
SSM framework integration, simple case
006操作符简介
Several methods of spark parameter configuration
oracle_12505错误解决方法
32 chrome调试工具的使用
QObject source code analysis -d pointer and Q pointer
How many ways can you assign initial values to a two-dimensional array?