java.net.URISyntaxException: Illegal character in path at index 75
<p>I'm trying to send GET request from java through Apache REST client and encountered this issue.</p>

<blockquote>
  <p>java.net.URISyntaxException: Illegal character in path at index 75:
  <a href="http://torrento.sharepoint.com/_api/web/getfolderbyserverrelativeurl" rel="noreferrer">http://torrento.sharepoint.com/_api/web/getfolderbyserverrelativeurl</a>('/Shared
  Documents/test')/files    at java.net.URI$Parser.fail(URI.java:2848)
    at java.net.URI$Parser.checkChars(URI.java:3021)    at
  java.net.URI$Parser.parseHierarchical(URI.java:3105)  at
  java.net.URI$Parser.parse(URI.java:3053)  at
  java.net.URI.(URI.java:588)     at
  org.apache.http.client.utils.URIBuilder.(URIBuilder.java:82)    at
  com.mstack.samples.sharepoint.SharepointApp.getAllFiles(SharepointApp.java:61)
    at
  com.mstack.samples.sharepoint.SharepointApp.main(SharepointApp.java:45)</p>
</blockquote>

<p>Code snippet :-</p>

<pre><code>            httpClient = HttpClientBuilder.create().build();
            uriBuilder = new URIBuilder(requestUrl);
            System.out.println(uriBuilder);
            httpGet = new HttpGet(uriBuilder.build());
            httpGet.addHeader(AUTHORIZATION, "Bearer " + TOKEN);
            httpGet.addHeader("accept", "application/json; odata=verbose");
            response = httpClient.execute(httpGet);
</code></pre>

<p>Where requestUrl is <strong><code>http://torrento.sharepoint.com/_api/web/getfolderbyserverrelativeurl('/Shared Documents/test')/files</code></strong></p>

<p>I know the space between Shared and Documents is the issue. Tried to encode it. But that too didn't work. Please help</p>