org.w3c.jigsaw.webdav
Class DAVFrame

java.lang.Object
  extended by org.w3c.tools.resources.AttributeHolder
      extended by org.w3c.tools.resources.Resource
          extended by org.w3c.tools.resources.FramedResource
              extended by org.w3c.tools.resources.ResourceFrame
                  extended by org.w3c.tools.resources.ProtocolFrame
                      extended by org.w3c.jigsaw.frames.HTTPFrame
                          extended by org.w3c.jigsaw.frames.PostableFrame
                              extended by org.w3c.jigsaw.webdav.DAVFrame
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, AttributeChangedListener, FrameEventListener
Direct Known Subclasses:
CvsDAVDirectoryFrame, CvsDAVFileFrame

public class DAVFrame
extends PostableFrame


Field Summary
protected static int ATTR_CREATION_DATE
          Attribute index - The index for the creation date attribute.
protected static int ATTR_DEAD_PROPERTIES
          Attribute index - The index for the dead properties
protected static int ATTR_LOCK_DATE
          Attribute index - The index for the lock date
protected static int ATTR_LOCK_DEPTH
          Attribute index - The index for the lock depth
protected static int ATTR_LOCK_OWNER
          Attribute index - The index for the lock owner
protected static int ATTR_LOCK_TIMEOUT
          Attribute index - The index for the lock token
protected static int ATTR_LOCK_TOKEN
          Attribute index - The index for the lock token
protected static int ATTR_LOCK_USERNAME
          Attribute index - The index for the lock username
protected static HttpMimeType collectioncontenttype
           
static int COND_OK_LOCK
          Condition check return code - Condition existed and succeeded.
protected  java.util.Hashtable deadindex
           
protected  boolean deadpropmodified
           
static boolean debug
           
static boolean debugxml
           
static java.lang.Long DEFAULT_LOCK_TIMEOUT
           
static java.lang.String LOCK_EXPIRE
           
static java.lang.String LOCK_OWNER
           
static java.lang.String LOCK_TIMEOUT
           
static java.lang.String LOCK_TOKEN
           
static java.lang.String LOCK_USERNAME
           
static java.lang.String LOCKED_REREFENCE
           
protected  DAVManager manager
          The DAVManager we use.
static java.lang.Long MAX_LOCK_TIMEOUT
           
protected  org.w3c.dom.Node ownerNode
           
static java.lang.String REMAINING_PATH
          Name ot the state to hold the remaining path (used with MKCOL)
protected static HttpMimeType xmlcontenttype
          Cached mime type
 
Fields inherited from class org.w3c.jigsaw.frames.PostableFrame
ATTR_CONVERT_GET, ATTR_OVERIDE
 
Fields inherited from class org.w3c.jigsaw.frames.HTTPFrame
acceptRanges, allowed, ATTR_ALLOW_DEL, ATTR_BROWSABLE, ATTR_CHARSET, ATTR_CONTENT_ENCODING, ATTR_CONTENT_LANGUAGE, ATTR_CONTENT_LENGTH, ATTR_CONTENT_TYPE, ATTR_ICON, ATTR_ICONDIR, ATTR_INDEX, ATTR_INDEXES, ATTR_MAXAGE, ATTR_MD5, ATTR_PUTABLE, ATTR_QUALITY, ATTR_RELOCATE, ATTR_STYLE_LINK, ATTR_TITLE, browsetype, COND_FAILED, COND_OK, COND_WEAK, dresource, fresource, listing, listing_stamp, STATE_CONTENT_LOCATION
 
Fields inherited from class org.w3c.tools.resources.ResourceFrame
filterClass, frameListener, resource
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
Fields inherited from class org.w3c.tools.resources.Resource
ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id
 
Fields inherited from class org.w3c.tools.resources.AttributeHolder
attributes, values
 
Constructor Summary
DAVFrame()
           
 
Method Summary
protected static boolean acceptRedirect(DAVRequest request)
           
protected  void addContentLanguage(DAVProperties props)
           
protected  void addContentLength(DAVProperties props)
           
protected  void addContentType(DAVProperties props)
           
protected  void addCreationDate(DAVProperties props)
           
protected  void addDisplayName(DAVProperties props)
           
protected  void addETag(DAVProperties props)
           
protected  void addIsCollection(DAVProperties props)
           
