Class HttpmdUtil

java.lang.Object
net.jini.url.httpmd.HttpmdUtil

public class HttpmdUtil extends Object
Provides utility methods for creating and using HTTPMD URLs.
Since:
2.0
Author:
Sun Microsystems, Inc.
  • 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 data
      algorithm - the message digest algorithm to use
      Returns:
      the message digest, as a String in hexadecimal format
      Throws:
      IOException - if an I/O exception occurs while reading data from the URL
      NoSuchAlgorithmException - if no provider is found for the message digest algorithm
      NullPointerException - if either argument is null
    • 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 in codebase
      codebase - 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 to sourceDirectory, to use for computing message digests.
      Returns:
      the codebase updated to include computed digests
      Throws:
      IllegalArgumentException - if any of the URLs in codebase fail to specify the HTTPMD protocol
      IOException - if an I/O exception occurs while reading data from the source files
      MalformedURLException - if any of the URLs in codebase have incorrect syntax
      NullPointerException - if either argument is null