在Spring Boot中强制对Http请求进行编码

时间:2019-01-03 06:52:51

标签: spring spring-boot

如果URL中的字符不安全,我的spring boot应用程序将返回400。

我需要强制执行UTF-8编码,以便我的Spring Boot应用程序可以对此类字符进行编码,然后传递请求。

我尝试在参数级别添加@Encoded注释,但这不能解决问题:

https://www.concretepage.com/webservices/resteasy-3/rest-web-service-jax-rs-encoded-annotation-example-with-resteasy-3

我想我需要启用此配置

spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true

作为Spring Boot的新手,我不确定该文件。我能在这方面找些方向吗?

0 个答案:

没有答案