cancel
Showing results for 
Search instead for 
Did you mean: 

CAP Java oData Service does not support forward slash in HTTP Requests

former_member708468
Participant
0 Kudos

Dear SAP Community,

I created a simple cds entity with one key:

entity Documents {
key objectNumber : String(22);
lastCalled : DateTime;
}

Then I stored some values, like so:

{
   "objectNumber": "1000/00225/0001/01",
   "lastCalled": "2022-03-07T08:22:35Z"
}

Then I tried to use a GET HTTP Request like so:

GET http://localhost:8080/api/docservice/Documents('1000/00225/0001/01')

As a result of this request I get a 400 Bad Request. I tried to double escape the forward slashes with %252F, but then I get:

org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL contained a potentially malicious String "%25"

I researched the problem further and found this link
https://issues.oasis-open.org/browse/ODATA-1033, which suggests the following: "Services that support forward-slash in key values MUST support passing key values as parameters."


Similar question can be found here:
https://answers.sap.com/questions/13038318/cap-java-odata-string-as-odata-key-causes-problems.html

Can anybody suggest a solution for this problem? I am thinking right now to base64 encode the key and use its value as parameter.

Kind regards,
Vsevolod

Accepted Solutions (0)

Answers (0)