org.apache.webdav.lib
Class WebdavResource

java.lang.Object
  |
  +--org.apache.webdav.lib.WebdavSession
        |
        +--org.apache.webdav.lib.WebdavResource
All Implemented Interfaces:
org.apache.commons.httpclient.ConnectionInterceptor

public class WebdavResource
extends WebdavSession

The class WebdavResource is an abstract representation for WebDAV resource.

 A functional comparison of WebdavResource and JDK(It's different a lot).
 ----------------------------------+-------------------------------------
   File class (JDK 1.3.x)          |  WebdavResource class
 ----------------------------------+-------------------------------------
   File(String)                    |  WebdavResource(HttpURL)
   File(String, String)            |  X (need to escape)
   File(File, String)              |  WebdavResource(HttpURL, String)
   getName()                       |  *see getHttpURL() and HttpURL
   getParaent()                    |  *see getHttpURL() and HttpURL
   getParentFile()                 |  X (not yet)
   getPath()                       |  *see getHttpURL() and HttpURL
   isAbsolute()                    |  X
   getAbsolutePath()               |
   getAbsoluteFile()               |  X
   getCanonicalPath()              |
   getCanonicalFile()              |  X
   toURL()                         |  *see HttpURL
   canRead()                       |
   !canWrite()                     |  !isLocked()
   exists()                        |  exists()
   isDirectory()                   |  isCollection()
   isFile()                        |  !isCollection()
   isHidden()                      |  getIsHidden()
   lastModified()                  |  getGetLastModified()
   length()                        |  getGetContentLength()
   createNewFile()                 |  putMethod(String)
   delete()                        |  deleteMethod()
   deleteOnExit()                  |  X
   list()                          |  list()
   list(FilenameFilter)            |  X
   listFiles()                     |  listWebdavResources()
   listFiles(FilenameFilter)       |  X
   listFiles(FileFilter)           |  X
   mkdir()                         |  mkcolMethod()
   mkdirs()                        |  mkcolMethod()
   renameTo(File)                  |  moveMethod(String)
   setLastModified()               |  X
   setReadOnly()                   |  setOverwrite(boolean)
   listRoots()                     |  *see WebdavSession
   generateFile()                  |
   createTempFile(...)             |  setGetTempDir(String)
   compareTo(Object)               |  compareTo(Object)
   equals(Object)                  |  equals(Object)
   hashCode()                      |  X
 ----------------------------------+-------------------------------------
   URL class (JDK 1.3.x)           |  Webdavresource and HttpURL classes
 ----------------------------------+-------------------------------------
   getQuery()                      |  getQuery()
   getPath()                       |  getPath()
   getUserInfo()                   |  getUserInfo()
   getAuthority()                  |  getAuthority()
   getPort()                       |  getPort()
   getProtocol()                   |  getScheme()
   getHost()                       |  getHost()
   getFile()                       |  getPath()
   getRef()                        |  getFragmenet()
   hashCode()                      |  X
   sameFile()                      |
   toExternalForm()                |  toExternalForm()
   openConnection()                |
   openStream()                    |
   getContent()                    |  getMethodDataAsString()
 ----------------------------------+-------------------------------------
   URLConnection class (JDK 1.3.x) |  HttpClient Library and more
 ----------------------------------+-------------------------------------
   getFileNameMap()                |  X
   setFileNameMap()                |  X
   connect()                       |
   getURL()                        |  HttpURL#getURL()
   getContenetLength()()           |
   getContentType()                |
   getContentEncoding()            |
   getExpiration()                 |
   getDate()                       |
   getLastModified()               |
   getHeaderField()                |
   getHeaderFieldInt()             |  X
   getHeaderFielDate()             |  X
   getHeaderFieldKey()             |  X
   getHeaderFiled(int)             |  X
   getContenet()                   |
   getInputStream()                |  WebdavResource#getMethodData()
   getOutputStream()               |  WebdavResource#putMethod(...)
   setDoInput()                    |  X
   getDoInput()                    |  X
   setAllowUserInteraction()       |  *see WebdavException and WebdavStatus
   getAllowUserInteraction()       |  *see WebdavException and WebdavStatus
   setUseCaches()                  |
   getUseCaches()                  |
   getIfModifiedSince()            |  X
   setIfModifiedSince(boolean)     |  X
   setRequestProperty(...)         |  X
   getRequestProperty(...)         |  X
   guessContentTypeFromStream(...) |  X
 ----------------------------------+-------------------------------------
 

Author:
Park, Sung-Gu, Dirk Verbeeck, Remy Maucherat

Field Summary
static int ALL
          The action setting the all properties for this resource.
static int BASIC
          The action setting the basic properties for this resource.
static java.lang.String CREATIONDATE
          The creationdate property.
static int DEFAULT
          The action setting the default DAV properties for this resource.
static java.lang.String defaultOwner
          Owner information for locking and unlocking.
static java.lang.String DISPLAYNAME
          The displayname property.
static java.lang.String FALSE
          The false constant string.
static java.text.SimpleDateFormat[] formats
          Date formats using for Date parsing.
static java.lang.String GETCONTENTLENGTH
          The getcontentlength property.
static java.lang.String GETCONTENTTYPE
          The getcontenttype property.
static java.lang.String GETETAG
          The getetag property.
static java.lang.String GETLASTMODIFIED
          The getlastmodifed property.
protected static java.util.TimeZone gmtZone
          GMT timezone.
static java.lang.String ISCOLLECTION
          The iscollection property.
static java.lang.String ISHIDDEN
          The ishidden property.
static java.lang.String LOCKDISCOVERY
          The lockdiscovery property.
static int NAME
          The action setting only the displayname for this resource.
static int NOACTION
          No action to find properties for this resource.
static java.lang.String RESOURCETYPE
          The resourcetype property.
static java.lang.String SUPPORTEDLOCK
          The supportedlock property.
static java.lang.String TRUE
          The true constant string.
 
Fields inherited from class org.apache.webdav.lib.WebdavSession
client, debug
 
Constructor Summary
WebdavResource(org.apache.util.HttpURL httpURL)
          The constructor.
WebdavResource(org.apache.util.HttpURL httpURL, int depth)
          The constructor.
WebdavResource(org.apache.util.HttpURL httpURL, int action, int depth)
          The constructor.
WebdavResource(org.apache.util.HttpURL httpURL, java.lang.String additionalPath)
          The constructor.
WebdavResource(java.lang.String escapedHttpURL)
          The constructor.
 
Method Summary
(package private) static void ()
           
 AclProperty aclfindMethod(java.lang.String path)
          Return the AclProperty for the resource at the given path returns null if the server doesn't respond with a AclProperty
 boolean aclMethod(java.lang.String path, Ace[] aces)
          Updates the resource with a new set of aces
 void close()
          Close the session of this client
 int compareTo(java.lang.Object another)
          Compare to the given another object.
 int compareToWebdavResource(WebdavResource another)
           
 boolean copyMethod(java.lang.String destination)
           
 boolean copyMethod(java.lang.String source, java.lang.String destination)
           
 boolean deleteMethod()
           
 boolean deleteMethod(java.lang.String path)
           
 boolean equals(java.lang.Object obj)
          Test the object.
 int executeHttpRequestMethod(org.apache.commons.httpclient.HttpClient client, org.apache.commons.httpclient.HttpMethod method)
          Execute the http request method.
 boolean exists()
           
 java.util.Enumeration getActiveLockOwners()
          Get the activelock owners for this resource.
 java.util.Enumeration getAllowedMethods()
          Get the allowed methods, checked by HTTP OPTIONS.
 WebdavResources getChildResources()
           
 long getCreationDate()
          Get the value of DAV property, creationdate.
 java.util.Enumeration getDavCapabilities()
          Get the WebDAV capabilities, checked by HTTP OPTIONS.
static int getDefaultAction()
          Get the default action.
static int getDefaultDepth()
          Get the default action.
 java.lang.String getDisplayName()
          Get the value of DAV property, displayname.
 boolean getExistence()
           
 long getGetContentLength()
          Get the value of DAV property, getcontentlength.
 java.lang.String getGetContentType()
          Get the value of DAV property, getcontenttype.
 java.lang.String getGetEtag()
          Get the value of DAV property, getetag.
 long getGetLastModified()
          Get the value of DAV property, getlastmodified.
static java.lang.String getGetTempDir()
          Get the default temporary directory for the GET method.
static boolean getGetUseDisk()
          Get the use disk flag for the GET method.
 java.lang.String getHost()
          Get the hostname of this WebdavResource.
 org.apache.util.HttpURL getHttpURL()
          Get the HttpURL of this WebdavResource.
 org.apache.util.HttpURL getHttpURLExceptForUserInfo()
          Get the HttpURL except for userinfo.
 boolean getIsCollection()
          Get the value of DAV property, iscollection
 boolean getIsHidden()
          Get the value of DAV property, ishidden.
 LockDiscoveryProperty getLockDiscovery()
          Get the value of DAV property, lockdiscovery.
 boolean getMethod(java.io.File file)
           
 boolean getMethod(java.lang.String path, java.io.File file)
           
 java.io.InputStream getMethodData()
           
 java.lang.String getMethodDataAsString()
           
 boolean getOverwrite()
          Get the current value of the overwrite flag for COPY and MOVE.
 java.lang.String getPath()
          Get the path part of this WebdavResource.
 ResourceTypeProperty getResourceType()
          Get the value of DAV property, resourcetype.
 int getStatusCode()
          Get the lastest value of the status code by HTTP methods.
 java.lang.String getStatusMessage()
          Get the lastest value of the status message by HTTP methods.
 java.lang.String getSupportedLock()
          Get the value of DAV property, supportedlock.
 boolean headMethod()
           
 boolean headMethod(java.lang.String path)
           
 boolean isCollection()
          Get the value of DAV property, resourcetype
 boolean isLocked()
          Test that this resource is locked.
 java.lang.String[] list()
          Get an array of pathnames denoting the WebDAV resources in the collection denoted by this pathname.
 java.util.Vector listBasic()
           
 WebdavResource[] listWebdavResources()
          Get an array of resources denoting the WebDAV child resources in the collection of this resources.
 LockDiscoveryProperty lockDiscoveryPropertyFindMethod(java.lang.String path)
          Return the LockDiscoveryProperty for the resource at the given path returns null if the server doesn't respond with a LockDiscoveryProperty
 boolean lockMethod()
           
 boolean lockMethod(java.lang.String path)
           
 boolean lockMethod(java.lang.String owner, short timeout)
           
 boolean lockMethod(java.lang.String path, java.lang.String owner, short timeout)
           
 boolean mkcolMethod()
           
 boolean mkcolMethod(java.lang.String path)
           
 boolean moveMethod(java.lang.String destination)
           
 boolean moveMethod(java.lang.String source, java.lang.String destination)
           
 boolean optionsMethod()
           
 java.util.Enumeration optionsMethod(org.apache.util.HttpURL httpURL)
           
 boolean optionsMethod(java.lang.String path)
           
 boolean optionsMethod(java.lang.String path, java.lang.String aMethod)
           
 PrincipalCollectionSetProperty principalCollectionSetFindMethod(java.lang.String path)
          Return the PrincipalCollectionSetProperty for the resource at the given path returns null if the server doesn't respond with a PrincipalCollectionSetProperty
 java.util.Enumeration propfindMethod(int depth)
           
 java.util.Enumeration propfindMethod(int depth, java.util.Vector properties)
           
 java.util.Enumeration propfindMethod(java.lang.String propertyName)
           
 java.util.Enumeration propfindMethod(java.lang.String path, int depth)
           
 java.util.Enumeration propfindMethod(java.lang.String path, int depth, java.util.Vector properties)
           
 java.util.Enumeration propfindMethod(java.lang.String path, java.lang.String propertyName)
           
 java.util.Enumeration propfindMethod(java.lang.String path, java.util.Vector properties)
           
 java.util.Enumeration propfindMethod(java.util.Vector properties)
           
 boolean proppatchMethod(java.util.Hashtable properties)
           
 boolean proppatchMethod(PropertyName propertyName, java.lang.String propertyValue)
           
 boolean proppatchMethod(java.lang.String path, java.util.Hashtable properties)
           
 boolean proppatchMethod(java.lang.String path, PropertyName propertyName, java.lang.String propertyValue)
           
 boolean proppatchMethod(java.lang.String propertyName, java.lang.String propertyValue)
           
 boolean proppatchMethod(java.lang.String path, java.lang.String propertyName, java.lang.String propertyValue)
           
 boolean putMethod(byte[] data)
          Execute the PUT method for this resource.
 boolean putMethod(java.io.File file)
           
 boolean putMethod(java.io.InputStream is)
          Execute the PUT method for this resource.
 boolean putMethod(java.lang.String data)
           
 boolean putMethod(java.lang.String path, byte[] data)
          Execute the PUT method for the given path.
 boolean putMethod(java.lang.String path, java.io.File file)
           
 boolean putMethod(java.lang.String path, java.io.InputStream is)
          Execute the PUT method for the given path.
 boolean putMethod(java.lang.String path, java.lang.String data)
           
 boolean putMethod(java.lang.String path, java.net.URL url)
           
 boolean putMethod(java.net.URL url)
           
 org.apache.commons.httpclient.HttpClient retrieveSessionInstance()
          Retrieve the current http client for this resource.
 void setCreationDate(long creationDate)
          Set the value of DAV property, creationdate.
 void setCreationDate(java.lang.String creationDate)
          Set the value of DAV property, creationdate.
static void setDefaultAction(int action)
          Set the default action for this resource.
static void setDefaultDepth(int depth)
          Set the default action for this resource.
 void setDisplayName(java.lang.String displayName)
          Set the value of DAV property, displayname.
 void setEncodeURLs(boolean encodeURLs)
          Set the URL encoding flag for this http URL.
 void setExistence(boolean exists)
           
 void setGetContentLength(long getContentLength)
          Set the value of DAV property, getcontentlength.
 void setGetContentLength(java.lang.String getContentLength)
          Set the value of DAV property, getcontentlength.
 void setGetContentType(java.lang.String getContentType)
          Set the value of DAV property, getcontenttype.
 void setGetEtag(java.lang.String getEtag)
          Set the value of DAV property, getetag.
 void setGetLastModified(long getLastModified)
          Set the value of DAV property, getlastmodified.
 void setGetLastModified(java.lang.String getLastModified)
          Set the value of DAV property, getlastmodified.
static void setGetTempDir(java.lang.String tempDir)
          Get the default temporary directory for the GET method.
static void setGetUseDisk(boolean useDisk)
          Set the use disk flag for the GET method.
 void setHttpURL(org.apache.util.HttpURL httpURL)
          Set the HttpURL for this WebdavResource.
 void setHttpURL(org.apache.util.HttpURL httpURL, int depth)
          Set the HttpURL for this WebdavResource.
 void setHttpURL(org.apache.util.HttpURL httpURL, int action, int depth)
          Set the HttpURL for this WebdavResource.
 void setHttpURL(org.apache.util.HttpURL httpURL, java.lang.String additionalPath)
          Set the HttpURL for this WebdavResource.
 void setHttpURL(org.apache.util.HttpURL httpURL, java.lang.String additionalPath, int action)
          Set the HttpURL for this WebdavResource.
 void setHttpURL(org.apache.util.HttpURL httpURL, java.lang.String additionalPath, int action, int depth)
          Set the HttpURL for this WebdavResource.
 void setHttpURL(java.lang.String escapedHttpURL)
          Set the HttpURL of this WebdavResource.
 void setIsCollection(boolean isCollection)
          Set the value of DAV property, iscollection
 void setIsCollection(java.lang.String isCollection)
          Set the value of DAV property, iscollection
 void setIsHidden(boolean isHidden)
          Set the value of DAV property, ishidden.
 void setIsHidden(java.lang.String isHidden)
          Set the value of DAV property, ishidden.
 void setLockDiscovery(LockDiscoveryProperty lockDiscovery)
          Set the value of DAV property, lockdiscovery.
 void setOverwrite(boolean overwrite)
          Set the overwrite flag for COPY and MOVE.
 void setPath(java.lang.String path)
          Set the path part of this WebdavResource.
 void setProperties(int depth)
          Set the properties for this resource.
 void setProperties(int action, int depth)
          Set the properties for this resource.
 void setResourceType(ResourceTypeProperty resourceType)
          Set the value of DAV property, resourcetype.
 void setStatusCode(int statusCode)
          Set the lastest value of the status code by HTTP methods.
 void setStatusCode(int statusCode, java.lang.String message)
          Set the lastest value of the status code by HTTP methods.
 void setSupportedLock(java.lang.String supportedLock)
          Set the value of DAV property, supportedlock.
 void setUserInfo(java.lang.String userName, java.lang.String password)
          Set the userinfo part of this WebdavResource.
 java.lang.String toString()
          Return the http URL string.
 boolean unlockMethod()
           
 boolean unlockMethod(java.lang.String path)
           
 
Methods inherited from class org.apache.webdav.lib.WebdavSession
authenticate, closeSession, closeSession, connect, disconnect, error, getSessionInstance, getSessionInstance, info, receivedExpectation, receivedResponse, requiredAuthentication, retry, sentRequest, setDebug
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISPLAYNAME

public static final java.lang.String DISPLAYNAME
The displayname property.

GETCONTENTLENGTH

public static final java.lang.String GETCONTENTLENGTH
The getcontentlength property.

GETLASTMODIFIED

public static final java.lang.String GETLASTMODIFIED
The getlastmodifed property.

CREATIONDATE

public static final java.lang.String CREATIONDATE
The creationdate property.

RESOURCETYPE

public static final java.lang.String RESOURCETYPE
The resourcetype property.

GETCONTENTTYPE

public static final java.lang.String GETCONTENTTYPE
The getcontenttype property.

GETETAG

public static final java.lang.String GETETAG
The getetag property.

ISHIDDEN

public static final java.lang.String ISHIDDEN
The ishidden property.

ISCOLLECTION

public static final java.lang.String ISCOLLECTION
The iscollection property.

SUPPORTEDLOCK

public static final java.lang.String SUPPORTEDLOCK
The supportedlock property.

LOCKDISCOVERY

public static final java.lang.String LOCKDISCOVERY
The lockdiscovery property.

NOACTION

public static final int NOACTION
No action to find properties for this resource.

NAME

public static final int NAME
The action setting only the displayname for this resource.

BASIC

public static final int BASIC
The action setting the basic properties for this resource.

DEFAULT

public static final int DEFAULT
The action setting the default DAV properties for this resource.

ALL

public static final int ALL
The action setting the all properties for this resource.

defaultOwner

public static final java.lang.String defaultOwner
Owner information for locking and unlocking.

TRUE

public static final java.lang.String TRUE
The true constant string.

FALSE

public static final java.lang.String FALSE
The false constant string.

formats

public static final java.text.SimpleDateFormat[] formats
Date formats using for Date parsing.

gmtZone

protected static final java.util.TimeZone gmtZone
GMT timezone.
Constructor Detail

WebdavResource

public WebdavResource(org.apache.util.HttpURL httpURL,
                      int action,
                      int depth)
               throws org.apache.commons.httpclient.HttpException,
                      java.io.IOException
The constructor.
Parameters:
httpURL - The specified http URL.
action - The action to set properties of this resource.
depth - The depth to find properties.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

WebdavResource

public WebdavResource(org.apache.util.HttpURL httpURL,
                      int depth)
               throws org.apache.commons.httpclient.HttpException,
                      java.io.IOException
The constructor.
Parameters:
httpURL - The specified http URL.
depth - The depth to find properties.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

WebdavResource

public WebdavResource(org.apache.util.HttpURL httpURL)
               throws org.apache.commons.httpclient.HttpException,
                      java.io.IOException
The constructor.
Parameters:
httpURL - The specified http URL.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

WebdavResource

public WebdavResource(java.lang.String escapedHttpURL)
               throws org.apache.commons.httpclient.HttpException,
                      java.io.IOException
The constructor. It must be put an escaped http URL as an arguement.
Parameters:
escapedHttpURL - The escaped http URL string.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

WebdavResource

public WebdavResource(org.apache.util.HttpURL httpURL,
                      java.lang.String additionalPath)
               throws org.apache.commons.httpclient.HttpException,
                      java.io.IOException
The constructor.
Parameters:
httpURL - The http URL.
additionalPath - The added relative path.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
Method Detail

static void ()

setDefaultAction

public static void setDefaultAction(int action)
Set the default action for this resource. ex) WebdavResource.NOACTION WebdavResource.NAME WebdavResource.BASIC WebdavResource.DEFAULT WebdavResource.ALL
Parameters:
action - The action type.

