Class UriUtils

java.lang.Object
org.apache.nifi.util.UriUtils

public class UriUtils extends Object
Utility class providing java.net.URI utilities. The regular expressions in this class used to capture the various components of a URI were adapted from UriComponentsBuilder
  • Field Details

  • Constructor Details

    • UriUtils

      private UriUtils()
  • Method Details

    • create

      public static URI create(String uri) throws URISyntaxException
      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:
      uri - String representing a URI.
      Returns:
      Instance of java.net.URI
      Throws:
      URISyntaxException - Thrown on parsing failures