protected  void addLastModified(DAVProperties props)
           
protected  void addLockDiscovery(DAVRequest request, DAVProperties prop)
           
protected  void addLockDiscovery(DAVRequest request, org.w3c.dom.Node parent)
           
protected  void addResourceType(DAVProperties props)
           
protected  void addSupportedLock(DAVProperties prop)
           
protected  int checkIf(DAVRequest request)
          Check the If condition of that request.
protected  boolean checkLockOwner(DAVRequest request)
           
protected  void closeInternalReply(DAVReply reply)
           
protected  java.net.URL computeDestURL(java.net.URL parent, DAVFrame df)
           
 Reply copy(DAVRequest request)
          Handle the COPY request.
protected  Reply copyCollection(java.net.URL destination, DAVRequest request, boolean overwrite)
          Handle the COPY request for a collection
protected  Reply copyCollection(java.net.URL destination, DAVRequest request, boolean overwrite, DAVBody body, org.w3c.dom.Document document)
           
protected  DAVReply copyDAVResource(DAVRequest req, java.net.URL source, java.net.URL destination, DAVBody body)
           
protected  void copyProperties(DAVRequest req, java.net.URL destination, DAVBody body)
           
protected  Reply copyResource(java.net.URL dst, DAVRequest request, boolean overwrite)
          Handle the COPY request for a simple resource (not a collection)
protected  Reply createDAVReply(DAVRequest request, int status, org.w3c.dom.Document document)
          Create a DAV reply for a specific DAV request.
protected  DAVRequest createInternalRequest(DAVRequest req, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers)
           
protected  DAVRequest createInternalRequest(DAVRequest request, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, org.w3c.dom.Document document)
           
protected  DAVRequest createInternalRequest(DAVRequest req, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, java.io.InputStream in)
           
protected  DAVRequest createRequest(DAVRequest request, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers)
           
protected  DAVRequest createRequest(DAVRequest request, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, org.w3c.dom.Document document)
           
protected  DAVRequest createRequest(DAVRequest req, java.lang.String mtd, java.net.URL url, java.util.Hashtable headers, java.io.InputStream in)
           
 Reply davextended(DAVRequest request)
           
protected  java.lang.String decodeURL(DAVRequest request, java.lang.String encoded)
           
 Reply delete(Request request)
          The WEBDAV DELETE method, actually the resource (file, directory) is moved into the trash directory which is not accessible via HTTP.
protected  Reply dupReply(DAVRequest request, DAVReply rep, boolean created)
          Kind of proxying the reply but only for headers.
 Reply extended(Request request)
          The handler for unknown method replies with a not implemented.
 Reply get(Request request)
          Get this resource body.
protected  HttpTokenList getAllow()
          get the Allowed methods for this resource
protected  DAVBody getBody(DAVRequest request)
           
protected  DAVResponse[] getChildResponses(DAVRequest request, DAVPropFind dpf, org.w3c.dom.Document document, boolean deep)
          Get an appropriate DAV Response to the given PROPFIND request from our children
 long getCreationDate()
          Get this resource creation date
protected  int getCurrentLockDepth()
          Get the lock depth
protected  org.w3c.dom.Node getCurrentLockOwner(DAVRequest request)
          Get the lock owner
protected  long getCurrentLockTimeout(DAVRequest request)
           
protected  java.lang.String getCurrentLockToken(DAVRequest request)
          Get the lock token
protected  java.lang.String getCurrentLockUsername(DAVRequest request)
          Get the username of the client that lock the resource
 ArrayDictionary getDeadProperties()
          Get the dead properties
protected  java.util.Hashtable getDeadPropertiesIndex()
           
protected  java.lang.String getNewLockToken()
           
protected  DAVProperties getProperties(DAVRequest request, org.w3c.dom.Document doc)
          Get all the properties of our associated resource.
protected  DAVProperties getProperties(DAVRequest request, org.w3c.dom.Document doc, DAVProperties dp)
          Get the properties of our associated resource require in the given DAVProperties Object.
protected  DAVProperties getPropertiesForCopy(org.w3c.dom.Document doc)
           
protected  DAVProperties getPropNames(DAVRequest request, org.w3c.dom.Document doc)
          Get all the property names of our associated resource.
protected  DAVPropStat[] getPropStat(DAVRequest request, org.w3c.dom.Document doc, DAVProperties dp)
           
