title: How to use java.net.URI
body: <p>I've tried to use java.net.URI to manipulate query strings but I failed to even on very simple task like getting the query string from one url and placing it in another.</p>
  
  <p>Do you know how to make this code below work</p>
  
  <pre><code>URI sample = new URI("test?param1=x%3D1");
  URI uri2 = new URI(
              "http",
              "domain",
              "/a-path",
              sample.getRawQuery(),
              sample.getFragment());
  </code></pre>
  
  <p>Call to <code>uri2.toASCIIString()</code> should return: <code>http://domain/a-path?param1=x%3D1</code>
  but it returns: <code>http://domain/a-path?param1=x%253D1</code> (double encoding)</p>
  
  <p>if I use getQuery() instead of getRawQuery() the query string is not encoded at all and the url looks like this: <code>http://domain/a-path?param1=x=1</code></p>