getDefaultAction

public static int getDefaultAction()
Get the default action.
Returns:
The action type.

setDefaultDepth

public static void setDefaultDepth(int depth)
Set the default action for this resource. ex) DepthSupport.DEPTH_0 DepthSupport.DEPTH_1 DepthSupport.DEPTH_INFINITY
Parameters:
depth - The depth.

getDefaultDepth

public static int getDefaultDepth()
Get the default action.
Returns:
The depth.

setGetTempDir

public static void setGetTempDir(java.lang.String tempDir)
Get the default temporary directory for the GET method.
Parameters:
tempDir - The temporary directory.

getGetTempDir

public static java.lang.String getGetTempDir()
Get the default temporary directory for the GET method. The default temporary directory is "temp/".
Returns:
The temporary directory path. It's set by default, if it returns null.

setGetUseDisk

public static void setGetUseDisk(boolean useDisk)
Set the use disk flag for the GET method.
Parameters:
useDisk - The use disk flag.

getGetUseDisk

public static boolean getGetUseDisk()
Get the use disk flag for the GET method.
Returns:
The current flag of the use disk. By default, it's true.

setHttpURL

public void setHttpURL(org.apache.util.HttpURL httpURL,
                       int action,
                       int depth)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL for this WebdavResource.
Parameters:
httpURL - the specified HttpURL.
action - The action to decide properties to find.
depth - The depth to find properties.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

