getServletPath() returns a URL-decoded path while getRequestURL()
just returns the string as-is, creating an incorrect canonical URL
detection because of different URL parts lengths of encoded vs. decoded.
That problem arises when gerrit.canonicalWebUrl is empty and the
canonical URL is obtained by checking the request URL minus the Servlet
request Path.
Apply the URL decoding before trimming the request URL by the Servlet
path length, so that canonical URL can be reliable even when the request
URL contains URL-encoded fragments.
Example: the new UI login link includes the following URL-encoded
search URL (/q/status:open) which was causing an incorrect canonical
URL detection and consequently the inability to log in from PolyGerrit.
Bug: Issue 7036
Change-Id: Ibaadeb8b9a377dc1427d33d339a50a58e79012cf