title: Getting unescaped servlet path from a HttpRequest object
body: <p>I have a custom proxy servlet that has to deal with URL-s that contain special characters (e.g. <code>; , . /</code> in their) in their path. This is because it is a RESTful application that has ugly path params by design. (Don't comment it as it is not mine.)</p>
  
  <p>My client, (actually <code>wget</code>, because browsers tend to show unescaped the URL) send a request to this URL:</p>
  
  <pre><code>http://localhost:8080/MyApplication/proxy/foo/ugly%3Apart%2Fcomes%3Bhere/children
  //note: %2F = '/', %3A = ':', %3B = ';'
  </code></pre>
  
  <p>In my servlet (mapped to <code>/proxy/*</code>) when I try to forward the GET request, I am unable to reconstruct it because <code>HttpRequest.getPathInfo()</code> returns me the URL unescaped:</p>
  
  <p><a href="http://localhost:8080/MyApplication/proxy/foo/ugly:part/comes;here/children" rel="nofollow">http://localhost:8080/MyApplication/proxy/foo/ugly:part/comes;here/children</a></p>
  
  <p>And therefore the information of which <code>/</code>s and <code>;</code>s were originally escaped or unescaped is lost. And that makes a difference for me, for example ; makes my URL a so called matrix URL, see <a href="http://www.w3.org/DesignIssues/MatrixURIs.html" rel="nofollow">http://www.w3.org/DesignIssues/MatrixURIs.html</a>, or all the REST path parameters get shifted by slashes.</p>
  
  <p>Actually I found this issue on a Glassfish server, so I'm not sure if different application servers treat this differently or not. I found only this in the Servlet API:</p>
  
  <blockquote>
    <p>getPathInfo() Returns any extra path information associated with the
    URL the client sent when it made this request.</p>
  </blockquote>
  
  <p>How could I get the original, unescaped request URL that was sent by the client?</p>