Best practice for validating a URL with Spring-MVC?

In the past, I have always utilized Hibernate Validator. Simply annotate the appropriate field in your form bean with a @URL constraint.

If you've never used the ORM part of Hibernate before, don't let that scare you. The Validator portion is not dependent on the ORM stuff, and integrating it into Spring is very straightforward.

If for some reason you can't use Hibernate Validator... or you just want to stick with what you're comfortable with, a good place for regex's is RegExLib.com; several patterns that can match a URI are listed there.


Ended up using UrlValidator from apache commons.