Custom converter for @RequestParam in Spring MVC

后端 未结 3 957
攒了一身酷
攒了一身酷 2021-02-07 20:20

I am getting an encrypted String as Query parameter to a Spring rest controller method.

I wanted to decrypt the string before it reaches the method based on some annotat

3条回答
  •  自闭症患者
    2021-02-07 21:11

    You can try by adding a CharacterEncodingFilter with init-param encoding UTF-8 in web.xml file. Check out this example.

    However If it still doesn't work, you can force encoding by adding the below param along with above init-param.

    
            forceEncoding
            true
    
    

    Let me know If It works for you.

提交回复
热议问题