当前位置:网站首页>The principle analysis of filter to solve the request parameter garbled code
The principle analysis of filter to solve the request parameter garbled code
2022-07-25 11:34:00 【Hard CLZ】
This article is about SpringMVC appear request Solution to the problem of request parameter garbled Blog “ Solutions 1” Principle analysis of , Personally, I think it is very helpful to understand the principles behind some simple technologies for personal programming .
If there is request Friends who ask for parameter garbled problems can check the blog I mentioned above , I hope that's helpful !
1、 Get into CharacterEncodingFilter.class

2、CharacterEncodingFilter Inherited structure diagram
It can be seen that CharacterEncodingFilter My great grandfather was Filter


3、doFilter( ) Method
Let's focus on Filter Interface doFilter( ) Implementation of method :
doFilter( ) Method in OncePerRequestFilter To realize :
The key :doFilter( ) The method is implemented doFilterInternal( ), and doFilterInternal( ) The implementation of the method is OncePerRequestFilter Subclasses of CharacterEncodingFilter To realize .
I went around and back to CharacterEncodingFilter The class , Look at the key code :
4、 In retrospect web.xml Configuration information in

5、CharacterEncodingFilter Properties in a class
View the source code ,CharacterEncodingFilter Class has three properties , And found that whether there is a parameter or no parameter construction method forceRequestEncoding、
forceResponseEncoding The initial values of these two attributes are false. The main purpose of the following is to explain why it should be changed to ture?
6、 Key code

1、 We are web.xml Set up inside. encoding by UTF-8, So the value is not empty .
2、 We are web.xml Set up inside. forceRequestEncoding、forceResponseEncoding Two Boolean The value is true, therefore if Statement can be executed
That's ok .
3、 Separately request、response The encoding of is set to encoding, That is to say UTF-8.
Here we are , End of analysis !
边栏推荐
- 常见WEB攻击与防御
- SQL injection less17 (error injection + subquery)
- leetcode 剑指 Offer 27. 二叉树的镜像
- [IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training
- Web mobile terminal: touchmove realizes local scrolling
- Emmet syntax quick query syntax basic syntax part
- web移动端:touchmove实现局部滚动
- Dataframe print ellipsis problem
- Shell - Chapter 8 exercise
- 使用Three.js实现炫酷的赛博朋克风格3D数字地球大屏
猜你喜欢

活动报名 | 玩转 Kubernetes 容器服务提高班正式开营!

How can you use unity without several plug-ins? Unity various plug-ins and tutorial recommendations

2022 年中回顾|一文看懂预训练模型最新进展

Stm32cubemx learning record -- installation, configuration and use

C# Newtonsoft. Jason advanced usage

Leetcode sword finger offer 27. image of binary tree

学习路之PHP--Phpstudy 提示 Mysqld.Exe: Error While Setting Value ‘NO_ENGINE_SUBSTITUTION 错误的解决办法

ArcMap cannot start the solution

Leetcode sword finger offer 28. symmetric binary tree
苹果美国宣布符合销售免税假期的各州产品清单细节
随机推荐
Nowcodertop7-11 - continuous updating
贪心问题01_活动安排问题
LVS load balancing lvs-dr builds Web Clusters and LVS combines with kept to build highly available Web Clusters
Shell Chapter 5 homework
ESP8266 使用 DRV8833驱动板驱动N20电机
[IJCAI 2022] parameter efficient large model sparse training method, which greatly reduces the resources required for sparse training
[树] 100. 相同的树
Detailed explanation of the implementation method of DNS separation and resolution
feign客户端请求之LoadBalancerLifecycle生命周期
Syncronized lock upgrade process
新能源销冠宏光MINIEV,有着怎样的产品力?
Some usages of beautifulsoup
[recursion] 938. Range and of binary search tree
The most complete detailed tutorial on importing ad into lichuanyuan device packaging Library in history (always white and always cool)
从宏观到微观 零基础 详解bert
[tree] 100. Same tree
如何判断静态代码质量分析工具的性能?这五大因素必须考虑
谣言检测文献阅读十一—Preventing rumor spread with deep learning
NowCoderTOP1-6——持续更新ing
SQL language (III)