当前位置:网站首页>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 !
边栏推荐
- Nowcodertop12-16 - continuous updating
- 第一个C语言程序(从Hello World开始)
- Esp8266 uses drv8833 drive board to drive N20 motor
- How to judge the performance of static code quality analysis tools? These five factors must be considered
- 工作面试总遇秒杀?看了京东T8大咖私藏的秒杀系统笔记,已献出膝盖
- LVS负载均衡之LVS-NAT与LVS-DR模式原理详解
- Let sports happen naturally, and fire creates a new lifestyle
- 爬虫基础一
- LVS负载均衡之LVS-DR搭建Web群集与LVS结合Keepalived搭建高可用Web群集
- Some errors of tensorflow calling multiple GPUs
猜你喜欢

Learn Luzhi PHP -- tp5.0 uses Chinese as an alias and reports "unsupported data expression"

一篇看懂:IDEA 使用scala 编写wordcount程序 并生成jar包 实测

SQL injection LESS18 (header injection + error injection)

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

Hcip experiment (03)

Nowcodertop1-6 - continuous updating

SQL language (6)

There is a newline problem when passing shell script parameters \r

Learn NLP with Transformer (Chapter 1)

SQL injection less23 (filter comment)
随机推荐
新能源销冠宏光MINIEV,有着怎样的产品力?
web移动端:touchmove实现局部滚动
Getting started with tensorflow
使用Three.js实现炫酷的赛博朋克风格3D数字地球大屏
A troubleshooting record of DirectShow playback problems
让运动自然发生,FITURE打造全新生活方式
shell-第六章练习
tensorflow入门
[动态规划] 70. 爬楼梯
Emmet syntax quick query syntax basic syntax part
Leetcode sword finger offer 27. image of binary tree
黑客入门教程(非常详细)从零基础入门到精通,看完这一篇就够了。
Filter过滤器解决request请求参数乱码的原理解析
SQL injection LESS18 (header injection + error injection)
SQL注入 Less23(过滤注释符)
全网显示 IP 归属地,是怎么实现的?
用Unity不会几个插件怎么能行?Unity各类插件及教程推荐
MLX90640 红外热成像仪测温模块开发笔记(五)
leetcode 剑指 Offer 27. 二叉树的镜像
Shell Chapter 7 exercise