How to build a URI using URIbuilder without encoding hash
<p>I have a URI like this:</p>

<p><code>java.net.URI location = UriBuilder.fromPath("../#/Login").queryParam("token", token).build();</code></p>

<p>and I am sending it as response: <code>return Response.seeOther(location).build()</code></p>

<p>However, in the above URI, <code>#</code> is getting encoded to <code>%23/</code>. How do I create a URI with out encoding the hash <code>#</code>. According to <a href="https://jersey.java.net/apidocs-javax.jax-rs/2.0.1/javax/ws/rs/core/UriBuilder.html" rel="noreferrer">official document</a>, a <code>fragment()</code> method must be used to keep unencoded. </p>

<blockquote>
  <p>URI templates are allowed in most components of a URI but their value
  is restricted to a particular component. E.g.</p>
  
  <blockquote>
    <p>UriBuilder.fromPath("{arg1}").build("foo#bar"); would result in
    encoding of the '#' such that the resulting URI is "foo%23bar". To
    create a URI "foo#bar" use
    UriBuilder.fromPath("{arg1}").fragment("{arg2}").build("foo", "bar") instead.</p>
  </blockquote>
</blockquote>

<p>Looking at the example from docs, I am not sure how to apply it in my case.</p>

<p>The final URI should look like this: </p>

<p><code>http://localhost:7070/RTH_Sample14/#Login?token=eyJhbGciOiJSUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvcnRoLmNvbSIsInN1YiI6IlJUSCIsInJvbGUiOiJVU0VSIiwiZXhwIjoxNDU2Mzk4MTk1LCJlbWFpbCI6Imtpcml0aS5rOTk5QGdtYWlsLmNvbSJ9.H3d-8sy1N-VwP5VvFl1q3nhltA-htPI4ilKXuuLhprxMfIx2AmZZqfVRUPR_tTovDEbD8Gd1alIXQBA-qxPBcxR9VHLsGmTIWUAbxbyrtHMzlU51nzuhb7-jXQUVIcL3OLu9Gcssr2oRq9jTHWV2YO7eRfPmHHmxzdERtgtp348</code></p>