The following is a proposed URL syntax for representing JAR file entries. This new URL syntax can be used to refer to resources stored in both local and remote JAR files, and also replaces the need for the systemresource protocol handler.
An absolute JAR URL has the following syntax:
abs-jar-url = "jar:" jar-file-url "!" [ sub-jar-path ] [ entry-path ] jar-file-url = abs-url ( absolute URL of JAR file ) sub-jar-path = entry-path "!" [ sub-jar-path ] entry-path = abs-path ( absolute path of JAR file entry )
The optional component 'sub-jar-path' can be used to refer to JAR files embedded within JAR files. If 'entry-path' is omitted then it defaults to the root path entry '/'.
Examples,
jar:http://foo/foo.jar!/foo/bar/gif jar:http://foo/foo.jar!/baz.jar!/foo.gif
The seconds example refers to a JAR file 'baz.jar' embedded within the JAR file at URL http://foo/foo.jar.
Since the '!' character has special meaning within a JAR URL then it must be encoded if appearing as the last character in a JAR entry path or the embedded JAR file URL.
A JAR URL without any '!' character is equivalent to the URL obtained by removing 'jar' scheme. For example,
jar:http://foo/foo.html -> http://foo.foo.html
This makes it possible for a relative URL to "jump out" of a JAR URL if necessary.
When resolving relative URLs against an absolute JAR URL as the base URL, similar rules are employed as with file URLs. The one exception is if the character '!' appears alone as a component of the relative URL then it will cause every component following the last '!' to be removed from the absolute URL. This makes it possible to immediately jump to the root of the last embedded JAR file.
For example, if the base URL is 'jar:http://foo/foo.jar!/foo/bar.html' then the following relative URLs as resolve as follows:
baz.html -> jar:http://foo/foo.jar!/foo/baz.html !/../bar.jar!/ -> jar:http://foo/bar.jar!/ !/../foo.gif -> jar:http://foo/foo.gif -> http://foo/foo.gif /bozo.html -> jar:http://foo/bozo.html -> http://foo/bozo.html
With JDK1.2, the invocation of kiosks can be made even
simpler through the use of the JAR auto-invocation
mechanism. The underlying platform's process start-up
mechanism distinguishes a class file with a
main()
entry in the JAR file's MANIFEST.
Then the platform's normal mechanism (double click,
explicit launch, magic number) is used to launch the file.
A JAX file is a JAR file intented to be used in this
fashion with a different extension; this is useful with
the standard win32 "launcher by extension" mechanism.