I am developing an App where I am sending get request to REST web service using 
@RequestMapping(value = "myURLpattern", method = RequestMethod.GET, produces = "image/png")
I came across a bug if somebody enters # in the URL query String it breaks from there
http://myserver.com:8080/csg?x=1&y=2#4&z=32&p=1
So I tried to encode it via filter HTTPRequestWrapper so that # will be replaced by %23 using URLEncoder.
My problem is for encoding URL, first I need to read the URL(request.getRequestURL()).
and getURL again can't read string after #.
request.getRequestURL() will return only (http://myserver.com:8080/csg?x=1&y=2) 
Is there any other way to parse the complete url and encode it before sending to REST web service?