Package org.bzdev.protocols
This package contains a class,Handlers
,
that will load additional protocol handlers.
The protocol handlers are initialized by calling
Handlers.enable()
,
which enables protocols defined in subpackages of
org.bzdev.protocols by a class named Handler in those subpackages,
the names of which must match the protocol portion of a URL. These
Handler classes must extend java.net.URLStreamHandler.
Protocol-handler specific properties can be set by calling
Handlers.setProperty
.
Alternatively, before calling Handlers.enable(), a system property,
whose name is the concatenation "org.bzdev.protocols." and the
protocol-handler specific property (the first argument for the method
Handlers.setProperty(String,String)
,
can be set either by calling System.setProperty or by using the
"-D" option to the java command.
The protocols supported are the following:
- resource
- A URL of the form resource:PATH[#FRAGMENT]
(where PATH starts with a "/") accesses a resource that can be
found either by using the system class loader or by searching a
a path of jar files and directories specified by the Handlers
property
resource.path
. (The corresponding system property isorg.bzdev.protocols.resource.path
.) The FRAGMENT component, if it exists, is useful when the resource uses HTML format or some other data format for which fragment identifiers are recognized. The format of the Handlers propertyresource.path
is a list of jar files and directories separated by the path-separator character. In this list, the component "$classpath" indicates that the class path should be searched, allowing the search order to be controlled precisely. If this property is not defined, the class path will be searched for the resource. Otherwise "$classpath" must appear explicitly if the class path is to be searched. - sresource
- A URL of the form sresource:PATH[#FRAGMENT] (where PATH starts with a "/") accesses a resource that can be found using the system class loader. If present, the FRAGMENT component is useful when the resource uses HTML format or some other data format for which fragment identifiers are recognized.
resource
and sresource
protocols are useful
when a URL references an object that is part of an application's code base
or in related files or directories.
There is one caveat: the the method URL.openConnection()
or URL.openConnection(java.net.Proxy)
is called, for the URLConnection
returned, the method
URLConnection.getURL()
may return a differnt URL than
the URL used to open the connection.
-
Classes