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 newResourceFinderfor a given resource URI.private InputStreamgetInputStream(String jarUrlString) Obtain aInputStreamof 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:UriSchemeResourceFinderFactoryGet the set of supported URI schemes.- Specified by:
getSchemesin interfaceUriSchemeResourceFinderFactory- Returns:
- the supported URI schemes.
-
create
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
Obtain aInputStreamof 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.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:
IOException- if there is an error opening the stream.
-