WARNING: This server provides a static reference view of the NetKernel documentation. Links to dynamic content do not work. For the best experience we recommend you install NetKernel and view the documentation in the live system .

Endpoint
Name:Jar Accessor
Description:access resources from inside Java jars
Id:layer1.JarScheme
Category:accessor
Identifier Syntax

Jar Accessor is an accessor using a standard identifier grammar:

<grammar>
  <group>
    <group name="jar">jar:
      <regex>.*</regex>
    </group>
  </group>
</grammar>

with the following arguments: (for more details on argument passing details see here)

ArgumentRulesTypingDescription
jarString (unknown)(no description available)
Request Verbs

The following verb is supported:

Verb
SOURCE
Response

The response representation of this accessor for SOURCE requests is unknown.

This accessor throws no documented exceptions.

Import Requirements

To use Jar Accessor accessor you must import the module urn:com:1060research:www3:

<import>
  <uri>urn:com:1060research:www3</uri>
</import>

Details

The jar: scheme is an internal NetKernel URI scheme that supports the identification of any or all parts of a JAR archive physical resource. A Java Archive (JAR) is a single physical file that uses a file system abstraction to organize files internally. A JAR file contains a root directory and any number of files and sub-directories.

Syntax

The syntax for the scheme is:

Resource Identifier Syntax

jar:file:{path}{filename}!/{entry}

For example, to reference the file conferencelist.txt within the internal sub-directory documents/ within the JAR file data.jar, residing in the Unix file system directory /home/rsk/, use the following URI:

jar:file:/home/rsk/data.jar!/documents/conferencelist.txt

SOURCE

When a request with the SOURCE verb is issued to the jar: scheme the contents of the specified file found within the specified JAR file on the underlying file system of the computer hosting the NetKernel platform is returned as a org.netkernel.layer0.representation.IReadableBinaryStreamRepresentation object.

If a requested entry in a JAR file is missing then the exception FileNotFoundException is thrown. If the identified JAR file is missing then the exception ZipException is thrown. If the entire JAR file is requested (there is no {entry} in the URI) then the exception IOException is thrown.

Example

This example shows the retrieval of the contents of a particular file in the root location within a JAR file:

request = context.createRequest("jar:file:/home/rsk/data.jar!/about.txt");
request.setRepresentationClass(String.class);
fileContents = context.issueRequest(request);

Example

This example shows the retrieval of the contents of a particular file in a sub-directory within a JAR file:

request = context.createRequest("jar:file:/home/rsk/data.jar!/2007/history.txt");
request.setRepresentationClass(String.class);
fileContents = context.issueRequest(request);