I want a user to be able to submit a url, and then display that url to other users as a link.
If I naively redisplay what the user submitted, I leave myself open to urls
You can use apache validator URLValidator
UrlValidator urlValidator = new UrlValidator(schemes); if (urlValidator.isValid("http://somesite.com")) { //valid }