protected  DAVResponse getResponse(DAVRequest request, DAVPropFind dpf, org.w3c.dom.Document document)
          Get an appropriate DAV Response to the given PROPFIND request
protected  java.lang.String getStatusLine(int status)
           
protected  long getTokenExpirationDate(DAVRequest request)
          Get the lock token expiration date
protected  boolean hasIntProperty(int idx)
           
protected  boolean hasLongProperty(int idx)
           
protected  boolean hasProperty(int idx)
           
protected  boolean hasStringProperty(int idx)
           
 void initialize(java.lang.Object[] values)
          Initialize the frames of that framed resource.
protected  Reply internalCopyCollection(java.net.URL destination, DAVRequest request, boolean overwrite, DAVBody body, org.w3c.dom.Document document)
           
protected  DAVReply internalCopyDAVResource(DAVRequest req, java.net.URL source, java.net.URL destination, DAVBody body)
           
protected  void internalCopyProperties(DAVRequest req, java.net.URL destination, DAVBody body)
           
protected  Reply internalCopyResource(java.net.URL dst, DAVRequest request, boolean overwrite)
          Handle the COPY request for a simple resource (not a collection)
 boolean isCollection()
           
protected  boolean isLockable(DAVRequest request)
           
protected  boolean isLocked(DAVRequest request)
          Check if this resource or one of their parent (with depth equals to infinity) has been locked
protected static boolean isReadOnly(java.lang.String propname)
           
 Reply lock(DAVRequest request)
          Handle the LOCK request.
protected  void lock(java.lang.String token, int depth, java.lang.String[] timeouts, java.lang.String username, org.w3c.dom.Node owner)
          lock this resource
protected  boolean lookupDirectory(LookupState ls, LookupResult lr)
          Lookup the target resource when associated with a DirectoryResource.
protected  boolean lookupResource(LookupState ls, LookupResult lr)
          Lookup the target resource (dispath to more specific lookup methods).
protected  boolean matchETag(HttpEntityTag retag)
           
protected  boolean matchLockToken(DAVRequest request, java.lang.String locktoken)
           
 Reply mkcol(DAVRequest request)
          Handle the MKCOL request.
 Reply move(DAVRequest request)
          Handle the MOVE request.
 Reply options(Request request)
          The WEBDAV OPTIONS method replies with the DAV Header
 ReplyInterface perform(RequestInterface req)
          Perform the request
 Reply post(Request request)
          Perform the post method.
 Reply propfind(DAVRequest request)
          Handle the PROPFIND request.
 Reply proppatch(DAVRequest request)
          Handle the PROPPATCH request.
 Reply put(Request request)
          The WEBDAV PUT method.
protected  void refreshLock(java.lang.String[] timeouts)
           
 void registerResource(FramedResource resource)
          companion to initialize, called after the register
protected  void reloadDeadProperties()
           
protected  DAVPropStat removeDAVProperties(DAVProperties props, org.w3c.dom.Document document)
           
protected  void removeDeadProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void removeDeadProperty(org.w3c.dom.Element el)
           
protected  void removeLiveProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void saveDeadProperties()
           
protected  DAVPropStat setDAVProperties(DAVProperties props, org.w3c.dom.Document document)
           
protected  void setDeadProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void setDeadProperty(org.w3c.dom.Element el)
           
protected  void setLiveProperty(DAVNode node, DAVProperties okdp, org.w3c.dom.Document document)
           
protected  void setLockOwner(org.w3c.dom.Node owner)
          Set the lock Owner
protected  void setTimeout(java.lang.String[] timeouts)
           
protected  void skipBody(DAVReply reply)
          Should be called to purge the reply, otherwise the connection won't be marked idle and won't be reused.
protected  void unlock()
           
 Reply unlock(DAVRequest request)
          Handle the UNLOCK request.
protected  void updateLockDate(DAVRequest request)
           
 
Methods inherited from class org.w3c.jigsaw.frames.PostableFrame
getConvertGetFlag, getOverrideFlag, handle
 
