Class JarZipSchemeResourceFinderFactory
- java.lang.Object
-
- org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory
-
- All Implemented Interfaces:
UriSchemeResourceFinderFactory
final class JarZipSchemeResourceFinderFactory extends java.lang.Object implements UriSchemeResourceFinderFactory
A "jar", "zip" and "wsjar" scheme URI scanner that recursively jar files. Jar entries are reported to aResourceProcessor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classJarZipSchemeResourceFinderFactory.JarZipSchemeScanner
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<java.lang.String>SCHEMES
-
Constructor Summary
Constructors Constructor Description JarZipSchemeResourceFinderFactory()Create new "jar", "zip" and "wsjar" scheme URI scanner factory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JarZipSchemeResourceFinderFactory.JarZipSchemeScannercreate(java.net.URI uri, boolean recursive)Create newResourceFinderfor a given resource URI.private java.io.InputStreamgetInputStream(java.lang.String jarUrlString)Obtain aInputStreamof the jar file.java.util.Set<java.lang.String>getSchemes()Get the set of supported URI schemes.
-
-
-
Method Detail
-
getSchemes
public java.util.Set<java.lang.String> getSchemes()
Description copied from interface:UriSchemeResourceFinderFactoryGet the set of supported URI schemes.- Specified by:
getSchemesin interfaceUriSchemeResourceFinderFactory- Returns:
- the supported URI schemes.
-
create
public JarZipSchemeResourceFinderFactory.JarZipSchemeScanner create(java.net.URI uri, boolean recursive)
Description copied from interface:UriSchemeResourceFinderFactoryCreate newResourceFinderfor a given resource URI.- Specified by:
createin interfaceUriSchemeResourceFinderFactory- Parameters:
uri- resource URI.recursive- defines whether a resource finder should recursively scan any recognized sub-resource URIs (value oftrue) or not (value offalse).- Returns:
- resource finder for a given URI.
-
getInputStream
private java.io.InputStream getInputStream(java.lang.String jarUrlString) throws java.io.IOExceptionObtain aInputStreamof the jar file.For most platforms the format for the zip or jar follows the form of the
jar:file:///tmp/fishfingers.zip!/example.txtzip: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.txtzip:d:/tempfishfingers.zip!/example.txt
InputStreamas follows:new URL(jarUrlString).openStream();
if that fails with aMalformedURLExceptionthen the method will attempt to create aInputStreaminstance as follows:return new new FileInputStream( UriComponent.decode(jarUrlString, UriComponent.Type.PATH)));- Parameters:
jarUrlString- the raw scheme specific part of a URI minus the jar entry- Returns:
- a
InputStream. - Throws:
java.io.IOException- if there is an error opening the stream.
-
-