serialVersionUID

protocolPathProp

The property which specifies the package prefix list to be scanned
for protocol handlers. The value of this property (if any) should
be a vertical bar delimited list of package names to search through
for a protocol handler to load. The policy of this class is that
all protocol handlers will be in a class called .Handler,
and each package in the list is examined in turn for a matching
handler. If none are found (or the property is not specified), the
default package prefix, sun.net.www.protocol, is used. The search
proceeds from the first package in the list to the last and stops
when a match is found.

URL

host can be expressed as a host name or a literal
IP address. If IPv6 literal address is used, it should be
enclosed in square brackets ('[' and ']'), as
specified by RFC 2732;
However, the literal IPv6 address format defined in RFC 2373: IP
Version 6 Addressing Architecture is also accepted.

Specifying a port number of -1
indicates that the URL should use the default port for the
protocol.

If this is the first URL object being created with the specified
protocol, a stream protocol handler object, an instance of
class URLStreamHandler, is created for that protocol:

If the application has previously set up an instance of
URLStreamHandlerFactory as the stream handler factory,
then the createURLStreamHandler method of that instance
is called with the protocol string as an argument to create the
stream protocol handler.

If no URLStreamHandlerFactory has yet been set up,
or if the factory's createURLStreamHandler method
returns null, then the constructor finds the
value of the system property:

java.protocol.handler.pkgs

If the value of that system property is not null,
it is interpreted as a list of packages separated by a vertical
slash character '|'. The constructor tries to load
the class named:

<package>.<protocol>.Handler

where <package> is replaced by the name of the package
and <protocol> is replaced by the name of the protocol.
If this class does not exist, or if the class exists but it is not
a subclass of URLStreamHandler, then the next package
in the list is tried.

If the previous step fails to find a protocol handler, then the
constructor tries to load from a system default package.

<system default package>.<protocol>.Handler

If this class does not exist, or if the class exists but it is not a
subclass of URLStreamHandler, then a
MalformedURLException is thrown.

URL

Enabled: Creates a URL object from the specified
protocol, host, port
number, file, and handler. Specifying
a port number of -1 indicates that
the URL should use the default port for the protocol. Specifying
a handler of null indicates that the URL
should use a default stream handler for the protocol, as outlined
for:
java.net.URL#URL(java.lang.String, java.lang.String, int,
java.lang.String)

If the handler is not null and there is a security manager,
the security manager's checkPermission
method is called with a
NetPermission("specifyStreamHandler") permission.
This may result in a SecurityException.
No validation of the inputs is performed by this constructor.

URL

Enabled: Creates a URL by parsing the given spec within a specified context.
The new URL is created from the given context URL and the spec
argument as described in
RFC2396 "Uniform Resource Identifiers : Generic * Syntax" :

<scheme>://<authority><path>?<query>#<fragment>

The reference is parsed into the scheme, authority, path, query and
fragment parts. If the path component is empty and the scheme,
authority, and query components are undefined, then the new URL is a
reference to the current document. Otherwise, the fragment and query
parts present in the spec are used in the new URL.

If the scheme component is defined in the given spec and does not match
the scheme of the context, then the new URL is created as an absolute
URL based on the spec alone. Otherwise the scheme component is inherited
from the context URL.

If the authority component is present in the spec then the spec is
treated as absolute and the spec authority and path will replace the
context authority and path. If the authority component is absent in the
spec then the authority of the new URL will be inherited from the
context.

If the spec's path component begins with a slash character
"/" then the
path is treated as absolute and the spec path replaces the context path.

Otherwise, the path is treated as a relative path and is appended to the
context path, as described in RFC2396. Also, in this case,
the path is canonicalized through the removal of directory
changes made by occurences of ".." and ".".

getProtocol

getHost

Enabled: Gets the host name of this URL, if applicable.
The format of the host conforms to RFC 2732, i.e. for a
literal IPv6 address, this method will return the IPv6 address
enclosed in square brackets ('[' and ']').

Returns:

the host name of this URL.

getFile

Enabled: Gets the file name of this URL.
The returned file portion will be
the same as getPath(), plus the concatenation of
the value of getQuery(), if any. If there is
no query portion, this method and getPath() will
return identical results.

equals

If the given object is not a URL then this method immediately returns
false.

Two URL objects are equal if they have the same protocol, reference
equivalent hosts, have the same port number on the host, and the same
file and fragment of the file.

Two hosts are considered equivalent if both host names can be resolved
into the same IP addresses; else if either host name can't be
resolved, the host names must be equal without regard to case; or both
host names equal to null.

Since hosts comparison requires name resolution, this operation is a
blocking operation.

Note: The defined behavior for equals is known to
be inconsistent with virtual hosting in HTTP.

openConnection

Enabled: Returns a URLConnection object that represents a
connection to the remote object referred to by the URL.

A new connection is opened every time by calling the
openConnection method of the protocol handler for
this URL.

If for the URL's protocol (such as HTTP or JAR), there
exists a public, specialized URLConnection subclass belonging
to one of the following packages or one of their subpackages:
java.lang, java.io, java.util, java.net, the connection
returned will be of that subclass. For example, for HTTP an
HttpURLConnection will be returned, and for JAR a
JarURLConnection will be returned.