on 2023 Nov 15 5:45 AM
Hi Colleagues,
I have a CAP service Entity MyService, primary keys are (id, displayed). It fails when I get as
localhost:8090/odata/v4/test/MyService(id=54642296-8b91-4145-a579-0e4d5a51cdb6,displayId='M-EUR/CNY-20210809')
The error message is 400: "The key value 'displayId' is invalid."
It might because of the slash in `displayId='M-EUR/CNY-20210809')` since it works without slash. So i replace / with %2F. But returns 400 from apache (not from cap service) Message Invalid URI: [The encoded slash character is not allowed].
I am wondering if in CAP there is an option to enable slash char handling?
Thanks!
Request clarification before answering.
Slashes need to be encoded, if they should not be handled as a actual path separator., but as a character of a path segment. However Spring Boot and Tomcat reject encoded slashes in URLs by default due to security concerns. You need to explicitly configure Spring Boot and Tomcat to allow encoded slashes in URLs:
You can find some hints here how to configure this correctly: https://stackoverflow.com/questions/13482020/encoded-slash-2f-with-spring-requestmapping-path-param-.... If you are using Tomcat 10 (CAP Java 2.0) make sure you take a look at this answer: https://stackoverflow.com/a/76128441
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
62 | |
8 | |
7 | |
7 | |
5 | |
5 | |
5 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.