Class JarZipSchemeResourceFinderFactory
java.lang.Object
org.glassfish.jersey.server.internal.scanning.JarZipSchemeResourceFinderFactory
- All Implemented Interfaces:
UriSchemeResourceFinderFactory
final class JarZipSchemeResourceFinderFactory
extends Object
implements UriSchemeResourceFinderFactory
A "jar", "zip" and "wsjar" scheme URI scanner that recursively jar files.
Jar entries are reported to a
ResourceProcessor
.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate new "jar", "zip" and "wsjar" scheme URI scanner factory. -
Method Summary
Modifier and TypeMethodDescriptionCreate newResourceFinder
for a given resource URI.private InputStream
getInputStream
(String jarUrlString) Obtain aInputStream
of the jar file.Get the set of supported URI schemes.
-
Field Details
-
SCHEMES
-
-
Constructor Details
-
JarZipSchemeResourceFinderFactory
JarZipSchemeResourceFinderFactory()Create new "jar", "zip" and "wsjar" scheme URI scanner factory.
-
-
Method Details
-
getSchemes
Description copied from interface:UriSchemeResourceFinderFactory
Get the set of supported URI schemes.- Specified by:
getSchemes
in interfaceUriSchemeResourceFinderFactory
- Returns:
- the supported URI schemes.
-
create
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
Obtain aInputStream
of the jar file.For most platforms the format for the zip or jar follows the form of the invalid input: '<'a href="http://docs.sun.com/source/819-0913/author/jar.html#jarprotocol"jar protcol.
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:
IOException
- if there is an error opening the stream.
-