Class URLValidator

java.lang.Object
org.apache.nifi.processor.util.URLValidator
All Implemented Interfaces:
Validator

public class URLValidator extends Object implements Validator
  • Field Details

  • Constructor Details

    • URLValidator

      public URLValidator()
  • Method Details

    • validate

      public ValidationResult validate(String subject, String input, ValidationContext context)
      Specified by:
      validate in interface Validator
      Parameters:
      subject - what is being validated
      input - the string to be validated
      context - the ValidationContext to use when validating properties
      Returns:
      ValidationResult
    • createURL

      public static URL createURL(String url) throws MalformedURLException
      This method provides an alternative to the use of java.net.URI's single argument constructor and 'create' method. The drawbacks of the java.net.URI's single argument constructor and 'create' method are:
      • They do not provide quoting in the path section for any character not in the unreserved, punct, escaped, or other categories, and not equal to the slash character ('/') or the commercial-at character ('@').
      • They do not provide quoting for any illegal characters found in the query and fragment sections.
      On the other hand, java.net.URI's seven argument constructor provides these quoting capabilities. In order to take advantage of this constructor, this method parses the given string into the arguments needed thereby allowing for instantiating a java.net.URI with the quoting of all illegal characters.
      Parameters:
      url - String representing a URL.
      Returns:
      Instance of java.net.URL
      Throws:
      MalformedURLException - if unable to create a URL from the given String representation