java - Spring how to handle # in REST URL -


i have spring application

which has url of format

{url}/locations/usa#ca#92121

i want 'usa#ca#92121' 1 parameter in rest controller .. how can achieve that?

currently giving "usa" when use @pathvariable

your url need url encoded. can use urlencoder in java 8 this.

see java url encoding of query string parameters

basically

string q = "random word £500 bank $"; string url = "http://example.com/query?q=" + urlencoder.encode(q, "utf-8"); 

Comments