setHttpURL

public void setHttpURL(org.apache.util.HttpURL httpURL,
                       int depth)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL for this WebdavResource.
Parameters:
httpURL - the specified HttpURL.
depth - The depth to find properties.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

setHttpURL

public void setHttpURL(org.apache.util.HttpURL httpURL,
                       java.lang.String additionalPath,
                       int action,
                       int depth)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL for this WebdavResource. It must be put an escaped path part of the http URL as an arguement.
Parameters:
httpURL - The specified HttpURL.
additionalPath - The added relative path.
action - The action to decide properties to find.
depth - The depth.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

setHttpURL

public void setHttpURL(org.apache.util.HttpURL httpURL,
                       java.lang.String additionalPath,
                       int action)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL for this WebdavResource. It must be put an escaped path part of the http URL as an arguement.
Parameters:
httpURL - The specified HttpURL.
additionalPath - The added relative path.
action - The action to decide properties to find.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

setHttpURL

public void setHttpURL(org.apache.util.HttpURL httpURL,
                       java.lang.String additionalPath)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL for this WebdavResource.
Parameters:
httpURL - The specified HttpURL.
additionalPath - The added relative path.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

setHttpURL

public void setHttpURL(org.apache.util.HttpURL httpURL)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL for this WebdavResource.
Parameters:
httpURL - the specified HttpURL.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

