title: How to check for a valid URL in Java?
body: <p>What is the best way to check if a URL is valid in Java?  </p>
  
  <p>If tried to call <code>new URL(urlString)</code> and catch a <code>MalformedURLException</code>, but it seems to be happy with anything that begins with <code>http://</code>.</p>
  
  <p>I'm not concerned about establishing a connection, just validity.  Is there a method for this?  An annotation in Hibernate Validator?  Should I use a regex?</p>
  
  <p><strong>Edit:</strong>  Some examples of accepted URLs are <code>http://***</code> and <code>http://my favorite site!</code>.</p>