- Spring Boot 2.0 Cookbook(Second Edition)
- Alex Antonov
- 171字
- 2021-06-24 19:24:40
Configuring custom servlet filters
In a real-world web application, we almost always find a need to add facades or wrappers to service requests, to log them, filter out bad characters for XSS, perform authentication, and so on. Out of the box, Spring Boot automatically adds OrderedCharacterEncodingFilter and HiddenHttpMethodFilter, but we can always add more. Let's see how Spring Boot helps us achieve this task.
Among the various assortments of Spring Boot, Spring Web, Spring MVC, and others, there is already a vast variety of different servlet filters that are available and all we have to do is define them as beans in the configuration. Let's say that our application will be running behind a load balancer proxy and we would like to translate the real request IP that is used by the users instead of the IP from the proxy when our application instance receives the request. Luckily, Apache Tomcat 8 already provides us with an implementation: RemoteIpFilter. All we will need to do is add it to our filter chain.
- 從零開(kāi)始學(xué)Hadoop大數(shù)據(jù)分析(視頻教學(xué)版)
- 企業(yè)大數(shù)據(jù)系統(tǒng)構(gòu)建實(shí)戰(zhàn):技術(shù)、架構(gòu)、實(shí)施與應(yīng)用
- 分布式數(shù)據(jù)庫(kù)系統(tǒng):大數(shù)據(jù)時(shí)代新型數(shù)據(jù)庫(kù)技術(shù)(第3版)
- 文本挖掘:基于R語(yǔ)言的整潔工具
- Python醫(yī)學(xué)數(shù)據(jù)分析入門
- MySQL 8.x從入門到精通(視頻教學(xué)版)
- 智慧的云計(jì)算
- 計(jì)算機(jī)組裝與維護(hù)(微課版)
- Mastering ROS for Robotics Programming(Second Edition)
- 云計(jì)算
- Scratch 2.0 Game Development HOTSHOT
- 從Lucene到Elasticsearch:全文檢索實(shí)戰(zhàn)
- Oracle 11g數(shù)據(jù)庫(kù)管理員指南
- 數(shù)據(jù)中臺(tái)實(shí)戰(zhàn):手把手教你搭建數(shù)據(jù)中臺(tái)
- 大數(shù)據(jù)隱私保護(hù)技術(shù)與治理機(jī)制研究