Consider using the Apache Commons UrlValidator class
UrlValidator urlValidator = new UrlValidator();
urlValidator.isValid("http://my favorite site!");
There are several properties that you can set to control how this class behaves, by default http
, https
, and ftp
are accepted.
More Related Contents:
- Validating URL in Java
- How to validate an XML file against an XSD file?
- How to construct a relative path in Java from two absolute paths (or URLs)?
- Parsing query strings on Android
- Java – How to find the redirected url of a url?
- Java – class.getResource returns null
- Get domain name from given url
- How to access resources in JAR file?
- How to validate an XML file using Java with an XSD having an include?
- Validate JAXBElement in JPA/JAX-RS Web Service
- Getting URL parameter in java and extract a specific text from that URL
- Registering and using a custom java.net.URL protocol
- Spring – Redirect after POST (even with validation errors)
- Check if file exists on remote server using its URL [duplicate]
- Android: how to parse URL String with spaces to URI object?
- Spring Web MVC – validate individual request params
- java – ignore expired ssl certificate
- What’s the difference between a Resource, URI, URL, Path and File in Java?
- Java HttpServletRequest get URL in browsers URL bar
- Android: How to use download manager class?
- Spring @Validated in service layer
- Validating XML against XSD [duplicate]
- How do I validate incoming JSON data inside a REST service?
- javax.validation.ValidationException: HV000183: Unable to load ‘javax.el.ExpressionFactory’
- How to use Selenium WebDriver on local webpage (on my PC) instead of one located somewhere online?
- @PathVariable in SpringBoot with slashes in URL
- Spring-Boot How to properly inject javax.validation.Validator
- JSF 2 – Bean Validation: validation failed -> empty values are replaced with last valid values from managed bean
- Autowired Repository is Null in Custom Constraint Validator
- Exclude directories & subdirectories from validation in Eclipse