title: Rest Template Retrieve Status Code from Image URL
body: <p>I want to know the return status code from an image URL, for example:</p>
  
  <pre><code>http://img.test.com/news/1439911080563855663.jpg
  </code></pre>
  
  <p>This URL might return <code>404 (NOT_FOUND)</code> or an actual image in <code>JPG</code>, in this case <code>200 (OK)</code>, how can i check the status return by image url?</p>
  
  <p>Normally we can use <code>restTemplate</code> to check for status in rest endpoint:</p>
  
  <pre><code>ResponseEntity&lt;YourResponse&gt; responseEntity =
  restTemplate.getForEntity("http://your.url.here", YourResponse.class);
  
  System.out.println(responseEntity.getStatusCode());
  </code></pre>
  
  <p>How can we do it with <code>restTemplate</code> for image url?</p>