title: How to fix open redirect issue in java
body: <p>Currently my java code uses </p>
  
  <pre><code>response.sendRedirect(request.getRequestUrl().toString());
  </code></pre>
  
  <p>Which is an open redirect.</p>
  
  <p>I have to fix this but I can not white list it since there are too many URL's are associated with it.</p>
  
  <p>I have tried the following solution with ESAPI but it wont work for me.</p>
  
  <pre><code>ESAPI.httpUtilities().setCurrentHTTP(req, resp);
  ESAPI.httpUtilities().sendRedirect(location);
  ESAPI.httpUtilities().clearCurrent();
  </code></pre>
  
  <p>I am new to ESAPI. </p>