setHttpURL

public void setHttpURL(java.lang.String escapedHttpURL)
                throws org.apache.commons.httpclient.HttpException,
                       java.io.IOException
Set the HttpURL of this WebdavResource. It must be put an escaped http URL as an arguement.
Parameters:
escapedHttpURL - The escaped http URL string.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(HttpURL), setUserInfo(java.lang.String, java.lang.String), setPath(java.lang.String)

getHttpURL

public org.apache.util.HttpURL getHttpURL()
Get the HttpURL of this WebdavResource.
Returns:
httpURL the http URL.

getHttpURLExceptForUserInfo

public org.apache.util.HttpURL getHttpURLExceptForUserInfo()
                                                    throws java.net.MalformedURLException
Get the HttpURL except for userinfo.
Returns:
httpURL the http URL.

setPath

public void setPath(java.lang.String path)
             throws org.apache.commons.httpclient.HttpException,
                    java.io.IOException
Set the path part of this WebdavResource.
Parameters:
path - the specified path.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  
See Also:
setHttpURL(HttpURL), setHttpURL(java.lang.String), setUserInfo(java.lang.String, java.lang.String)

getPath

public java.lang.String getPath()
Get the path part of this WebdavResource.
Returns:
the path for this WebdavResource.
See Also:
setPath(java.lang.String)

