title: How to "merge" two URIs in Java?
body: <p>This is an absolute URI of the server:</p>
  
  <pre><code>URI base = new URI("http://localhost/root?a=1");
  </code></pre>
  
  <p>This is a relative URI:</p>
  
  <pre><code>URI rel = new URI("/child?b=5");
  </code></pre>
  
  <p>Now I'm trying to apply relative one to the absolute and receive:</p>
  
  <pre><code>URI combined = base + rel; // somehow
  assert combined.equals(new URI("http://localhost/root/child?a=1&amp;b=5"));
  </code></pre>
  
  <p>Is it possible to do such a manipulation with JDK or some library?</p>