title: How the get request url which has hash in the request param is handled by the rest template in Spring
body: <p>I'm not getting the response for the below mentioned request url, though the url and the param values are correct. FYI, there is a hash symbol in the request param value and I'm encoding it from client end so that the request is not truncated. The response is status 500 and error code 400 Bad Request. Not sure what is the problem.</p>
  
  <p>Request URL Passed:</p>
  
  <blockquote>
    <p><a href="https://localhost:8080/v3/getdata?problemType=Netting&amp;equipmentType=All%20refrigeration&amp;problemCode=Damaged%20upright%20Please%20refer%20to%20Spec%20%2313300&amp;locationId=2005511287" rel="nofollow noreferrer">https://localhost:8080/v3/getdata?problemType=Netting&amp;equipmentType=All%20refrigeration&amp;problemCode=Damaged%20upright%20Please%20refer%20to%20Spec%20%2313300&amp;locationId=2005511287</a></p>
  </blockquote>
  
  <p>Response:</p>
  
  <pre><code>{
     "timestamp": 1549916785930,
     "status": 500,
     "error": "Internal Server Error",
     "message": "400 Bad Request",
     "path": "/v3/getdata"
   }
  </code></pre>
  
  <p>Calling Method:</p>
  
  <pre><code>public String getData(String url) throws BusinessException {
  
  RestTemplate restTemplate = new RestTemplate();
  HttpHeaders headers = new HttpHeaders();
  headers.setContentType(MediaType.APPLICATION_JSON);
  headers.set("Authorization", "Bearer " + getAuthenticateToken());
  HttpEntity&lt;String&gt; entity = new HttpEntity&lt;&gt;(headers);
  String completeURL = BaseURL+"/"+url;
  logger.info(completeURL);
  ResponseEntity&lt;String&gt; result = restTemplate.exchange(completeURL, HttpMethod.GET, entity, String.class);
  
  System.out.println("Result:: "+result);
  try {
      if ((result.getStatusCode() == HttpStatus.OK))
          return result.getBody();
  } catch (Exception e) {
      e.printStackTrace();
  }
  throw new BusinessException(result.getStatusCodeValue(), 
    result.getBody());
    }
  </code></pre>
  
  <p>Error</p>
  
  <blockquote>
    <p>2019-02-11 15:26:25.900 ERROR 14328 --- [nio-8080-exec-9] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request] 
          with root cause</p>
    
    <p>org.springframework.web.client.HttpClientErrorException$BadRequest: 400 Bad Request
        at 
    org.springframework.web.client.HttpClientErrorException.create(HttpClientErrorException.java:79) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:122) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:102) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:777) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:735) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:669) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:578) ~[spring-web-5.1.3.RELEASE.jar:5.1.3.RELEASE]
        at com.walmart.fixit.ws.utils.Utils.getDataFromSC(Utils.java:118) ~[classes/:na]</p>
  </blockquote>