November 7, 2007

Websphere requestURL with ? in path

I was trying to use friendly URLs in Websphere where the path includes encoded ‘?’ (Hex %3F). Calling HTTPServletRequest.getRequestURL() on Websphere only returns the path up to the first %3F.

This means that the value returned for a URL such as http://myserver/mypage/what-u-say%3F/id/123/videodetail.do would be http://myserver/mypage/what-u-say .

It looks like this method is performing the decoding before doing the parsing. (See this bug fix from IBM http://preview.tinyurl.com/2oozxl ). I’ve worked round this one by manually encoding ‘?’ in the URL path to qmark.