Methods inherited from class org.w3c.jigsaw.frames.HTTPFrame
addStyleSheet, attributeChanged, browse, checkExpect, checkIfMatch, checkIfModifiedSince, checkIfNoneMatch, checkIfUnmodifiedSince, checkRequest, checkValidators, computeContainerListing, computeETag, computeTrashDir, computeTrashFile, createDefaultReply, createFileReply, deleteDirectoryResource, deleteFileResource, deleteMe, deleteOtherResource, getAllowDeleteFlag, getBrowsableFlag, getBrowseType, getCharset, getContentEncoding, getContentLanguage, getContentLength, getContentType, getDirectoryListing, getDirectoryResource, getDirectoryResource, getETag, getFileResource, getFileResource, getHelpURL, getHelpURL, getIcon, getIconDirectory, getIndex, getIndexes, getMaxAge, getMD5Flag, getOtherResource, getPutableFlag, getQuality, getRelocateFlag, getStyleSheetURL, getTitle, getURL, handleRangeRequest, head, headDirectoryResource, headFileResource, headOtherResource, initialize, link, lookup, lookupFile, lookupOther, performFrames, pickleValues, putFileResource, putOtherResource, registerOtherResource, setValue, trace, unlink, unsafeGetQuality, updateCachedHeaders
 
Methods inherited from class org.w3c.tools.resources.ResourceFrame
addFrameEventListener, eventDisabled, fireFrameEvent, frameModified, getFilters, getFilters, getFrameReference, getResource, getResourceReference, getSpaceEntry, getURLPath, lookupFilters, lookupFrames, postFrameEvent, processEvent, removeFrameEventListener, unregisterResource, updateDefaultChildAttributes
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, markModified, notifyUnload, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, isInitialized, isUnloaded, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, unsafeGetValue, updateAttributes
 
Methods inherited from class org.w3c.tools.resources.AttributeHolder
definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static final boolean debug
See Also:
Constant Field Values

debugxml

public static final boolean debugxml
See Also:
Constant Field Values

COND_OK_LOCK

public static final int COND_OK_LOCK
Condition check return code - Condition existed and succeeded. And lock has been checked

See Also:
Constant Field Values

xmlcontenttype

protected static HttpMimeType xmlcontenttype
Cached mime type


collectioncontenttype

protected static HttpMimeType collectioncontenttype

manager

protected DAVManager manager
The DAVManager we use.


REMAINING_PATH

public static final java.lang.String REMAINING_PATH
Name ot the state to hold the remaining path (used with MKCOL)

See Also:
Constant Field Values

LOCK_USERNAME

public static final java.lang.String LOCK_USERNAME
See Also:
Constant Field Values

LOCK_TOKEN

public static final java.lang.String LOCK_TOKEN
See Also:
Constant Field Values

LOCK_OWNER

public static final java.lang.String LOCK_OWNER
See Also:
Constant Field Values

LOCK_EXPIRE

public static final java.lang.String LOCK_EXPIRE
See Also:
Constant Field Values

LOCK_TIMEOUT

public static final java.lang.String LOCK_TIMEOUT
See Also:
Constant Field Values

LOCKED_REREFENCE

public static final java.lang.String LOCKED_REREFENCE
See Also:
Constant Field Values

DEFAULT_LOCK_TIMEOUT

public static final java.lang.Long DEFAULT_LOCK_TIMEOUT

MAX_LOCK_TIMEOUT

public static final java.lang.Long MAX_LOCK_TIMEOUT

ATTR_CREATION_DATE

protected static int ATTR_CREATION_DATE
Attribute index - The index for the creation date attribute.


ATTR_DEAD_PROPERTIES

protected static int ATTR_DEAD_PROPERTIES
Attribute index - The index for the dead properties


ATTR_LOCK_TOKEN

protected static int ATTR_LOCK_TOKEN
Attribute index - The index for the lock token


ATTR_LOCK_TIMEOUT

protected static int ATTR_LOCK_TIMEOUT
Attribute index - The index for the lock token


ATTR_LOCK_DATE

protected static int ATTR_LOCK_DATE
Attribute index - The index for the lock date


ATTR_LOCK_DEPTH

protected static int ATTR_LOCK_DEPTH
Attribute index - The index for the lock depth


ATTR_LOCK_OWNER

protected static int ATTR_LOCK_OWNER
Attribute index - The index for the lock owner


ATTR_LOCK_USERNAME

protected static int ATTR_LOCK_USERNAME
Attribute index - The index for the lock username


ownerNode

protected org.w3c.dom.Node ownerNode