getHost

public java.lang.String getHost()
                         throws java.net.MalformedURLException
Get the hostname of this WebdavResource.
Returns:
the hostname.
Throws:
java.net.MalformedURLException -  

setUserInfo

public void setUserInfo(java.lang.String userName,
                        java.lang.String password)
                 throws org.apache.commons.httpclient.HttpException,
                        java.io.IOException
Set the userinfo part of this WebdavResource.
Throws:
java.net.MalformedURLException -  
java.io.IOException -  
See Also:
setHttpURL(HttpURL), setHttpURL(java.lang.String), setPath(java.lang.String)

getDisplayName

public java.lang.String getDisplayName()
Get the value of DAV property, displayname.
Returns:
The displayname string.

setDisplayName

public void setDisplayName(java.lang.String displayName)
Set the value of DAV property, displayname.
Parameters:
displayName - The displayname string.

getGetContentLength

public long getGetContentLength()
Get the value of DAV property, getcontentlength.
Returns:
The getcontentlength value.

setGetContentLength

public void setGetContentLength(long getContentLength)
Set the value of DAV property, getcontentlength.
Parameters:
getContentLength - The getcontentlength value.

setGetContentLength

public void setGetContentLength(java.lang.String getContentLength)
Set the value of DAV property, getcontentlength.
Parameters:
getContentLength - The getcontentlength value.

getResourceType

public ResourceTypeProperty getResourceType()
Get the value of DAV property, resourcetype.
Returns:
The resourcetype property.
See Also:
isCollection()

setResourceType

public void setResourceType(ResourceTypeProperty resourceType)
Set the value of DAV property, resourcetype.
Parameters:
resourceType - The resourcetype property.

isCollection

public boolean isCollection()
Get the value of DAV property, resourcetype
Returns:
The resourcetype string.
See Also:
getResourceType(), getIsCollection()

getGetContentType

public java.lang.String getGetContentType()
Get the value of DAV property, getcontenttype.
Returns:
The getcontenttype string.

setGetContentType

public void setGetContentType(java.lang.String getContentType)
Set the value of DAV property, getcontenttype.
Parameters:
getContentType - The getcontenttype string.

getGetLastModified

public long getGetLastModified()
Get the value of DAV property, getlastmodified.
Returns:
The getlastmodified value.

setGetLastModified

public void setGetLastModified(long getLastModified)
Set the value of DAV property, getlastmodified.
Parameters:
getLastModified - The getlastmodified value.
See Also:
setGetLastModified(java.lang.String)

setGetLastModified

public void setGetLastModified(java.lang.String getLastModified)
Set the value of DAV property, getlastmodified.
Parameters:
getLastModified - The getlastmodified value.
See Also:
setGetLastModified(long)

getCreationDate

public long getCreationDate()
Get the value of DAV property, creationdate.
Returns:
The creationdate string.

setCreationDate

public void setCreationDate(long creationDate)
Set the value of DAV property, creationdate.
Parameters:
creationDate - The creationdate string.

setCreationDate

public void setCreationDate(java.lang.String creationDate)
Set the value of DAV property, creationdate.
Parameters:
creationDate - The creationdate string.

getGetEtag

public java.lang.String getGetEtag()
Get the value of DAV property, getetag.
Returns:
The getetag string.

setGetEtag

public void setGetEtag(java.lang.String getEtag)
Set the value of DAV property, getetag.
Parameters:
getEtag - The getetag string.

getSupportedLock

public java.lang.String getSupportedLock()
Get the value of DAV property, supportedlock.
Returns:
The supportedlock string.

setSupportedLock

public void setSupportedLock(java.lang.String supportedLock)
Set the value of DAV property, supportedlock.
Parameters:
supportedLock - The supportedlock string.

getLockDiscovery

public LockDiscoveryProperty getLockDiscovery()
Get the value of DAV property, lockdiscovery.
Returns:
The lockdiscovery property.

setLockDiscovery

public void setLockDiscovery(LockDiscoveryProperty lockDiscovery)
Set the value of DAV property, lockdiscovery.
Parameters:
lockdiscovery - The lockdiscovery property.

getActiveLockOwners

public java.util.Enumeration getActiveLockOwners()
Get the activelock owners for this resource.
Returns:
An enumeration of owners.

isLocked

public boolean isLocked()
Test that this resource is locked.
Returns:
true if it's locked.

getIsHidden

public boolean getIsHidden()
Get the value of DAV property, ishidden.
Returns:
true if it is hidden, otherwise false.

setIsHidden

public void setIsHidden(boolean isHidden)
Set the value of DAV property, ishidden.
Parameters:
isHidden -  

setIsHidden

public void setIsHidden(java.lang.String isHidden)
Set the value of DAV property, ishidden.
Parameters:
isHidden -  

getIsCollection

public boolean getIsCollection()
Get the value of DAV property, iscollection
Returns:
true if it is collection, otherwise false.
See Also:
isCollection()

setIsCollection

public void setIsCollection(boolean isCollection)
Set the value of DAV property, iscollection
Parameters:
isCollection -  

setIsCollection

public void setIsCollection(java.lang.String isCollection)
Set the value of DAV property, iscollection
Parameters:
isCollection -  

setProperties

public void setProperties(int action,
                          int depth)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException
Set the properties for this resource.
Parameters:
action - The action to find properties for this resource.
depth - The depth.

setProperties

public void setProperties(int depth)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException
Set the properties for this resource.
Parameters:
action - The action to find properties for this resource.

exists

public boolean exists()

setExistence

public void setExistence(boolean exists)

getExistence

public boolean getExistence()

setOverwrite

public void setOverwrite(boolean overwrite)
Set the overwrite flag for COPY and MOVE.
Returns:
true if it ok with overwriting.

getOverwrite

public boolean getOverwrite()
Get the current value of the overwrite flag for COPY and MOVE.
Returns:
true if the current flag is overwriting.

