Package org.apache.tomcat.util.buf

## Class UriUtil

- java.lang.Object
- - org.apache.tomcat.util.buf.UriUtil

-     public final class UriUtil
      extends java.lang.Object

  Utility class for working with URIs and URLs.

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.net.URL` | `buildJarSafeUrl​(java.io.File file)` |
    `static java.net.URL` | `buildJarUrl​(java.io.File jarFile)` |
    `static java.net.URL` | `buildJarUrl​(java.io.File jarFile, java.lang.String entryPath)` |
    `static java.net.URL` | `buildJarUrl​(java.lang.String fileUrlString)` |
    `static java.net.URL` | `buildJarUrl​(java.lang.String fileUrlString, java.lang.String entryPath)` |
    `static java.lang.String` | `getWarSeparator()` |
    `static boolean` | `hasScheme​(java.lang.CharSequence uri)` | Determine if a URI string has a `scheme` component.
    `static boolean` | `isAbsoluteURI​(java.lang.String path)` | Does the provided path start with `file:/` or `<protocol>://`.
    `static java.net.URL` | `warToJar​(java.net.URL warUrl)` | Convert a URL of the form `war:file:...` to `jar:file:...`.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### hasScheme

          public static boolean hasScheme​(java.lang.CharSequence uri)

      Determine if a URI string has a `scheme` component.
      Parameters:
        `uri` - The URI to test
      Returns:
        `true` if a scheme is present, otherwise {code @false}

    - #### buildJarUrl

          public static java.net.URL buildJarUrl​(java.io.File jarFile)
                                          throws java.net.MalformedURLException

      Throws:
        `java.net.MalformedURLException`

    - #### buildJarUrl

          public static java.net.URL buildJarUrl​(java.io.File jarFile,
                                                 java.lang.String entryPath)
                                          throws java.net.MalformedURLException

      Throws:
        `java.net.MalformedURLException`

    - #### buildJarUrl

          public static java.net.URL buildJarUrl​(java.lang.String fileUrlString)
                                          throws java.net.MalformedURLException

      Throws:
        `java.net.MalformedURLException`

    - #### buildJarUrl

          public static java.net.URL buildJarUrl​(java.lang.String fileUrlString,
                                                 java.lang.String entryPath)
                                          throws java.net.MalformedURLException

      Throws:
        `java.net.MalformedURLException`

    - #### buildJarSafeUrl

          public static java.net.URL buildJarSafeUrl​(java.io.File file)
                                              throws java.net.MalformedURLException

      Throws:
        `java.net.MalformedURLException`

    - #### warToJar

          public static java.net.URL warToJar​(java.net.URL warUrl)
                                       throws java.net.MalformedURLException

      Convert a URL of the form `war:file:...` to `jar:file:...`.
      Parameters:
        `warUrl` - The WAR URL to convert
      Returns:
        The equivalent JAR URL
      Throws:
        `java.net.MalformedURLException` - If the conversion fails

    - #### getWarSeparator

          public static java.lang.String getWarSeparator()

    - #### isAbsoluteURI

          public static boolean isAbsoluteURI​(java.lang.String path)

      Does the provided path start with `file:/` or `<protocol>://`.
      Parameters:
        `path` - The path to test
      Returns:
        `true` if the supplied path starts with once of the recognised sequences.