Package net.jini.url.httpmd
Class HttpmdUtil
java.lang.Object
net.jini.url.httpmd.HttpmdUtil
Provides utility methods for creating and using HTTPMD URLs.
- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringcomputeDigest(URL url, String algorithm) Computes the message digest of data specified by a URL.static StringcomputeDigestCodebase(String sourceDirectory, String codebase) Computes the message digests for a codebase with HTTPMD URLs.
-
Method Details
-
computeDigest
public static String computeDigest(URL url, String algorithm) throws IOException, NoSuchAlgorithmException Computes the message digest of data specified by a URL.- Parameters:
url- the URL of the dataalgorithm- the message digest algorithm to use- Returns:
- the message digest, as a
Stringin hexadecimal format - Throws:
IOException- if an I/O exception occurs while reading data from the URLNoSuchAlgorithmException- if no provider is found for the message digest algorithmNullPointerException- if either argument isnull
-
computeDigestCodebase
public static String computeDigestCodebase(String sourceDirectory, String codebase) throws IOException, MalformedURLException, NullPointerException Computes the message digests for a codebase with HTTPMD URLs.Do not use a directory on a remote filesystem, or a directory URL, if the underlying network access protocol does not provide adequate data integrity or authentication of the remote host.
- Parameters:
sourceDirectory- the filename or URL of the directory containing the source files corresponding to the URLs incodebasecodebase- a space-separated list of HTTPMD URLs. The digest values specified in the URLs will be ignored. The path portion of the URLs, without the message digest parameters, will be used to specify the source files, relative tosourceDirectory, to use for computing message digests.- Returns:
- the codebase updated to include computed digests
- Throws:
IllegalArgumentException- if any of the URLs incodebasefail to specify the HTTPMD protocolIOException- if an I/O exception occurs while reading data from the source filesMalformedURLException- if any of the URLs incodebasehave incorrect syntaxNullPointerException- if either argument isnull
-