deadindex

protected java.util.Hashtable deadindex

deadpropmodified

protected boolean deadpropmodified
Constructor Detail

DAVFrame

public DAVFrame()
Method Detail

isReadOnly

protected static boolean isReadOnly(java.lang.String propname)

acceptRedirect

protected static boolean acceptRedirect(DAVRequest request)

isCollection

public boolean isCollection()

getCreationDate

public long getCreationDate()
Get this resource creation date

Returns:
A long giving the creation date or -1 if undefined.

updateLockDate

protected void updateLockDate(DAVRequest request)

getTokenExpirationDate

protected long getTokenExpirationDate(DAVRequest request)
Get the lock token expiration date

Returns:
A long giving the expiration date or -1 if undefined.

getCurrentLockToken

protected java.lang.String getCurrentLockToken(DAVRequest request)
Get the lock token

Returns:
A String instance or null

getCurrentLockTimeout

protected long getCurrentLockTimeout(DAVRequest request)

getCurrentLockOwner

protected org.w3c.dom.Node getCurrentLockOwner(DAVRequest request)
Get the lock owner

Returns:
A String instance or null

setLockOwner

protected void setLockOwner(org.w3c.dom.Node owner)
Set the lock Owner


getCurrentLockDepth

protected int getCurrentLockDepth()
Get the lock depth

Returns:
An int (WEBDAV.DEPTH_0 or WEBDAV.DEPTH_INFINITY)

getCurrentLockUsername

protected java.lang.String getCurrentLockUsername(DAVRequest request)
Get the username of the client that lock the resource


isLocked

protected boolean isLocked(DAVRequest request)
Check if this resource or one of their parent (with depth equals to infinity) has been locked

Parameters:
request - the incomming request (it null isLocked will returns true if and only if the resource has been personally locked, not one of its parents)
Returns:
a boolean

setTimeout

protected void setTimeout(java.lang.String[] timeouts)

refreshLock

protected void refreshLock(java.lang.String[] timeouts)

lock

protected void lock(java.lang.String token,
                    int depth,
                    java.lang.String[] timeouts,
                    java.lang.String username,
                    org.w3c.dom.Node owner)
             throws HTTPException
lock this resource

Parameters:
token - the lock token
depth - the lock depth (0 or -1)
timeout - the lock timeout
Throws:
HTTPException

unlock

protected void unlock()

addSupportedLock

protected void addSupportedLock(DAVProperties prop)

addLockDiscovery

protected void addLockDiscovery(DAVRequest request,
                                DAVProperties prop)

addLockDiscovery

protected void addLockDiscovery(DAVRequest request,
                                org.w3c.dom.Node parent)

getDeadProperties

public ArrayDictionary getDeadProperties()
Get the dead properties

Returns:
a ArrayDictionary instance
See Also:
ArrayDictionary

getDeadPropertiesIndex

protected java.util.Hashtable getDeadPropertiesIndex()

setDeadProperty

protected void setDeadProperty(org.w3c.dom.Element el)
                        throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

removeDeadProperty

protected void removeDeadProperty(org.w3c.dom.Element el)
                           throws org.w3c.dom.DOMException
Throws:
org.w3c.dom.DOMException

reloadDeadProperties

protected void reloadDeadProperties()

saveDeadProperties

protected void saveDeadProperties()

getAllow

protected HttpTokenList getAllow()
get the Allowed methods for this resource

Overrides:
getAllow in class PostableFrame
Returns:
an HttpTokenList

getBody

protected DAVBody getBody(DAVRequest request)
                   throws HTTPException
Throws:
HTTPException

options

public Reply options(Request request)
              throws ProtocolException,
                     ResourceException
The WEBDAV OPTIONS method replies with the DAV Header

Overrides:
options in class HTTPFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - In case of errors.
ResourceException - If the resource got a fatal error.

perform

public ReplyInterface perform(RequestInterface req)
                       throws ProtocolException,
                              ResourceException
Perform the request

Overrides:
perform in class HTTPFrame
Parameters:
req - The request to handle.
Returns:
a ReplyInterface instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

extended

public Reply extended(Request request)
               throws ProtocolException,
                      ResourceException
The handler for unknown method replies with a not implemented.

Overrides:
extended in class HTTPFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

davextended

