List of usage examples for org.apache.commons.validator.routines DomainValidator isValidTld
public boolean isValidTld(String tld)
String
matches any IANA-defined top-level domain. From source file:org.mule.modules.validation.ValidationModule.java
/** * If if the specified <code>topLevelDomain</code> does not matches any IANA-defined top-level domain throw an exception. * Leading dots are ignored if present. The search is case-sensitive. * <p/>//from www.j a va 2 s . co m * {@sample.xml ../../../doc/mule-module-validation.xml.sample validation:validate-top-level-domain} * * @param topLevelDomain Domain name to validate * @param customExceptionClassName Class name of the exception to throw * @throws Exception if not valid */ @Processor public void validateTopLevelDomain(String topLevelDomain, @Optional @Default("org.mule.modules.validation.InvalidException") String customExceptionClassName) throws Exception { DomainValidator validator = DomainValidator.getInstance(); if (!validator.isValidTld(topLevelDomain)) { throw buildException(customExceptionClassName); } }