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 class
JarZipSchemeResourceFinderFactory.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.JarZipSchemeScanner
create(java.net.URI uri, boolean recursive)
Create newResourceFinder
for a given resource URI.private java.io.InputStream
getInputStream(java.lang.String jarUrlString)
Obtain aInputStream
of 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:UriSchemeResourceFinderFactory
Get the set of supported URI schemes.- Specified by:
getSchemes
in interfaceUriSchemeResourceFinderFactory
- Returns:
- the supported URI schemes.
-
create
public JarZipSchemeResourceFinderFactory.JarZipSchemeScanner create(java.net.URI uri, boolean recursive)
Description copied from interface:UriSchemeResourceFinderFactory
Create newResourceFinder
for a given resource URI.- Specified by:
create
in 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.IOException
Obtain aInputStream
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
InputStream
as follows:new URL(jarUrlString).openStream();
if that fails with aMalformedURLException
then the method will attempt to create aInputStream
instance 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.
-
-