|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.net.URLConnection org.apache.jackrabbit.net.JCRURLConnection org.apache.jackrabbit.net.JCRJarURLConnection
public class JCRJarURLConnection
The JCRJarURLConnection
extends the
JCRURLConnection
class to support accessing
archive files stored in a JCR Repository.
Just like the base class, this class requires the URL to resolve, either
directly or through primary item chain, to a repository Property
.
Access to this connections property and archive entry content is perpared
with the connect()
, which after calling the base class implementation
to find the property tries to find the archive entry and set the connection's
fields according to the entry. This implementation's connect()
method fails if the named entry does not exist in the archive.
The getInputStream()
method either returns an stream on the archive
entry or on the archive depending on whether an entry path is specified
in the URL or not. Like the base class implementation, this implementation
returns a new InputStream
on each invocation.
If an entry path is defined on the URL, the header fields are set from the archive entry:
Content-Type | Guessed from the entry name or
application/octet-stream if the type cannot be guessed
from the name |
Content-Encoding | null |
Content-Length | The size of the entry |
Last-Modified | The last modification time of the entry |
If no entry path is defined on the URL, the header fields are set from the
property by the base class implementation with the exception of the
content type, which is set to application/java-archive
by
the connect()
method.
Note that this implementation does only support archives stored in the JCR Repository, no other contained storage such as file or http is supported.
This class is not intended to be subclassed or instantiated by clients.
Field Summary | |
---|---|
protected static String |
APPLICATION_JAR
The name of the MIME content type for this connection's content if no entry path is defined on the URL (value is "application/java-archive"). |
Fields inherited from class org.apache.jackrabbit.net.JCRURLConnection |
---|
APPLICATION_OCTET, CONTENT_ENCODING, CONTENT_LENGTH, CONTENT_TYPE, LAST_MODIFIED, TEXT_PLAIN |
Fields inherited from class java.net.URLConnection |
---|
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches |
Method Summary | |
---|---|
void |
connect()
Connects to the URL setting the header fields and preparing for the JCRURLConnection.getProperty() and getInputStream() methods. |
InputStream |
getInputStream()
Returns an input stream that reads from this open connection. |
Methods inherited from class org.apache.jackrabbit.net.JCRURLConnection |
---|
failure, getContentEncoding, getContentLength, getContentType, getHandler, getHeaderField, getHeaderField, getHeaderFieldKey, getHeaderFields, getItem, getLastModified, getPath, getProperty, getSession, setContentEncoding, setContentLength, setContentType, setLastModified, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final String APPLICATION_JAR
Method Detail |
---|
public void connect() throws IOException
JCRURLConnection.getProperty()
and getInputStream()
methods.
After calling the base class implemenation to get the basic connection,
the entry is looked for in the archive to set the content type, content
length and last modification time header fields according to the named
entry. If no entry is defined on the URL, only the content type header
field is set to application/java-archive
.
When this method successfully returns, this connection is considered connected. In case of an exception thrown, the connection is not connected.
connect
in class JCRURLConnection
IOException
- if an error occurrs retrieving the data property or
any of the header field value properties or if any other errors
occurrs. Any cuasing exception is set as the cause of this
exception.public InputStream getInputStream() throws IOException
JarInputStream
positioned at the start of
the named entry.
NOTES:
InputStream
.
Calling this method implicitly calls connect()
to ensure the
connection is open.
getInputStream
in class JCRURLConnection
InputStream
on the archive or the entry if
specified.
IOException
- if an error occurrs opening the connection through
connect()
or creating the InputStream
on the
repository Property
.JCRURLConnection.connect()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |