jericho 01/03/01 13:38:54
Modified: src/webdav/client/src/org/apache/webdav/util
WebdavResource.java
Log:
- Layout changs. Some tabs are changed to spaces.
Revision Changes Path
1.6 +633 -633
jakarta-slide/src/webdav/client/src/org/apache/webdav/util/WebdavResource.java
Index: WebdavResource.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/util/WebdavResource.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- WebdavResource.java 2001/03/01 21:18:30 1.5
+++ WebdavResource.java 2001/03/01 21:38:52 1.6
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/util/WebdavResource.java,v
1.5 2001/03/01 21:18:30 jericho Exp $
- * $Revision: 1.5 $
- * $Date: 2001/03/01 21:18:30 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/util/WebdavResource.java,v
1.6 2001/03/01 21:38:52 jericho Exp $
+ * $Revision: 1.6 $
+ * $Date: 2001/03/01 21:38:52 $
*
* ====================================================================
*
@@ -98,11 +98,11 @@
* @param httpUrl The specified HttpURL.
* @exception WebdavException
* @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
*/
public WebdavResource(HttpURL httpUrl)
throws WebdavException, IOException {
@@ -117,11 +117,11 @@
* @param httpUrl The specified http URL string.
* @exception WebdavException
* @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
*/
public WebdavResource(String httpUrl)
throws WebdavException, IOException {
@@ -136,11 +136,11 @@
* @param httpUrl The specified URL.
* @exception WebdavException
* @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
*/
public WebdavResource(URL url)
throws WebdavException, IOException {
@@ -152,58 +152,58 @@
// ------------------------------------------------------ Class Variables
- /**
- * Constants for WebDAV properties
- */
- public static final String DISPLAYNAME ="displayname";
- public static final String GETCONTENTLENGTH = "getcontentlength";
- public static final String GETLASTMODIFIED = "getlastmodified";
- public static final String CREATIONDATE = "creationdate";
- public static final String RESOURCETYPE = "resourcetype";
- public static final String GETCONTENTTYPE = "getcontenttype";
- public static final String GETETAG = "getetag";
- public static final String ISHIDDEN = "ishidden";
- public static final String ISCOLLECTION = "iscollection";
- public static final String SUPPORTEDLOCK = "supportedlock";
+ /**
+ * Constants for WebDAV properties
+ */
+ public static final String DISPLAYNAME ="displayname";
+ public static final String GETCONTENTLENGTH = "getcontentlength";
+ public static final String GETLASTMODIFIED = "getlastmodified";
+ public static final String CREATIONDATE = "creationdate";
+ public static final String RESOURCETYPE = "resourcetype";
+ public static final String GETCONTENTTYPE = "getcontenttype";
+ public static final String GETETAG = "getetag";
+ public static final String ISHIDDEN = "ishidden";
+ public static final String ISCOLLECTION = "iscollection";
+ public static final String SUPPORTEDLOCK = "supportedlock";
// --------------------------------------------------- Instance Variables
- /**
+ /**
* The HttpURL to represent a WebDAV resource.
*
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
- */
- private HttpURL httpUrl;
-
-
- /**
- * A string flag used for checking WebDAV properties.
- *
- * @see #setUsed()
- * @see #getUsed()
- * @see #setUnused()
- */
- private String httpUrlChecked;
-
-
- /**
- * The WebDAV client for the HTTP communication with WebDAV servers.
- */
- private WebdavClient client;
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
+ */
+ private HttpURL httpUrl;
/**
+ * A string flag used for checking WebDAV properties.
+ *
+ * @see #setUsed()
+ * @see #getUsed()
+ * @see #setUnused()
+ */
+ private String httpUrlChecked;
+
+
+ /**
+ * The WebDAV client for the HTTP communication with WebDAV servers.
+ */
+ private WebdavClient client;
+
+
+ /**
* Table of the hrefs gotten in a collection.
*
* @see #setAllProp(HttpURL)
*/
- private Hashtable hrefTable = new Hashtable();
+ private Hashtable hrefTable = new Hashtable();
/**
@@ -226,34 +226,34 @@
private Enumeration davCapabilities;
- /**
+ /**
* The table of clients for multi-session management.
* Using WebdavClientSession can keep to have the multiple connections.
*/
private WebdavClientSession clients = new WebdavClientSession();
- /**
- * A WebdavResource flag to check its existence;
- */
- private boolean exists = false;
+ /**
+ * A WebdavResource flag to check its existence;
+ */
+ private boolean exists = false;
- /**
- * A WebdavResource flag to check overwriting;
- */
+ /**
+ * A WebdavResource flag to check overwriting;
+ */
private boolean overwrite = false;
- /**
- * A status code performed by HTTP methods at the most recent.
- */
- private int latestStatusCode;
+ /**
+ * A status code performed by HTTP methods at the most recent.
+ */
+ private int latestStatusCode;
- /**
- * A status message performed by HTTP methods at the most recent.
- */
+ /**
+ * A status message performed by HTTP methods at the most recent.
+ */
private String latestStatusMessage = "";
@@ -263,64 +263,64 @@
private static final String defaultOwner = "Slide";
- /**
- * A WebDAV property, displayname.
- */
- private String displayName = "";
+ /**
+ * A WebDAV property, displayname.
+ */
+ private String displayName = "";
- /**
- * A WebDAV property, getcontentlength;
- */
- private String getContentLength = "";
+ /**
+ * A WebDAV property, getcontentlength;
+ */
+ private String getContentLength = "";
- /**
- * A WebDAV property, getcontenttype;
- */
- private String getContentType = "";
+ /**
+ * A WebDAV property, getcontenttype;
+ */
+ private String getContentType = "";
- /**
- * A WebDAV property, resourcetype;
- */
- private ResourceTypeProperty resourceType;
+ /**
+ * A WebDAV property, resourcetype;
+ */
+ private ResourceTypeProperty resourceType;
- /**
- * A WebDAV property, getlastmodified;
+ /**
+ * A WebDAV property, getlastmodified;
*/
- private Date getLastModified;
+ private Date getLastModified;
- /**
- * A WebDAV property, creationdate.
- */
- private String creationDate = "";
+ /**
+ * A WebDAV property, creationdate.
+ */
+ private String creationDate = "";
- /**
- * A WebDAV property, getetag;
- */
- private String getEtag = "";
+ /**
+ * A WebDAV property, getetag;
+ */
+ private String getEtag = "";
- /**
- * A WebDAV property, ishidden;
- */
- private String isHidden = "";
+ /**
+ * A WebDAV property, ishidden;
+ */
+ private String isHidden = "";
- /**
- * A WebDAV property, iscollection;
- */
- private String isCollection = "";
+ /**
+ * A WebDAV property, iscollection;
+ */
+ private String isCollection = "";
- /**
- * A WebDAV property, supportedlock;
- */
- private String supportedLock = "";
+ /**
+ * A WebDAV property, supportedlock;
+ */
+ private String supportedLock = "";
// ------------------------------------------------- Methods for http URL
@@ -333,8 +333,8 @@
* this method returns URL without the userinfo part.
*
* @param path the specified path for this WebdavResource.
- * @exception MalformedURLException
- * @see #setHttpUrl(java.net.URL)
+ * @exception MalformedURLException
+ * @see #setHttpUrl(java.net.URL)
*/
public URL getURL()
throws MalformedURLException {
@@ -347,12 +347,12 @@
* Set the HttpURL for this WebdavResource.
*
* @param httpUrl the specified HttpURL.
- * @exception WebdavException
- * @exception IOException
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
+ * @exception WebdavException
+ * @exception IOException
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
*/
public void setHttpUrl(HttpURL httpUrl)
throws WebdavException, IOException {
@@ -366,13 +366,13 @@
* Set the HttpURL of this WebdavResource.
*
* @param httpUrl the specified http URL string.
- * @exception WebdavException
- * @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
- * @see #getURL()
+ * @exception WebdavException
+ * @exception IOException
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
+ * @see #getURL()
*/
public void setHttpUrl(String httpUrl)
throws WebdavException, IOException {
@@ -385,12 +385,12 @@
* Set the HttpURL of this WebdavResource.
*
* @param httpUrl the specified URL.
- * @exception WebdavException
- * @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setUserInfo(java.lang.String, java.lang.String)
- * @see #setPath(java.lang.String)
+ * @exception WebdavException
+ * @exception IOException
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @see #setPath(java.lang.String)
*/
public void setHttpUrl(URL url)
throws WebdavException, IOException {
@@ -403,12 +403,12 @@
* Set the path part of this WebdavResource.
*
* @param path the specified path.
- * @exception WebdavException
- * @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setUserInfo(java.lang.String, java.lang.String)
+ * @exception WebdavException
+ * @exception IOException
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setUserInfo(java.lang.String, java.lang.String)
*/
public void setPath(String path)
throws WebdavException, IOException {
@@ -422,7 +422,7 @@
* Get the path part of this WebdavResource.
*
* @return the path for this WebdavResource.
- * @see #setPath(java.lang.String)
+ * @see #setPath(java.lang.String)
*/
public String getPath() {
@@ -447,10 +447,10 @@
*
* @exception MalformedURLException
* @exception IOException
- * @see #setHttpUrl(HttpURL)
- * @see #setHttpUrl(java.lang.String)
- * @see #setHttpUrl(java.net.URL)
- * @see #setPath(java.lang.String)
+ * @see #setHttpUrl(HttpURL)
+ * @see #setHttpUrl(java.lang.String)
+ * @see #setHttpUrl(java.net.URL)
+ * @see #setPath(java.lang.String)
*/
public void setUserInfo(String userName, String password)
throws WebdavException, IOException {
@@ -463,44 +463,44 @@
// ----------------------------------------------------------- Properties
- /**
- * Test if the current http URL is checked or not.
- *
- * @return true if it is aleady checked.
- * @see #setUsed()
- * @see #setUnused()
- */
- private boolean getUsed() {
+ /**
+ * Test if the current http URL is checked or not.
+ *
+ * @return true if it is aleady checked.
+ * @see #setUsed()
+ * @see #setUnused()
+ */
+ private boolean getUsed() {
- if (httpUrl != null && httpUrlChecked != null)
- return httpUrlChecked.equals(httpUrl.toString());
+ if (httpUrl != null && httpUrlChecked != null)
+ return httpUrlChecked.equals(httpUrl.toString());
return false;
- }
+ }
+
+
+ /**
+ * Set the http URL checked.
+ *
+ * @see #getUsed()
+ * @see #setUnused()
+ */
+ private void setUsed() {
+
+ httpUrlChecked = httpUrl.toString();
+ }
- /**
- * Set the http URL checked.
- *
- * @see #getUsed()
- * @see #setUnused()
- */
- private void setUsed() {
-
- httpUrlChecked = httpUrl.toString();
- }
-
-
- /**
- * Set the http URL unchecked.
- *
- * @see #getUsed()
- * @see #setUsed()
- */
- private void setUnused() {
+ /**
+ * Set the http URL unchecked.
+ *
+ * @see #getUsed()
+ * @see #setUsed()
+ */
+ private void setUnused() {
- httpUrlChecked = null;
- }
+ httpUrlChecked = null;
+ }
/**
@@ -512,7 +512,7 @@
* @exception IOException The socket error with a server.
*/
private void setAllProp(HttpURL httpUrl)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
// Let me do just once, do not repeat.
if (getUsed())
@@ -532,7 +532,7 @@
setStatusCode(method.getStatusCode());
// Getting the result.
- Enumeration httpUrls = method.getAllResponseURLs();
+ Enumeration httpUrls = method.getAllResponseURLs();
// Prepare the hrefTable empty.
hrefTable.clear();
@@ -543,406 +543,406 @@
// Table for the href and its properties
Hashtable hrefProperties = new Hashtable();
String href = (String) httpUrls.nextElement();
- Enumeration properties = method.getResponseProperties(href);
- while (properties.hasMoreElements()) {
- Property property = (Property)
properties.nextElement();
- // ifself
- String httpUrlPath = httpUrl.getPath();
- String owningPath =
HttpURL.getPath(property.getOwningURL());
+ Enumeration properties = method.getResponseProperties(href);
+ while (properties.hasMoreElements()) {
+ Property property = (Property) properties.nextElement();
+ // ifself
+ String httpUrlPath = httpUrl.getPath();
+ String owningPath = HttpURL.getPath(property.getOwningURL());
// Compare with the owning path and itself.
- if (httpUrlPath.equals(owningPath)) {
- exists = true;
- itself = true;
- } else {
- int compared = httpUrlPath.compareTo(owningPath);
- if (compared == -1 && owningPath.endsWith("/")) {
- exists = true;
- itself = true;
- httpUrl = new HttpURL(httpUrl.toString() +
"/");
- } else if (compared == 1 &&
httpUrlPath.endsWith("/")) {
- exists = true;
- itself = true;
+ if (httpUrlPath.equals(owningPath)) {
+ exists = true;
+ itself = true;
+ } else {
+ int compared = httpUrlPath.compareTo(owningPath);
+ if (compared == -1 && owningPath.endsWith("/")) {
+ exists = true;
+ itself = true;
+ httpUrl = new HttpURL(httpUrl.toString() + "/");
+ } else if (compared == 1 && httpUrlPath.endsWith("/")) {
+ exists = true;
+ itself = true;
}
}
// ------------------------------ Checking WebDAV properties
- if (property.getLocalName().equals(DISPLAYNAME)) {
- displayName =
-
DOMUtils.getTextValue(property.getElement());
+ if (property.getLocalName().equals(DISPLAYNAME)) {
+ displayName =
+ DOMUtils.getTextValue(property.getElement());
if (!itself)
hrefProperties.put(DISPLAYNAME, displayName);
- } else
- if (property.getLocalName().equals(GETCONTENTLENGTH)) {
- getContentLength =
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put
- (GETCONTENTLENGTH, getContentLength);
- } else
- if (property.getLocalName().equals(RESOURCETYPE)) {
- resourceType = (ResourceTypeProperty) property;
- if (!itself)
- hrefProperties.put(RESOURCETYPE,
resourceType);
- } else
- if (property.getLocalName().equals(GETCONTENTTYPE)) {
- getContentType =
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put(GETCONTENTTYPE,
getContentType);
- } else
- if (property.getLocalName().equals(GETLASTMODIFIED)) {
- getLastModified =
- ((GetLastModifiedProperty)
property).getDate();
- if (!itself)
- hrefProperties.put(GETLASTMODIFIED,
getLastModified);
- } else
- if (property.getLocalName().equals(CREATIONDATE)) {
- creationDate =
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put(CREATIONDATE, creationDate);
- } else
- if (property.getLocalName().equals(GETETAG)) {
- getEtag =
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put(GETETAG, getEtag);
- } else
- if (property.getLocalName().equals(ISHIDDEN)) {
- isHidden=
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put(ISHIDDEN, isHidden);
- } else
- if (property.getLocalName().equals(ISCOLLECTION)) {
- isCollection =
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put(ISCOLLECTION,
isCollection);
- } else
- if (property.getLocalName().equals(SUPPORTEDLOCK)) {
- supportedLock =
-
DOMUtils.getTextValue(property.getElement());
- if (!itself)
- hrefProperties.put(SUPPORTEDLOCK,
supportedLock);
- }
- }
- if (!itself)
- hrefTable.put(href, hrefProperties);
- }
+ } else
+ if (property.getLocalName().equals(GETCONTENTLENGTH)) {
+ getContentLength =
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put
+ (GETCONTENTLENGTH, getContentLength);
+ } else
+ if (property.getLocalName().equals(RESOURCETYPE)) {
+ resourceType = (ResourceTypeProperty) property;
+ if (!itself)
+ hrefProperties.put(RESOURCETYPE, resourceType);
+ } else
+ if (property.getLocalName().equals(GETCONTENTTYPE)) {
+ getContentType =
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put(GETCONTENTTYPE, getContentType);
+ } else
+ if (property.getLocalName().equals(GETLASTMODIFIED)) {
+ getLastModified =
+ ((GetLastModifiedProperty) property).getDate();
+ if (!itself)
+ hrefProperties.put(GETLASTMODIFIED, getLastModified);
+ } else
+ if (property.getLocalName().equals(CREATIONDATE)) {
+ creationDate =
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put(CREATIONDATE, creationDate);
+ } else
+ if (property.getLocalName().equals(GETETAG)) {
+ getEtag =
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put(GETETAG, getEtag);
+ } else
+ if (property.getLocalName().equals(ISHIDDEN)) {
+ isHidden=
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put(ISHIDDEN, isHidden);
+ } else
+ if (property.getLocalName().equals(ISCOLLECTION)) {
+ isCollection =
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put(ISCOLLECTION, isCollection);
+ } else
+ if (property.getLocalName().equals(SUPPORTEDLOCK)) {
+ supportedLock =
+ DOMUtils.getTextValue(property.getElement());
+ if (!itself)
+ hrefProperties.put(SUPPORTEDLOCK, supportedLock);
+ }
+ }
+ if (!itself)
+ hrefTable.put(href, hrefProperties);
+ }
- // The given http URL checked.
- setUsed();
+ // The given http URL checked.
+ setUsed();
// Set the new WebDAV client.
clients.setSession(httpUrl, client);
- }
+ }
- /**
- * Get the value of DAV property, displayname.
- *
- * @return The displayname string.
- */
- public String getDisplayName() {
+ /**
+ * Get the value of DAV property, displayname.
+ *
+ * @return The displayname string.
+ */
+ public String getDisplayName() {
- return displayName;
- }
+ return displayName;
+ }
- /**
- * Get the value of DAV property, getcontentlength.
- *
- * @return The getcontentlength string.
- */
- public long getGetContentLength() {
+ /**
+ * Get the value of DAV property, getcontentlength.
+ *
+ * @return The getcontentlength string.
+ */
+ public long getGetContentLength() {
- return Long.parseLong(getContentLength);
- }
+ return Long.parseLong(getContentLength);
+ }
- /**
- * Get the value of DAV property, resourcetype.
- *
- * @return The resourcetype property.
- * @see #isCollection()
- */
- public ResourceTypeProperty getResourceType() {
+ /**
+ * Get the value of DAV property, resourcetype.
+ *
+ * @return The resourcetype property.
+ * @see #isCollection()
+ */
+ public ResourceTypeProperty getResourceType() {
- return resourceType;
- }
+ return resourceType;
+ }
- /**
- * Get the value of DAV property, resourcetype
- *
- * @return The resourcetype string.
- * @see #getResourceType()
- * @see #getIsCollection()
- */
- public boolean isCollection() {
+ /**
+ * Get the value of DAV property, resourcetype
+ *
+ * @return The resourcetype string.
+ * @see #getResourceType()
+ * @see #getIsCollection()
+ */
+ public boolean isCollection() {
- return getResourceType().isCollection();
- }
+ return getResourceType().isCollection();
+ }
- /**
- * Get the value of DAV property, getcontenttype.
- *
- * @return The getcontenttype string.
- */
- public String getGetContentType() {
+ /**
+ * Get the value of DAV property, getcontenttype.
+ *
+ * @return The getcontenttype string.
+ */
+ public String getGetContentType() {
- return getContentType;
- }
+ return getContentType;
+ }
- /**
- * Get the value of DAV property, getlastmodified.
- *
- * @return The getlastmodified value.
- */
- public long getGetLastModified() {
+ /**
+ * Get the value of DAV property, getlastmodified.
+ *
+ * @return The getlastmodified value.
+ */
+ public long getGetLastModified() {
- return getLastModified.getTime();
- }
+ return getLastModified.getTime();
+ }
- /**
- * Get the value of DAV property, creationdate.
- *
- * @return The creationdate string.
- */
- public String getCreationDate() {
+ /**
+ * Get the value of DAV property, creationdate.
+ *
+ * @return The creationdate string.
+ */
+ public String getCreationDate() {
- return creationDate;
- }
+ return creationDate;
+ }
- /**
- * Get the value of DAV property, getetag.
- *
- * @return The getetag string.
- */
- public String getGetEtag() {
+ /**
+ * Get the value of DAV property, getetag.
+ *
+ * @return The getetag string.
+ */
+ public String getGetEtag() {
- return getEtag;
- }
+ return getEtag;
+ }
- /**
- * Get the value of DAV property, supportedlock.
- *
- * @return The supportedlock string.
- */
- public String getSupportedLock() {
+ /**
+ * Get the value of DAV property, supportedlock.
+ *
+ * @return The supportedlock string.
+ */
+ public String getSupportedLock() {
- return supportedLock;
- }
+ return supportedLock;
+ }
- /**
- * Get the value of DAV property, ishidden.
- *
- * @return true if it is hidden, otherwise false.
- */
- public boolean getIsHidden() {
+ /**
+ * Get the value of DAV property, ishidden.
+ *
+ * @return true if it is hidden, otherwise false.
+ */
+ public boolean getIsHidden() {
- return isHidden.equals("1") ? true : false;
- }
+ return isHidden.equals("1") ? true : false;
+ }
- /**
- * Get the value of DAV property, iscollection
- *
- * @return true if it is collection, otherwise false.
- *
- * @see #isCollection()
- */
- public boolean getIsCollection() {
+ /**
+ * Get the value of DAV property, iscollection
+ *
+ * @return true if it is collection, otherwise false.
+ *
+ * @see #isCollection()
+ */
+ public boolean getIsCollection() {
- return isCollection.equals("1") ? true : false;;
- }
+ return isCollection.equals("1") ? true : false;;
+ }
// ------------------------------------- WebdavResource getter and setter
- /**
- * Set the overwrite flag for PUT method
- *
- * @return true if it ok with overwriting.
- */
- public void setOverwrite(boolean overwrite) {
-
- this.overwrite = overwrite;
- }
-
-
- /**
- * Get the current value of the overwrite flag.
- *
- * @return true if the current flag is overwriting.
- */
- public boolean getOverwrite() {
+ /**
+ * Set the overwrite flag for PUT method
+ *
+ * @return true if it ok with overwriting.
+ */
+ public void setOverwrite(boolean overwrite) {
- return overwrite;
- }
+ this.overwrite = overwrite;
+ }
/**
+ * Get the current value of the overwrite flag.
+ *
+ * @return true if the current flag is overwriting.
+ */
+ public boolean getOverwrite() {
+
+ return overwrite;
+ }
+
+
+ /**
* Close the session of this client
*/
public void close() throws IOException {
+
+ clients.unsetSession(httpUrl);
+ }
+
+
+ /**
+ * Get the lastest value of the status message by HTTP methods.
+ *
+ * @return The http status string.
+ * @see #setStatusCode()
+ */
+ public String getStatusMessage() {
+
+ return latestStatusMessage;
+ }
+
- clients.unsetSession(httpUrl);
+ /**
+ * Get the lastest value of the status code by HTTP methods.
+ *
+ * @return The http status code.
+ * @see #getStatusCode()
+ * @see #setStatusMessage(int)
+ * @see #setStatusMessage(int, java.lang.String)
+ */
+ public int getStatusCode() {
+
+ return latestStatusCode;
}
- /**
- * Get the lastest value of the status message by HTTP methods.
- *
- * @return The http status string.
- * @see #setStatusCode()
- */
- public String getStatusMessage() {
-
- return latestStatusMessage;
- }
-
-
- /**
- * Get the lastest value of the status code by HTTP methods.
- *
- * @return The http status code.
- * @see #getStatusCode()
- * @see #setStatusMessage(int)
- * @see #setStatusMessage(int, java.lang.String)
- */
- public int getStatusCode() {
-
- return latestStatusCode;
- }
-
-
- /**
- * Set the lastest value of the status code by HTTP methods.
- *
- * @param statusCode the HTTP status code.
- * @see #getStatusMessage()
- * @see #setStatusMessage(int, java.lang.String)
- */
- public void setStatusCode(int statusCode) {
+ /**
+ * Set the lastest value of the status code by HTTP methods.
+ *
+ * @param statusCode the HTTP status code.
+ * @see #getStatusMessage()
+ * @see #setStatusMessage(int, java.lang.String)
+ */
+ public void setStatusCode(int statusCode) {
setStatusCode(statusCode, null);
- }
+ }
- /**
- * Set the lastest value of the status code by HTTP methods.
- *
- * @param statusCode the HTTP status code.
- * @param message the additional message.
- * @see #getStatusCode()
- * @see #setStatusMessage(int)
- */
- public void setStatusCode(int statusCode, String message) {
+ /**
+ * Set the lastest value of the status code by HTTP methods.
+ *
+ * @param statusCode the HTTP status code.
+ * @param message the additional message.
+ * @see #getStatusCode()
+ * @see #setStatusMessage(int)
+ */
+ public void setStatusCode(int statusCode, String message) {
latestStatusCode = statusCode;
- latestStatusMessage = WebdavStatus.getStatusText(statusCode) +
- " (" + statusCode + ")" + ((message == null) ? "" : message);
+ latestStatusMessage = WebdavStatus.getStatusText(statusCode) +
+ " (" + statusCode + ")" + ((message == null) ? "" : message);
// Make sure the cases except for getting the success responses.
- if (statusCode < 200 || statusCode >= 300)
- setUnused();
- }
+ if (statusCode < 200 || statusCode >= 300)
+ setUnused();
+ }
- /*
- * Get all href information table.
- *
- * @return the table for href and WebDAV properties.
+ /*
+ * Get all href information table.
+ *
+ * @return the table for href and WebDAV properties.
* @exception WebdavException
* @exception IOException
- */
- public Hashtable getHrefTable()
+ */
+ public Hashtable getHrefTable()
throws WebdavException, IOException {
// Check If the http URl is changed.
if (!getUsed())
setAllProp(httpUrl);
- return hrefTable;
- }
+ return hrefTable;
+ }
- /*
+ /*
* Get an array of pathnames denoting the WebDAV resources in the
* collection denoted by this pathname.
*
- * @return An array of pathnames denoting the resources.
+ * @return An array of pathnames denoting the resources.
* @exception WebdavException
* @exception IOException
- */
- public String[] list()
+ */
+ public String[] list()
throws WebdavException, IOException {
if (!getUsed())
setAllProp(httpUrl);
- Enumeration hrefs = hrefTable.keys();
- Vector hrefList = new Vector();
- while (hrefs.hasMoreElements()) {
- hrefList.addElement((String) hrefs.nextElement());
- }
-
- int count = hrefList.size();
- String[] pathnames = new String[count];
- for (int i = 0; i < count; i++) {
- pathnames[i] = HttpURL.getName((String) hrefList.elementAt(i));
- }
+ Enumeration hrefs = hrefTable.keys();
+ Vector hrefList = new Vector();
+ while (hrefs.hasMoreElements()) {
+ hrefList.addElement((String) hrefs.nextElement());
+ }
+
+ int count = hrefList.size();
+ String[] pathnames = new String[count];
+ for (int i = 0; i < count; i++) {
+ pathnames[i] = HttpURL.getName((String) hrefList.elementAt(i));
+ }
- return pathnames;
- }
+ return pathnames;
+ }
- /*
+ /*
* Get an array of pathnames denoting the WebDAV resources in the
* collection denoted by this pathname.
*
- * @return An array of pathnames denoting the resources.
+ * @return An array of pathnames denoting the resources.
* @exception WebdavException
* @exception IOException
- */
- public Vector listCollection()
+ */
+ public Vector listCollection()
throws WebdavException, IOException {
// If information for listing is changed, go for it.
if (!getUsed())
setAllProp(httpUrl);
- Enumeration hrefs = hrefTable.keys();
- Vector hrefList = new Vector();
- while (hrefs.hasMoreElements()) {
- try {
- String hrefKey = (String) hrefs.nextElement();
- Hashtable pairProperties = (Hashtable) hrefTable.get(hrefKey);
- String[] longFormat = new String[4];
- longFormat[0] = (String) pairProperties.get(DISPLAYNAME);
- String length = (String) pairProperties.get(GETCONTENTLENGTH);
+ Enumeration hrefs = hrefTable.keys();
+ Vector hrefList = new Vector();
+ while (hrefs.hasMoreElements()) {
+ try {
+ String hrefKey = (String) hrefs.nextElement();
+ Hashtable pairProperties = (Hashtable) hrefTable.get(hrefKey);
+ String[] longFormat = new String[4];
+ longFormat[0] = (String) pairProperties.get(DISPLAYNAME);
+ String length = (String) pairProperties.get(GETCONTENTLENGTH);
longFormat[1] = (length == null) ? "" : length;
- ResourceTypeProperty resourceTypeProperty =
- (ResourceTypeProperty) pairProperties.get(RESOURCETYPE);
- String getContentType =
- (String) pairProperties.get(GETCONTENTTYPE);
- longFormat[2] = resourceTypeProperty.isCollection() ?
- "COLLECTION" : getContentType ;
- Date getLastModified =
- (Date) pairProperties.get(GETLASTMODIFIED);
- longFormat[3] =
- DateFormat.getDateTimeInstance().format(getLastModified);
+ ResourceTypeProperty resourceTypeProperty =
+ (ResourceTypeProperty) pairProperties.get(RESOURCETYPE);
+ String getContentType =
+ (String) pairProperties.get(GETCONTENTTYPE);
+ longFormat[2] = resourceTypeProperty.isCollection() ?
+ "COLLECTION" : getContentType ;
+ Date getLastModified =
+ (Date) pairProperties.get(GETLASTMODIFIED);
+ longFormat[3] =
+ DateFormat.getDateTimeInstance().format(getLastModified);
hrefList.addElement(longFormat);
} catch (Exception e) {
// e.printStackTrace();
@@ -950,44 +950,44 @@
}
return hrefList;
- }
+ }
+
+
+ /**
+ * Get the allowed methods, checked by HTTP OPTIONS.
+ *
+ * @return the allowed HTTP methods.
+ * @see #optionsMethod(java.lang.String)
+ */
+ public Enumeration getAllowedMethods() {
+ return allowedMethods;
+ }
- /**
- * Get the allowed methods, checked by HTTP OPTIONS.
- *
- * @return the allowed HTTP methods.
- * @see #optionsMethod(java.lang.String)
- */
- public Enumeration getAllowedMethods() {
-
- return allowedMethods;
- }
-
-
- /**
- * Get the WebDAV capabilities, checked by HTTP OPTIONS.
- *
- * @return the WebDAV capabilities.
- * @see #optionsMethod(java.lang.String)
- */
- public Enumeration getDavCapabilities() {
-
- return davCapabilities;
- }
-
-
- /*
- * Check whether httpUrl exists
- *
- * @return true if it exists.
- */
- public boolean exists() {
- return exists;
- }
+ /**
+ * Get the WebDAV capabilities, checked by HTTP OPTIONS.
+ *
+ * @return the WebDAV capabilities.
+ * @see #optionsMethod(java.lang.String)
+ */
+ public Enumeration getDavCapabilities() {
+
+ return davCapabilities;
+ }
+
+ /*
+ * Check whether httpUrl exists
+ *
+ * @return true if it exists.
+ */
+ public boolean exists() {
+ return exists;
+ }
+
+
// ------------------------------------------------------ WebDAV methods
@@ -1002,7 +1002,7 @@
public InputStream getInputStream(String tempDir)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
// use disk to save by default
GetMethod method = new GetMethod(httpUrl.getPath(), tempDir);
@@ -1018,12 +1018,12 @@
* Execute the GET method for this WebdavResource.
*
* @param File source file
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
*/
public boolean getMethod(String tempFile) throws WebdavException {
- return getMethod("temp/", tempFile);
+ return getMethod("temp/", tempFile);
}
@@ -1032,7 +1032,7 @@
*
* @param File source file
* @param String tempDir Temporary Directory
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
*/
public boolean getMethod(String tempDir, String tempFile)
@@ -1043,7 +1043,7 @@
FileOutputStream fos = null;
GetMethod method = null;
try {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
// use disk to save by default
String source = httpUrl.getPath();
@@ -1059,14 +1059,14 @@
byte[] buffer = new byte[4096];
while ((nb = is.read (buffer)) >= 0) {
fos.write (buffer, 0, nb);
- }
+ }
fos.flush();
- } catch(WebdavException we) {
- throw new WebdavException
- (we.getMessage(), method.getStatusCode());
- // we.printStackTrace();
+ } catch(WebdavException we) {
+ throw new WebdavException
+ (we.getMessage(), method.getStatusCode());
+ // we.printStackTrace();
} catch(Exception e) {
// e.printStackTrace();
} finally {
@@ -1089,7 +1089,7 @@
* Execute the GET method for this WebdavResource path.
*
* @param file The local file.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1105,7 +1105,7 @@
*
* @param path the path string.
* @param file The local file.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1129,7 +1129,7 @@
* Execute the PUT method for this WebdavResource.
*
* @param data String</cdoe> data to send.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1145,14 +1145,14 @@
*
* @param path the path to request.
* @param data String</cdoe> to send.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean putMethod(String path, String data)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
PutMethod method = new PutMethod(HttpURL.getPath(path));
method.sendData(data);
@@ -1174,7 +1174,7 @@
* Execute the PUT method for this WebdavResource.
*
* @param File the filename to get on local.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1190,14 +1190,14 @@
*
* @param path the relative HttpURL to request.
* @param File the filename to get on local.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean putMethod(String path, File file)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
PutMethod method = new PutMethod(HttpURL.getPath(path));
method.sendData(file);
@@ -1218,14 +1218,14 @@
/*
* Execute OPTIONS method for this WebdavResource.
*
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean optionsMethod()
throws WebdavException, IOException {
- return optionsMethod(httpUrl.getPath());
+ return optionsMethod(httpUrl.getPath());
}
@@ -1233,7 +1233,7 @@
* Execute OPTIONS method for the given path.
*
* @param path the path string.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
* @see #getAllowedOptions()
@@ -1241,7 +1241,7 @@
public boolean optionsMethod(String path)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
OptionsMethod method;
if (path.trim().equals("*"))
@@ -1250,8 +1250,8 @@
method = new OptionsMethod(HttpURL.getPath(path));
client.executeMethod(method);
- int statusCode = method.getStatusCode();
- setStatusCode(statusCode);
+ int statusCode = method.getStatusCode();
+ setStatusCode(statusCode);
if (statusCode >= 200 && statusCode < 300) {
// check if the specific method is possbile
@@ -1270,14 +1270,14 @@
*
* @param path the path to send the request.
* @param aMethod a method to check it's supported.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean optionsMethod(String path, String aMethod)
throws WebdavException, IOException {
- if (aMethod != null && optionsMethod(httpUrl.getPath())) {
+ if (aMethod != null && optionsMethod(httpUrl.getPath())) {
while (allowedMethods.hasMoreElements()) {
if (aMethod.equalsIgnoreCase(
(String) allowedMethods.nextElement()))
@@ -1299,9 +1299,9 @@
* @exception IOException
*/
public Enumeration propfindMethod(short depth)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
- return propfindMethod(httpUrl.getPath(), depth);
+ return propfindMethod(httpUrl.getPath(), depth);
}
@@ -1310,11 +1310,11 @@
* Get list of all WebDAV properties on the given resource.
*
* HOW TO USE: example)
- * while (enum.hasMoreElements()) {
- * Property property = (Property) enum.nextElement();
- * if (property.getOwningHttpURL().equals(dav_httpUrl) &&
- * property.getLocalName().equals("dav property")) {
- * RESULT =
DOMUtils.getTextValue(property.getElement());
+ * while (enum.hasMoreElements()) {
+ * Property property = (Property) enum.nextElement();
+ * if (property.getOwningHttpURL().equals(dav_httpUrl) &&
+ * property.getLocalName().equals("dav property")) {
+ * RESULT = DOMUtils.getTextValue(property.getElement());
*
* @param path the path to request.
* @param depth
@@ -1323,9 +1323,9 @@
* @exception IOException
*/
public Enumeration propfindMethod(String path, short depth)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(this.httpUrl);
+ WebdavClient client = clients.getSessionInstance(this.httpUrl);
// Check the path alright.
@@ -1350,8 +1350,8 @@
}
}
- // FIXME: the better answer to manipulate?
- return method.getAllResponseURLs();
+ // FIXME: the better answer to manipulate?
+ return method.getAllResponseURLs();
}
@@ -1365,7 +1365,7 @@
* @exception IOException
*/
public Enumeration propfindMethod(String propertyName)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
Vector property = new Vector();
property.addElement(propertyName);
@@ -1384,7 +1384,7 @@
* @exception IOException
*/
public Enumeration propfindMethod(String path, String propertyName)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
Vector property = new Vector();
property.addElement(propertyName);
@@ -1403,7 +1403,7 @@
* @exception IOException
*/
public Enumeration propfindMethod(Vector properties)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
return propfindMethod(httpUrl.getPath(), properties);
}
@@ -1420,9 +1420,9 @@
* @exception IOException
*/
public Enumeration propfindMethod(String path, Vector properties)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(this.httpUrl);
+ WebdavClient client = clients.getSessionInstance(this.httpUrl);
// Check the path alright.
path = HttpURL.getPath(path);
@@ -1434,8 +1434,8 @@
// Actually, the multi-status status code has the first priority.
setStatusCode(method.getStatusCode());
- // It contains the results.
- Vector results = new Vector();
+ // It contains the results.
+ Vector results = new Vector();
HttpURL httpUrl = new HttpURL(this.httpUrl.getAuthority() + path);
String href = httpUrl.toURL().toString();
Enumeration enum = method.getResponseProperties(href);
@@ -1454,7 +1454,7 @@
}
// FIXME: some work is still needed. if null? server problem?
- return results.elements();
+ return results.elements();
}
@@ -1463,12 +1463,12 @@
*
* @param String propertyName
* @param String propertyValue
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
- public boolean proppatchMethod(String propertyName, String propertyValue)
- throws WebdavException, IOException {
+ public boolean proppatchMethod(String propertyName, String propertyValue)
+ throws WebdavException, IOException {
return proppatchMethod
(httpUrl.getPath(), propertyName, propertyValue);
@@ -1481,7 +1481,7 @@
* @param path the path string.
* @param propertyName the property name.
* @param propertyValue the property value.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1499,7 +1499,7 @@
* Execute PROPATCH method for this WebdavResource.
*
* @param property the property names.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1515,14 +1515,14 @@
*
* @param path the path string.
* @param property the property names.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean proppatchMethod(String path, Hashtable property)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
PropPatchMethod method = new PropPatchMethod(HttpURL.getPath(path));
Enumeration names = property.keys();
@@ -1557,7 +1557,7 @@
/*
* Execute the HEAD method for this WebdavResource.
*
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1572,14 +1572,14 @@
* Execute the HEAD method for the given path.
*
* @param path the path to request.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean headMethod(String path)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
HeadMethod method = new HeadMethod(HttpURL.getPath(path));
client.executeMethod(method);
@@ -1594,7 +1594,7 @@
/*
* Execute the DELETE method for this WebdavResource.
*
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1609,14 +1609,14 @@
* Execute the DELETE method for the given path.
*
* @param path the specified path.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean deleteMethod(String path)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
DeleteMethod method = new DeleteMethod(HttpURL.getPath(path));
client.executeMethod(method);
@@ -1637,12 +1637,12 @@
* Execute the MOVE method for this WebdavReource.
*
* @param destination the specified destination path to move.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean moveMethod(String destination)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
return moveMethod(httpUrl.getPath(), HttpURL.getPath(destination));
}
@@ -1653,14 +1653,14 @@
*
* @param source the specified destination as a relative HttpURL.
* @param destination the specified destination as a relative HttpURL.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean moveMethod(String source, String destination)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
MoveMethod method = new MoveMethod(source, destination);
client.executeMethod(method);
@@ -1668,8 +1668,8 @@
// Possbile MOVE Status Codes => SC_CREATED, SC_NO_CONTENT
// WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
// SC_LOCKED, SC_BAD_GATEWAY
- int statusCode = method.getStatusCode();
- setStatusCode(statusCode);
+ int statusCode = method.getStatusCode();
+ setStatusCode(statusCode);
if (statusCode >= 200 && statusCode < 300) {
setUnused();
@@ -1684,15 +1684,15 @@
* Execute the COPY method for the given destination path.
*
* @param destination the specified destination as a relative HttpURL.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean copyMethod(String destination)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
return copyMethod(HttpURL.getPath(destination));
- }
+ }
/*
@@ -1700,14 +1700,14 @@
*
* @param source the specified destination as a relative HttpURL.
* @param destination the specified destination as a relative HttpURL.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean copyMethod(String source, String destination)
- throws WebdavException, IOException {
+ throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
CopyMethod method = new CopyMethod(source, destination);
client.executeMethod(method);
@@ -1715,8 +1715,8 @@
// Possbile COPY Status Codes => SC_CREATED, SC_NO_CONTENT
// WebdavStatus.SC_FORBIDDEN, SC_CONFLICT, SC_PRECONDITION_FAILED,
// SC_LOCKED, SC_BAD_GATEWAY, SC_INSUFFICIENT_STORAGE
- int statusCode = method.getStatusCode();
- setStatusCode(statusCode);
+ int statusCode = method.getStatusCode();
+ setStatusCode(statusCode);
if (statusCode >= 200 && statusCode < 300) {
setUnused();
@@ -1730,7 +1730,7 @@
/*
* Execute the MKCOL method for this WebdavResource.
*
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1745,14 +1745,14 @@
* Execute the MKCOL method for the given path.
*
* @param path the specified path.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean mkcolMethod(String path)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
MkcolMethod method = new MkcolMethod(HttpURL.getPath(path));
client.executeMethod(method);
@@ -1776,21 +1776,21 @@
/*
* Execute the LOCK method for this WebdavResource.
*
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean lockMethod()
throws WebdavException, IOException {
- String owner = null;
- if (httpUrl.getUserName() != null) {
- owner = httpUrl.getUserName() + "@" + httpUrl.getHost();
- } else {
- owner = defaultOwner + "@" + httpUrl.getHost();
+ String owner = null;
+ if (httpUrl.getUserName() != null) {
+ owner = httpUrl.getUserName() + "@" + httpUrl.getHost();
+ } else {
+ owner = defaultOwner + "@" + httpUrl.getHost();
}
- return lockMethod(httpUrl.getPath(), owner, (short) 120);
+ return lockMethod(httpUrl.getPath(), owner, (short) 120);
}
@@ -1800,14 +1800,14 @@
*
* @param the owner string.
* @param the timetout
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean lockMethod(String owner, short timeout)
throws WebdavException, IOException {
- return lockMethod(httpUrl.getPath(), owner, (short) 120);
+ return lockMethod(httpUrl.getPath(), owner, (short) 120);
}
@@ -1815,21 +1815,21 @@
* Execute the LOCK method for the given path.
*
* @param path the specified path.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean lockMethod(String path)
throws WebdavException, IOException {
- String owner = null;
- if (httpUrl.getUserName() != null) {
- owner = httpUrl.getUserName() + "@" + httpUrl.getHost();
- } else {
- owner = defaultOwner + "@" + httpUrl.getHost();
+ String owner = null;
+ if (httpUrl.getUserName() != null) {
+ owner = httpUrl.getUserName() + "@" + httpUrl.getHost();
+ } else {
+ owner = defaultOwner + "@" + httpUrl.getHost();
}
- return lockMethod(path, owner, (short) 120);
+ return lockMethod(path, owner, (short) 120);
}
@@ -1839,34 +1839,34 @@
* @param path the specified path.
* @param owner The owner string.
* @param timetout the timeout value.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean lockMethod(String path, String owner, short timeout)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
// default lock type setting
short lockType = LockMethod.SCOPE_EXCLUSIVE;
LockMethod method =
- new LockMethod(HttpURL.getPath(path), owner, lockType, timeout);
+ new LockMethod(HttpURL.getPath(path), owner, lockType, timeout);
client.executeMethod(method);
String lock = method.getLockToken();
- State state = client.getState();
- if (state != null) {
- state.addLock(path, lock);
- }
+ State state = client.getState();
+ if (state != null) {
+ state.addLock(path, lock);
+ }
// Possbile LOCK Status Codes => SC_OK
// WebdavStatus.SC_SC_PRECONDITION_FAILED, SC_LOCKED
- int statusCode = method.getStatusCode();
- setStatusCode(statusCode, lock);
+ int statusCode = method.getStatusCode();
+ setStatusCode(statusCode, lock);
if (statusCode >= 200 && statusCode < 300) {
- client.setState(state);
- clients.setSession(httpUrl, client);
+ client.setState(state);
+ clients.setSession(httpUrl, client);
return true;
}
@@ -1877,7 +1877,7 @@
/*
* Execute the Unlock method for this WebdavResource.
*
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
@@ -1892,24 +1892,24 @@
* Execute the Unlock method for the given path.
*
* @param path the specified path.
- * @return true if the method is succeeded.
+ * @return true if the method is succeeded.
* @exception WebdavException
* @exception IOException
*/
public boolean unlockMethod(String path)
throws WebdavException, IOException {
- WebdavClient client = clients.getSessionInstance(httpUrl);
+ WebdavClient client = clients.getSessionInstance(httpUrl);
- // Get the lock for the given path.
- State state = client.getState();
- // Check the given path is alright.
- path = HttpURL.getPath(path);
- Enumeration locks = state.getLocks(path);
- String lock = null;
- while (locks.hasMoreElements()) {
- lock = (String) locks.nextElement();
- }
+ // Get the lock for the given path.
+ State state = client.getState();
+ // Check the given path is alright.
+ path = HttpURL.getPath(path);
+ Enumeration locks = state.getLocks(path);
+ String lock = null;
+ while (locks.hasMoreElements()) {
+ lock = (String) locks.nextElement();
+ }
if (lock == null)
return false;
@@ -1922,10 +1922,10 @@
setStatusCode(statusCode);
if (statusCode >= 200 && statusCode < 300) {
- state.removeLocks(path);
- client.setState(state);
- clients.setSession(httpUrl, client);
- return true;
+ state.removeLocks(path);
+ client.setState(state);
+ clients.setSession(httpUrl, client);
+ return true;
}
return false;
@@ -1989,17 +1989,17 @@
* @param another The another WebdavResource object.
* @return the value 0 if another is equal.
*/
- public int compareTo(Object another) {
+ public int compareTo(Object another) {
- if ((another != null) && (another instanceof WebdavResource)) {
- return compareToWebdavResource((WebdavResource) another);
- }
+ if ((another != null) && (another instanceof WebdavResource)) {
+ return compareToWebdavResource((WebdavResource) another);
+ }
- String thisUrl = toString();
- String anotherUrl = another.toString();
+ String thisUrl = toString();
+ String anotherUrl = another.toString();
- return thisUrl.compareTo(anotherUrl);
- }
+ return thisUrl.compareTo(anotherUrl);
+ }
/**
@@ -2010,10 +2010,10 @@
*/
public boolean equals(Object obj) {
- if ((obj != null) && (obj instanceof WebdavResource)) {
- return compareTo((WebdavResource) obj) == 0;
- }
- return false;
+ if ((obj != null) && (obj instanceof WebdavResource)) {
+ return compareTo((WebdavResource) obj) == 0;
+ }
+ return false;
}