JCRURLConnection
is the URLConnection
implementation to access the data addressed by a JCR Repository URL. As the primary use of a URLConnection
and thus the JCRURLConnection
is to provide access to the content of a resource identified by the URL, it is the primary task of this class to identify and access a repository Property
based on the URL. This main task is executed in the {@link #connect()} method.
Basically the guideposts to access content from a JCR Repository URl are the following:
After having connected the property is available through the {@link #getProperty()} method. Other methods exist to retrieve repositoryrelated information defined when creating the URL: {@link #getSession()} toretrieve the session of the URL, {@link #getPath()} to retrieve the pathwith which the URL was created and {@link #getItem()} to retrieve the itemwith which the URL was created. The results of calling {@link #getProperty()}and {@link #getItem()} will be the same if the URL directly addressed theproperty. If the URL addressed the node whose primary item chain ultimately resolved to the property, the {@link #getItem()} will return the node and{@link #getProperty()} will return the resolved property.
A note on the InputStream
available from {@link #getInputStream()}: Unlike other implementations - for example for file:
or http:
URLs - which return the same stream on each call, this implementation returns a new stream on each invocation.
The following header fields are implemented by this class:
Content-Length
Property.getLength()
method, which returns the size in bytes of the property's value for binary values and the number of characters used for the string representation of the value for all other value types. Content-Type
nt:resource
node, the content type is retrieved from the jcr:mimeType
property of the parent node. If the parent node is not a nt:resource
, the guessContentTypeFromName
method is called on the {@link #getPath() path}. If this does not yield a content type, it is set to application/octet-stream
for binary properties and to text/plain
for other types. Content-Enconding
nt:resource
node, the content encoding is retrieved from the jcr:econding
property of the parent node. If the jcr:encoding
property is not set, this header field remains undefined (aka null
). Last-Modified
nt:resource
node, the last modified type is retrieved from the jcr:lastModified
property of the parent node. If the parent node is not a nt:resource
, the last modification time is set to zero. This class is not intended to be subclassed or instantiated by clients. @author Felix Meschberger
|
|