close

public void close()
           throws java.io.IOException
Close the session of this client

getStatusMessage

public java.lang.String getStatusMessage()
Get the lastest value of the status message by HTTP methods.
Returns:
The http status string.

getStatusCode

public int getStatusCode()
Get the lastest value of the status code by HTTP methods.
Returns:
The http status code.

setStatusCode

public void setStatusCode(int statusCode)
Set the lastest value of the status code by HTTP methods.
Parameters:
statusCode - the HTTP status code.

setStatusCode

public void setStatusCode(int statusCode,
                          java.lang.String message)
Set the lastest value of the status code by HTTP methods.
Parameters:
statusCode - the HTTP status code.
message - the additional message.

getAllowedMethods

public java.util.Enumeration getAllowedMethods()
Get the allowed methods, checked by HTTP OPTIONS.
Returns:
the allowed HTTP methods.
See Also:
optionsMethod(java.lang.String)

getDavCapabilities

public java.util.Enumeration getDavCapabilities()
Get the WebDAV capabilities, checked by HTTP OPTIONS.
Returns:
the WebDAV capabilities.
See Also:
optionsMethod(java.lang.String)

getChildResources

public WebdavResources getChildResources()
                                  throws org.apache.commons.httpclient.HttpException,
                                         java.io.IOException

listWebdavResources

public WebdavResource[] listWebdavResources()
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException
Get an array of resources denoting the WebDAV child resources in the collection of this resources.
Returns:
An array of child resources in this resource.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

list

public java.lang.String[] list()
Get an array of pathnames denoting the WebDAV resources in the collection denoted by this pathname.
Returns:
An array of pathnames denoting the resources.

listBasic

public java.util.Vector listBasic()
                           throws org.apache.commons.httpclient.HttpException,
                                  java.io.IOException

setEncodeURLs

public void setEncodeURLs(boolean encodeURLs)
                   throws java.net.MalformedURLException,
                          java.io.IOException
Set the URL encoding flag for this http URL.
Parameters:
encodeURLs - true if it is encoded.
Throws:
java.net.MalformedURLException -  
java.io.IOException -  

retrieveSessionInstance

public org.apache.commons.httpclient.HttpClient retrieveSessionInstance()
                                                                 throws java.io.IOException
Retrieve the current http client for this resource.
Returns:
The http client.
See Also:
executeHttpRequestMethod(HttpClient, HttpMethod)

executeHttpRequestMethod

public int executeHttpRequestMethod(org.apache.commons.httpclient.HttpClient client,
                                    org.apache.commons.httpclient.HttpMethod method)
                             throws java.io.IOException,
                                    org.apache.commons.httpclient.HttpException
Execute the http request method. And get its status code.
Parameters:
client - The http client.
method - The http method.
Returns:
The status code.
See Also:
retrieveSessionInstance()

aclMethod

public boolean aclMethod(java.lang.String path,
                         Ace[] aces)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException
Updates the resource with a new set of aces

aclfindMethod

public AclProperty aclfindMethod(java.lang.String path)
                          throws org.apache.commons.httpclient.HttpException,
                                 java.io.IOException
Return the AclProperty for the resource at the given path returns null if the server doesn't respond with a AclProperty

principalCollectionSetFindMethod

public PrincipalCollectionSetProperty principalCollectionSetFindMethod(java.lang.String path)
                                                                throws org.apache.commons.httpclient.HttpException,
                                                                       java.io.IOException
Return the PrincipalCollectionSetProperty for the resource at the given path returns null if the server doesn't respond with a PrincipalCollectionSetProperty

lockDiscoveryPropertyFindMethod

public LockDiscoveryProperty lockDiscoveryPropertyFindMethod(java.lang.String path)
                                                      throws org.apache.commons.httpclient.HttpException,
                                                             java.io.IOException
Return the LockDiscoveryProperty for the resource at the given path returns null if the server doesn't respond with a LockDiscoveryProperty

getMethodData

public java.io.InputStream getMethodData()
                                  throws org.apache.commons.httpclient.HttpException,
                                         java.io.IOException

getMethodDataAsString

public java.lang.String getMethodDataAsString()
                                       throws org.apache.commons.httpclient.HttpException,
                                              java.io.IOException

getMethod

public boolean getMethod(java.io.File file)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

getMethod

public boolean getMethod(java.lang.String path,
                         java.io.File file)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

putMethod

public boolean putMethod(byte[] data)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException
Execute the PUT method for this resource.
Parameters:
data - The byte array.
Returns:
true if the method is succeeded.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

putMethod

public boolean putMethod(java.lang.String path,
                         byte[] data)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException
Execute the PUT method for the given path.
Parameters:
path - The path string.
data - The byte array.
Returns:
true if the method is succeeded.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

putMethod

public boolean putMethod(java.io.InputStream is)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException
Execute the PUT method for this resource.
Parameters:
is - The input stream.
Returns:
true if the method is succeeded.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

putMethod

public boolean putMethod(java.lang.String path,
                         java.io.InputStream is)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException
Execute the PUT method for the given path.
Parameters:
path - The path string.
is - The input stream.
Returns:
true if the method is succeeded.
Throws:
org.apache.commons.httpclient.HttpException -  
java.io.IOException -  

