Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3.3, 2.4
-
None
Description
ServletController.getBaseURL uses HttpServletRequest.getPathInfo() to determine the base URL.
For example, given 'http://localhost:8080/services/1' and the pathInfo equal to '/1' the base URL is 'http://localhost:8080/services'.
The problem with using the getPathInfo in the substring calculation is that it loses matrix parameters on the last path segment, ex, given 'http://localhost:8080/services/1;a=b' which will be reported by request.getRequestURL, the getPathInfo will report "/1" only and thus the base URL will be wrong. To bypass this issue, the initial attempt was to decode request.getRequestURL and strip off the final matrix params if any and only then calculate the base path. This solution breaks with encoded %3B characters - besides it is also slow (decoding costs).
Another problem with getPathInfo() in that given that it returns the decoded value, the problem arise on some containers with requests URIs containing double encoded '/' symbols.
A simpler and more reliable solution is needed