title: Passing URI to REST API which will redirect it to processed URI
body: <p>I've exposed a REST API (GET).This will take relative URI and base URI as inputs and redirected to processed URI.
  How shall I pass this relativeURI or baseURI? relativeURI may have special characters like "&amp;"
  I can go with POST request with URIs in the body but I would prefect GET request.
  These might be amateur approaches </p>
  
  <p>Approach1: Using @RequestParam
  @RequestParam String relativeURI, @RequestParam String baseURI
  But the problem is relativeURI has characters like &amp; which needs to be encoded before passing it to the REST API</p>
  
  <p>Approach2: Using @PathVariable
  @PathVariable in the REST API for relativeURI and base URI as @RequestParam. But this will ignore extra pathVariables</p>
  
  <p>Approach1:</p>
  
  <pre><code>@GetMapping("app/DeviceResolution/")public void getPrefix(@RequestParam(value= "baseURI",required=false) String baseURI, @RequestParam("relativeURI") String relativeURI,HttpServletResponse response ) 
      {
  //processing
  response.sendRedirect(finalURI);
  }
  </code></pre>
  
  <p>Approach2:</p>
  
  <pre><code>@GetMapping("app/DeviceResolution/{relativeURI}")public void getPrefix(@RequestParam(value= "baseURI",required=false) String baseURI, @PathVariable String relativeURI,HttpServletResponse response ) 
      {
  //processing
  response.sendRedirect(finalURI);
  }
  </code></pre>
  
  <p>GET API -> app/DeviceResolution</p>
  
  <p>relativeURI -> new/category&amp;sub&amp;banner.png</p>
  
  <p>baseURI -> <a href="https://www.google.com/" rel="nofollow noreferrer">https://www.google.com/</a></p>
  
  <p>finalURI -> <a href="https://www.google.com/processedData..../new/category&amp;sub&amp;banner.png" rel="nofollow noreferrer">https://www.google.com/processedData..../new/category&amp;sub&amp;banner.png</a></p>