2

If I have unsafe character in URL, my spring boot application returns 400.

I need to enforce UTF-8 encoding so that my spring boot application can encode such characters and then pass the request.

I tried adding @Encoded annotation at parameter level but this did not fix the issue:

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

I guess I need to enable this config

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

Being new to spring boot, I am not sure of the file. Could I please get some direction on this?

systemdebt
  • 4,589
  • 10
  • 55
  • 116
  • 1
    Possible duplicate of [spring boot interceptor to check request params for any unsafe characters and handle them](https://stackoverflow.com/questions/54035253/spring-boot-interceptor-to-check-request-params-for-any-unsafe-characters-and-ha) – smilyface Jan 04 '19 at 12:22
  • Are you asking where you must define such configuration ? If yes it is typically in `project-root/src/main/resources/config/application.properties`. – Adrien H Jan 04 '19 at 12:35
  • Yes. I did . Defined it there but spring application is still returning 400 because of unsafe characters in request params – systemdebt Jan 04 '19 at 12:36

0 Answers0