Handling Plus Sign (+) bit tricky - It is a puzzle to solve

Viewed 16

I have a query where i pass a string and the string can comes with plus value in front of the value.

  1. Passed plus sign (+) in front of a parameter value. Browser ignored it and received value in REST API without plus sign and with/without spaces
  2. Changed Plus sign (+) or space as %2b in the incoming value after the value is received, however it converted all the spaces in the value as + or space can be in the middle or anywhere of the value
  3. Written a custom wrapper which extends HttpServletRequestWrapper and changed the parameter value from space or plus with (%2b) for the first occurences of Plus Sign (+), however when it hits the REST API, it converts the plus as space again

How to get the actual value in REST API without any issues?

Example

http://localhost:8080/trial/end?key=++123++
http://localhost:8080/trial/end?key=123
http://localhost:8080/trial/end?key=123++
http://localhost:8080/trial/end?key=++123+Abc+

Thanks.

0 Answers
Related