Package org.apache.tomcat.util.buf
Class UriUtil
- java.lang.Object
-
- org.apache.tomcat.util.buf.UriUtil
-
public final class UriUtil extends Object
Utility class for working with URIs and URLs.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static URLbuildJarSafeUrl(File file)static URLbuildJarUrl(File jarFile)static URLbuildJarUrl(File jarFile, String entryPath)static URLbuildJarUrl(String fileUrlString)static URLbuildJarUrl(String fileUrlString, String entryPath)static StringgetWarSeparator()static booleanhasScheme(CharSequence uri)Determine if a URI string has aschemecomponent.static booleanisAbsoluteURI(String path)Does the provided path start withfile:/or<protocol>://.static URLwarToJar(URL warUrl)Convert a URL of the formwar:file:...tojar:file:....
-
-
-
Method Detail
-
hasScheme
public static boolean hasScheme(CharSequence uri)
Determine if a URI string has aschemecomponent.- Parameters:
uri- The URI to test- Returns:
trueif a scheme is present, otherwise {code @false}
-
buildJarUrl
public static URL buildJarUrl(File jarFile) throws MalformedURLException
- Throws:
MalformedURLException
-
buildJarUrl
public static URL buildJarUrl(File jarFile, String entryPath) throws MalformedURLException
- Throws:
MalformedURLException
-
buildJarUrl
public static URL buildJarUrl(String fileUrlString) throws MalformedURLException
- Throws:
MalformedURLException
-
buildJarUrl
public static URL buildJarUrl(String fileUrlString, String entryPath) throws MalformedURLException
- Throws:
MalformedURLException
-
buildJarSafeUrl
public static URL buildJarSafeUrl(File file) throws MalformedURLException
- Throws:
MalformedURLException
-
warToJar
public static URL warToJar(URL warUrl) throws MalformedURLException
Convert a URL of the formwar:file:...tojar:file:....- Parameters:
warUrl- The WAR URL to convert- Returns:
- The equivalent JAR URL
- Throws:
MalformedURLException- If the conversion fails
-
getWarSeparator
public static String getWarSeparator()
-
isAbsoluteURI
public static boolean isAbsoluteURI(String path)
Does the provided path start withfile:/or<protocol>://.- Parameters:
path- The path to test- Returns:
trueif the supplied path starts with once of the recognised sequences.
-
-