public Reply davextended(DAVRequest request)
                  throws ProtocolException,
                         ResourceException
Throws:
ProtocolException
ResourceException

decodeURL

protected java.lang.String decodeURL(DAVRequest request,
                                     java.lang.String encoded)
                              throws HTTPException
Throws:
HTTPException

isLockable

protected boolean isLockable(DAVRequest request)

checkLockOwner

protected boolean checkLockOwner(DAVRequest request)

checkIf

protected int checkIf(DAVRequest request)
               throws HTTPException
Check the If condition of that request.

Parameters:
request - The request to check.
Returns:
An integer, either COND_FAILED if condition was checked, but failed, COND_OK if condition was checked and succeeded, or 0 if the condition was not checked at all (eg because the resource or the request didn't support it).
Throws:
HTTPException

matchETag

protected boolean matchETag(HttpEntityTag retag)

matchLockToken

protected boolean matchLockToken(DAVRequest request,
                                 java.lang.String locktoken)

delete

public Reply delete(Request request)
             throws ProtocolException,
                    ResourceException
The WEBDAV DELETE method, actually the resource (file, directory) is moved into the trash directory which is not accessible via HTTP.

Overrides:
delete in class HTTPFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

get

public Reply get(Request request)
          throws ProtocolException,
                 ResourceException
Get this resource body. If we are allowed to convert GET requests to POST, than we first check to see if there is some search string in the request, and continue with normal POST request processing.

If there is no search string, or if we are not allowed to convert GETs to POSTs, than we just invoke our super method, which will perform the appropriate job.

Overrides:
get in class PostableFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - If request couldn't be processed.
ResourceException - If the resource got a fatal error.

put

public Reply put(Request request)
          throws ProtocolException,
                 ResourceException
The WEBDAV PUT method.

Overrides:
put in class HTTPFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

post

public Reply post(Request request)
           throws ProtocolException,
                  ResourceException
Perform the post method.

Overrides:
post in class PostableFrame
Parameters:
request - The request to handle.
Throws:
ProtocolException - If request couldn't be processed.
ResourceException - If the resource got a fatal error.

hasProperty

protected boolean hasProperty(int idx)

hasStringProperty

protected boolean hasStringProperty(int idx)

hasLongProperty

protected boolean hasLongProperty(int idx)

hasIntProperty

protected boolean hasIntProperty(int idx)

addCreationDate

protected void addCreationDate(DAVProperties props)

addDisplayName

protected void addDisplayName(DAVProperties props)

addContentLanguage

protected void addContentLanguage(DAVProperties props)

addContentType

protected void addContentType(DAVProperties props)

addContentLength

protected void addContentLength(DAVProperties props)

addETag

protected void addETag(DAVProperties props)

addLastModified

protected void addLastModified(DAVProperties props)

addResourceType

protected void addResourceType(DAVProperties props)

addIsCollection

protected void addIsCollection(DAVProperties props)

getProperties

protected DAVProperties getProperties(DAVRequest request,
                                      org.w3c.dom.Document doc,
                                      DAVProperties dp)
Get the properties of our associated resource require in the given DAVProperties Object.

Parameters:
doc - the response XML Document
dp - the DAVProperties node in found the request body
Returns:
a DAVProperties instance

getPropStat

protected DAVPropStat[] getPropStat(DAVRequest request,
                                    org.w3c.dom.Document doc,
                                    DAVProperties dp)

getProperties

protected DAVProperties getProperties(DAVRequest request,
                                      org.w3c.dom.Document doc)
Get all the properties of our associated resource.

Parameters:
doc - the response XML Document
Returns:
a DAVProperties instance

getPropertiesForCopy

protected DAVProperties getPropertiesForCopy(org.w3c.dom.Document doc)

getPropNames

protected DAVProperties getPropNames(DAVRequest request,
                                     org.w3c.dom.Document doc)
Get all the property names of our associated resource.

Parameters:
doc - the response XML Document
Returns:
a DAVProperties instance

getResponse

protected DAVResponse getResponse(DAVRequest request,
                                  DAVPropFind dpf,
                                  org.w3c.dom.Document document)
Get an appropriate DAV Response to the given PROPFIND request

Parameters:
request - the DAV Request
dpf - the DAVPropFind XML Node (can be null)
document - the XML document
Returns:
a DAVResponse

getChildResponses

protected DAVResponse[] getChildResponses(DAVRequest request,
                                          DAVPropFind dpf,
                                          org.w3c.dom.Document document,
                                          boolean deep)
Get an appropriate DAV Response to the given PROPFIND request from our children

Parameters:
request - the DAV Request
dpf - the DAVPropFind XML Node (can be null)
document - the XML document
deep - do it recursivly if true
Returns:
a DAVResponse array

createDAVReply

protected Reply createDAVReply(DAVRequest request,
                               int status,
                               org.w3c.dom.Document document)
Create a DAV reply for a specific DAV request.

Parameters:
request - the DAVRequest
status - the status of the reply
document - the XML content of the reply
Returns:
a Reply instance

getStatusLine

protected java.lang.String getStatusLine(int status)

propfind

public Reply propfind(DAVRequest request)
               throws ProtocolException,
                      ResourceException
Handle the PROPFIND request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

setDAVProperties

protected DAVPropStat setDAVProperties(DAVProperties props,
                                       org.w3c.dom.Document document)
                                throws DAVPropertyException
Throws:
DAVPropertyException

setDeadProperty

protected void setDeadProperty(DAVNode node,
                               DAVProperties okdp,
                               org.w3c.dom.Document document)
                        throws DAVPropertyException
Throws:
DAVPropertyException

setLiveProperty

protected void setLiveProperty(DAVNode node,
                               DAVProperties okdp,
                               org.w3c.dom.Document document)
                        throws DAVPropertyException
Throws:
DAVPropertyException

removeDAVProperties

protected DAVPropStat removeDAVProperties(DAVProperties props,
                                          org.w3c.dom.Document document)
                                   throws DAVPropertyException
Throws:
DAVPropertyException

removeLiveProperty

protected void removeLiveProperty(DAVNode node,
                                  DAVProperties okdp,
                                  org.w3c.dom.Document document)
                           throws DAVPropertyException
Throws:
DAVPropertyException

removeDeadProperty

protected void removeDeadProperty(DAVNode node,
                                  DAVProperties okdp,
                                  org.w3c.dom.Document document)
                           throws DAVPropertyException
Throws:
DAVPropertyException

proppatch

public Reply proppatch(DAVRequest request)
                throws ProtocolException,
                       ResourceException
Handle the PROPPATCH request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

mkcol

public Reply mkcol(DAVRequest request)
            throws ProtocolException,
                   ResourceException
Handle the MKCOL request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

createRequest

protected DAVRequest createRequest(DAVRequest req,
                                   java.lang.String mtd,
                                   java.net.URL url,
                                   java.util.Hashtable headers,
                                   java.io.InputStream in)

createRequest

protected DAVRequest createRequest(DAVRequest request,
                                   java.lang.String mtd,
                                   java.net.URL url,
                                   java.util.Hashtable headers)

createRequest

protected DAVRequest createRequest(DAVRequest request,
                                   java.lang.String mtd,
                                   java.net.URL url,
                                   java.util.Hashtable headers,
                                   org.w3c.dom.Document document)

createInternalRequest

protected DAVRequest createInternalRequest(DAVRequest request,
                                           java.lang.String mtd,
                                           java.net.URL url,
                                           java.util.Hashtable headers,
                                           org.w3c.dom.Document document)

skipBody

protected void skipBody(DAVReply reply)
Should be called to purge the reply, otherwise the connection won't be marked idle and won't be reused.

Parameters:
reply - the reply to purge.

closeInternalReply

protected void closeInternalReply(DAVReply reply)

createInternalRequest

protected DAVRequest createInternalRequest(DAVRequest req,
                                           java.lang.String mtd,
                                           java.net.URL url,
                                           java.util.Hashtable headers,
                                           java.io.InputStream in)

createInternalRequest

protected DAVRequest createInternalRequest(DAVRequest req,
                                           java.lang.String mtd,
                                           java.net.URL url,
                                           java.util.Hashtable headers)

copy

public Reply copy(DAVRequest request)
           throws ProtocolException,
                  ResourceException
Handle the COPY request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

dupReply

protected Reply dupReply(DAVRequest request,
                         DAVReply rep,
                         boolean created)
Kind of proxying the reply but only for headers.


copyCollection

protected Reply copyCollection(java.net.URL destination,
                               DAVRequest request,
                               boolean overwrite)
                        throws ProtocolException,
                               ResourceException
Handle the COPY request for a collection

Parameters:
dst - the destination URL
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

copyCollection

protected Reply copyCollection(java.net.URL destination,
                               DAVRequest request,
                               boolean overwrite,
                               DAVBody body,
                               org.w3c.dom.Document document)
                        throws ProtocolException,
                               ResourceException,
                               MultiStatusException
Throws:
ProtocolException
ResourceException
MultiStatusException

internalCopyCollection

protected Reply internalCopyCollection(java.net.URL destination,
                                       DAVRequest request,
                                       boolean overwrite,
                                       DAVBody body,
                                       org.w3c.dom.Document document)
                                throws ProtocolException,
                                       ResourceException,
                                       MultiStatusException
Throws:
ProtocolException
ResourceException
MultiStatusException

computeDestURL

protected java.net.URL computeDestURL(java.net.URL parent,
                                      DAVFrame df)
                               throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

copyResource

protected Reply copyResource(java.net.URL dst,
                             DAVRequest request,
                             boolean overwrite)
                      throws ProtocolException,
                             ResourceException
Handle the COPY request for a simple resource (not a collection)

Parameters:
dst - the destination URL
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

copyDAVResource

protected DAVReply copyDAVResource(DAVRequest req,
                                   java.net.URL source,
                                   java.net.URL destination,
                                   DAVBody body)
                            throws MultiStatusException
Throws:
MultiStatusException

internalCopyResource

protected Reply internalCopyResource(java.net.URL dst,
                                     DAVRequest request,
                                     boolean overwrite)
                              throws ProtocolException,
                                     ResourceException
Handle the COPY request for a simple resource (not a collection)

Parameters:
dst - the destination URL
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

internalCopyDAVResource

protected DAVReply internalCopyDAVResource(DAVRequest req,
                                           java.net.URL source,
                                           java.net.URL destination,
                                           DAVBody body)
                                    throws MultiStatusException
Throws:
MultiStatusException

copyProperties

protected void copyProperties(DAVRequest req,
                              java.net.URL destination,
                              DAVBody body)
                       throws MultiStatusException
Throws:
MultiStatusException

internalCopyProperties

protected void internalCopyProperties(DAVRequest req,
                                      java.net.URL destination,
                                      DAVBody body)
                               throws MultiStatusException
Throws:
MultiStatusException

move

public Reply move(DAVRequest request)
           throws ProtocolException,
                  ResourceException
Handle the MOVE request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

getNewLockToken

protected java.lang.String getNewLockToken()

lock

public Reply lock(DAVRequest request)
           throws ProtocolException,
                  ResourceException
Handle the LOCK request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

unlock

public Reply unlock(DAVRequest request)
             throws ProtocolException,
                    ResourceException
Handle the UNLOCK request.

Parameters:
request - the WEBDAV request
Returns:
a Reply instance
Throws:
ProtocolException - If processsing the request failed.
ResourceException - If the resource got a fatal error.

lookupResource

protected boolean lookupResource(LookupState ls,
                                 LookupResult lr)
                          throws ProtocolException
Lookup the target resource (dispath to more specific lookup methods).

Overrides:
lookupResource in class HTTPFrame
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
ProtocolException - If an error relative to the protocol occurs
See Also:
lookupDirectory(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult), HTTPFrame.lookupFile(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult), HTTPFrame.lookupOther(org.w3c.tools.resources.LookupState, org.w3c.tools.resources.LookupResult)

lookupDirectory

protected boolean lookupDirectory(LookupState ls,
                                  LookupResult lr)
                           throws ProtocolException
Lookup the target resource when associated with a DirectoryResource.

Overrides:
lookupDirectory in class HTTPFrame
Parameters:
ls - The current lookup state
lr - The result
Returns:
true if lookup is done.
Throws:
ProtocolException - If an error relative to the protocol occurs

registerResource

public void registerResource(FramedResource resource)
companion to initialize, called after the register

Overrides:
registerResource in class HTTPFrame
Parameters:
resource - The resource associated with this frame.

initialize

public void initialize(java.lang.Object[] values)
Description copied from class: FramedResource
Initialize the frames of that framed resource.

Overrides:
initialize in class FramedResource
Parameters:
values - Default attribute values.