org.apache.jackrabbit.webdav.simple
Class NodeResource

java.lang.Object
  extended byorg.apache.jackrabbit.webdav.simple.NodeResource

public class NodeResource
extends Object

The NodeResource class wraps a jcr item in order to respond to 'GET', 'HEAD', 'PROPFIND' or 'PROPPATCH' requests. If the item is a Node its primary property is determined. The value of the primary property can be accessed by getStream(). If possible other required information (last modification date, content type...) is retrieved from the property siblings.
If the requested item is a Property it is treated accordingly.


Field Summary
static SimpleDateFormat creationDateFormat
          Simple date format for the creation date ISO representation (partial).
static SimpleDateFormat modificationDateFormat
          modificationDate date format per RFC 1123
 
Constructor Summary
NodeResource(org.apache.jackrabbit.webdav.DavResource davResource, Node node)
          Create a new NodeResource that wraps a JSR170 item.
 
Method Summary
 String getContentLanguage()
          Return the content language or null if it could not be determined.
 long getContentLength()
          Return the content length or '0'.
 String getContentType()
          Return the content type or null if it could not be determined.
 String getCreationDate()
          Return the creation time as formatted string.
 long getCreationTime()
          Return the creation time or '0'.
 String getETag()
          Return the ETag or null if the context does not provide one.
 String getLastModified()
          Return the last modification time as formatted string.
 long getModificationTime()
          Return the last modification time.
 InputStream getStream()
          Return a stream to the resource value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modificationDateFormat

public static SimpleDateFormat modificationDateFormat
modificationDate date format per RFC 1123


creationDateFormat

public static SimpleDateFormat creationDateFormat
Simple date format for the creation date ISO representation (partial).

Constructor Detail

NodeResource

public NodeResource(org.apache.jackrabbit.webdav.DavResource davResource,
                    Node node)
             throws ItemNotFoundException,
                    RepositoryException
Create a new NodeResource that wraps a JSR170 item.

Throws:
ItemNotFoundException
RepositoryException
IllegalArgumentException - if the given item is null
Method Detail

getContentLength

public long getContentLength()
Return the content length or '0'.

Returns:
content Length or '0' if it could not be determined.

getCreationTime

public long getCreationTime()
Return the creation time or '0'.

Returns:
creation time or '0' if it could not be determined.

getModificationTime

public long getModificationTime()
Return the last modification time. By default it is set to the current time.

Returns:
time of last modification or the current time, if it could not be determined.

getLastModified

public String getLastModified()
Return the last modification time as formatted string.

Returns:
last modification time as string.
See Also:
modificationDateFormat

getCreationDate

public String getCreationDate()
Return the creation time as formatted string.

Returns:
creation time as string.
See Also:
creationDateFormat

getETag

public String getETag()
Return the ETag or null if the context does not provide one.

Returns:
String representing a strong or weak ETag or null

getContentType

public String getContentType()
Return the content type or null if it could not be determined.

Returns:
content type

getContentLanguage

public String getContentLanguage()
Return the content language or null if it could not be determined.

Returns:
content language

getStream

public InputStream getStream()
Return a stream to the resource value.

Returns:


Copyright © 2005 . All Rights Reserved.