public class Handler extends URLStreamHandler
HTTPMD URLs may be used to guarantee the integrity of a downloaded object's codebase if used when specifying the URLs for the JAR files containing the object's classes. Because HTTPMD URLs specify a message digest for a single item, they should not be used for directories of classes.
HTTPMD URLs have a syntax similar to that of HTTP URLs, but include a
message digest as the last parameter stored in the last segment of the
path. The parameter is introduced by the '
;' character, and
includes the name of the message digest algorithm, a '
message digest, and an optional comment introduced by the '
character. In addition, a comment by itself may be specified in a relative
HTTPMD URL. Comments are ignored when using
equals to compare
HTTPMD URLs. The comment specified in the context URL is ignored when
parsing a relative HTTPMD URL. Adding a comment to an HTTPMD URL is useful
in cases where the URL is required to have a particular suffix, for example
the ".jar" file extension. A comment-only relative HTTPMD URL is useful when
specifying the URL of the containing document from within the contents of
the document, where the message digest cannot be specified because it is not
The message digest algorithm is case-insensitive, and may include ASCII letters and numbers, as well as the following characters:
- _ . ~ * ' ( ) : @ & + $ ,
The value specifies the name of the
MessageDigest algorithm to
use. For the URL syntax to be valid, the value must be the name of a
MessageDigest algorithm as determined by calling
The message digest is represented as a positive hexadecimal integer, using
digits, and the letters '
a' through '
f', in either
lowercase or uppercase.
The characters following the '
,' comment character may include
ASCII letters and numbers, as well as the following characters:
- _ . ~ * ' ( ) : @ & = + $ ,
Here are some examples of HTTPMD URLs:
net.jini.url.httpmdto log information at the following logging levels:
| ||URL input stream detects an incorrect message digest|
LogManager class for one way to use the
logging level in standard logging configuration files.
|Constructor and Description|
Creates a URL stream handler for HTTPMD URLs.
|Modifier and Type||Method and Description|
Returns the default port for a URL parsed by this handler, which is
Computes the hash code for the specified URL.
The default superclass implementation performs dns lookup to determine if hosts are equal, this allows two URL's with different hashCode's to be equal, breaking the hashCode equals contract.
Creates a HTTP URL connection for an HTTPMD URL.
Parses the string representation of an HTTPMD URL object.
Compares two HTTPMD URLs to see if they refer to the same file.
equals, getHostAddress, openConnection, setURL, setURL, toExternalForm
protected int getDefaultPort()
protected URLConnection openConnection(URL u) throws IOException
hostsEqualto compare the hosts, compares the ports, with
-1matching the default HTTP port (
80), and performs case-sensitive comparison on the remaining portions.
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.