com.sun.jersey.core.spi.scanning.uri
Class JarZipSchemeScanner

java.lang.Object
  extended by com.sun.jersey.core.spi.scanning.uri.JarZipSchemeScanner
All Implemented Interfaces:
UriSchemeScanner

public class JarZipSchemeScanner
extends java.lang.Object
implements UriSchemeScanner

A "jar" and "zip" scheme URI scanner that recursively jar files. Jar entries are reported to a ScannerListener.

Author:
[email protected], [email protected]

Constructor Summary
JarZipSchemeScanner()
           
 
Method Summary
protected  Closing closing(java.lang.String jarUrlString)
          Obtain a Closing of the jar file.
 java.util.Set<java.lang.String> getSchemes()
          Get the set of supported URI schemes.
 void scan(java.net.URI u, ScannerListener cfl)
          Perform a scan and report resources to a scanning listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarZipSchemeScanner

public JarZipSchemeScanner()
Method Detail

getSchemes

public java.util.Set<java.lang.String> getSchemes()
Description copied from interface: UriSchemeScanner
Get the set of supported URI schemes.

Specified by:
getSchemes in interface UriSchemeScanner
Returns:
the supported URI schemes.

scan

public void scan(java.net.URI u,
                 ScannerListener cfl)
Description copied from interface: UriSchemeScanner
Perform a scan and report resources to a scanning listener.

Specified by:
scan in interface UriSchemeScanner
Parameters:
u - the URI to scan for resources.
cfl - the scanning listener to report entries.

closing

protected Closing closing(java.lang.String jarUrlString)
                   throws java.io.IOException
Obtain a Closing of the jar file.

For most platforms the format for the zip or jar follows the form of the

  • jar:file:///tmp/fishfingers.zip!/example.txt
  • zip:http://www.example.com/fishfingers.zip!/example.txt

On versions of the WebLogic application server a proprietary format is supported of the following form, which assumes a zip file located on the local file system:

  • zip:/tmp/fishfingers.zip!/example.txt
  • zip:d:/tempfishfingers.zip!/example.txt

This method will first attempt to create a Closing as follows:

   new Closing(new URL(jarUrlString).openStream());
 
if that fails with a MalformedURLException then the method will attempt to create a Closing instance as follows:
  return new Closing(new FileInputStream(
      UriComponent.decode(jarUrlString, UriComponent.Type.PATH)));
 

Parameters:
jarUrlString - the raw scheme specific part of a URI minus the jar entry
Returns:
a Closing.
Throws:
java.io.IOException - if there is an error opening the stream.


Copyright © 2011 Oracle Corporation. All Rights Reserved.