putMethod

public boolean putMethod(java.lang.String data)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

putMethod

public boolean putMethod(java.lang.String path,
                         java.lang.String data)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

putMethod

public boolean putMethod(java.io.File file)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

putMethod

public boolean putMethod(java.lang.String path,
                         java.io.File file)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

putMethod

public boolean putMethod(java.net.URL url)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

putMethod

public boolean putMethod(java.lang.String path,
                         java.net.URL url)
                  throws org.apache.commons.httpclient.HttpException,
                         java.io.IOException

optionsMethod

public boolean optionsMethod()
                      throws org.apache.commons.httpclient.HttpException,
                             java.io.IOException

optionsMethod

public boolean optionsMethod(java.lang.String path)
                      throws org.apache.commons.httpclient.HttpException,
                             java.io.IOException

optionsMethod

public boolean optionsMethod(java.lang.String path,
                             java.lang.String aMethod)
                      throws org.apache.commons.httpclient.HttpException,
                             java.io.IOException

optionsMethod

public java.util.Enumeration optionsMethod(org.apache.util.HttpURL httpURL)
                                    throws org.apache.commons.httpclient.HttpException,
                                           java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(int depth)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(java.lang.String path,
                                            int depth)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(int depth,
                                            java.util.Vector properties)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(java.lang.String path,
                                            int depth,
                                            java.util.Vector properties)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(java.lang.String propertyName)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(java.lang.String path,
                                            java.lang.String propertyName)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(java.util.Vector properties)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

propfindMethod

public java.util.Enumeration propfindMethod(java.lang.String path,
                                            java.util.Vector properties)
                                     throws org.apache.commons.httpclient.HttpException,
                                            java.io.IOException

proppatchMethod

public boolean proppatchMethod(java.lang.String propertyName,
                               java.lang.String propertyValue)
                        throws org.apache.commons.httpclient.HttpException,
                               java.io.IOException

proppatchMethod

public boolean proppatchMethod(PropertyName propertyName,
                               java.lang.String propertyValue)
                        throws org.apache.commons.httpclient.HttpException,
                               java.io.IOException

proppatchMethod

public boolean proppatchMethod(java.lang.String path,
                               java.lang.String propertyName,
                               java.lang.String propertyValue)
                        throws org.apache.commons.httpclient.HttpException,
                               java.io.IOException

proppatchMethod

public boolean proppatchMethod(java.lang.String path,
                               PropertyName propertyName,
                               java.lang.String propertyValue)
                        throws org.apache.commons.httpclient.HttpException,
                               java.io.IOException

proppatchMethod

public boolean proppatchMethod(java.util.Hashtable properties)
                        throws org.apache.commons.httpclient.HttpException,
                               java.io.IOException

proppatchMethod

public boolean proppatchMethod(java.lang.String path,
                               java.util.Hashtable properties)
                        throws org.apache.commons.httpclient.HttpException,
                               java.io.IOException

headMethod

public boolean headMethod()
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

headMethod

public boolean headMethod(java.lang.String path)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

deleteMethod

public boolean deleteMethod()
                     throws org.apache.commons.httpclient.HttpException,
                            java.io.IOException

deleteMethod

public boolean deleteMethod(java.lang.String path)
                     throws org.apache.commons.httpclient.HttpException,
                            java.io.IOException

moveMethod

public boolean moveMethod(java.lang.String destination)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

moveMethod

public boolean moveMethod(java.lang.String source,
                          java.lang.String destination)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

copyMethod

public boolean copyMethod(java.lang.String destination)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

copyMethod

public boolean copyMethod(java.lang.String source,
                          java.lang.String destination)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

mkcolMethod

public boolean mkcolMethod()
                    throws org.apache.commons.httpclient.HttpException,
                           java.io.IOException

mkcolMethod

public boolean mkcolMethod(java.lang.String path)
                    throws org.apache.commons.httpclient.HttpException,
                           java.io.IOException

lockMethod

public boolean lockMethod()
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

lockMethod

public boolean lockMethod(java.lang.String owner,
                          short timeout)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

lockMethod

public boolean lockMethod(java.lang.String path)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

lockMethod

public boolean lockMethod(java.lang.String path,
                          java.lang.String owner,
                          short timeout)
                   throws org.apache.commons.httpclient.HttpException,
                          java.io.IOException

unlockMethod

public boolean unlockMethod()
                     throws org.apache.commons.httpclient.HttpException,
                            java.io.IOException

unlockMethod

public boolean unlockMethod(java.lang.String path)
                     throws org.apache.commons.httpclient.HttpException,
                            java.io.IOException

compareToWebdavResource

public int compareToWebdavResource(WebdavResource another)

compareTo

public int compareTo(java.lang.Object another)
Compare to the given another object.
Parameters:
another - The another WebdavResource object.
Returns:
the value 0 if another is equal.

equals

public boolean equals(java.lang.Object obj)
Test the object.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the another object.
Returns:
true if it's equal.

toString

public java.lang.String toString()
Return the http URL string.
Overrides:
toString in class java.lang.Object
Returns:
the http URL string.