luetzkendorf 2004/07/01 09:44:55
Modified: webdavclient/clientlib/src/java/org/apache/webdav/lib
WebdavResource.java
Log:
added support for followRedirects
Revision Changes Path
1.18 +143 -7
jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java
Index: WebdavResource.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/WebdavResource.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- WebdavResource.java 13 May 2004 13:06:40 -0000 1.17
+++ WebdavResource.java 1 Jul 2004 16:44:55 -0000 1.18
@@ -242,6 +242,25 @@
setHttpURL(httpURL, action, depth);
}
+ /**
+ * The constructor.
+ *
+ * @param httpURL The specified http URL.
+ * @param action The action to set properties of this resource.
+ * @param depth The depth to find properties.
+ * @param followRedirects shall redirects from the server be accepted
+ * @exception HttpException
+ * @exception IOException
+ * @see #setDefaultAction(int)
+ */
+ public WebdavResource(HttpURL httpURL, int action, int depth,
+ boolean followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(this.followRedirects);
+ setHttpURL(httpURL, action, depth);
+ }
+
/**
* The constructor.
@@ -258,6 +277,22 @@
setHttpURL(httpURL, defaultAction, depth);
}
+ /**
+ * The constructor.
+ *
+ * @param httpURL The specified http URL.
+ * @param depth The depth to find properties.
+ * @param followRedirects Shall redirects be followed automatically.
+ * @exception HttpException
+ * @exception IOException
+ * @see #setDefaultAction(int)
+ */
+ public WebdavResource(HttpURL httpURL, int depth, boolean followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setHttpURL(httpURL, defaultAction, depth);
+ }
/**
@@ -273,6 +308,18 @@
setHttpURL(httpURL);
}
+ /**
+ * The constructor.
+ *
+ * @param httpURL The specified http URL.
+ * @param followRedirects shall redirects from the server be accepted
+ */
+ public WebdavResource(HttpURL httpURL, boolean followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setHttpURL(httpURL);
+ }
/**
@@ -291,6 +338,13 @@
setProxy(proxyHost, proxyPort);
setHttpURL(httpURL);
}
+ public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort, boolean
followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setProxy(proxyHost, proxyPort);
+ setHttpURL(httpURL);
+ }
/**
@@ -312,7 +366,16 @@
setProxyCredentials(proxyCredentials);
setHttpURL(httpURL);
}
-
+
+ public WebdavResource(HttpURL httpURL, String proxyHost, int proxyPort,
+ Credentials proxyCredentials, boolean followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setProxy(proxyHost, proxyPort);
+ setProxyCredentials(proxyCredentials);
+ setHttpURL(httpURL);
+ }
/**
* The constructor.
@@ -328,6 +391,12 @@
setHttpURL(escapedHttpURL);
}
+ public WebdavResource(String escapedHttpURL, boolean followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setHttpURL(escapedHttpURL);
+ }
/**
@@ -346,6 +415,15 @@
setCredentials(credentials);
setHttpURL(escapedHttpURL);
}
+
+ public WebdavResource(String escapedHttpURL, Credentials credentials,
+ boolean followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setCredentials(credentials);
+ setHttpURL(escapedHttpURL);
+ }
/**
@@ -403,6 +481,20 @@
setHttpURL(httpURL, additionalPath);
}
+ /**
+ * The constructor.
+ *
+ * @param httpURL The http URL.
+ * @param additionalPath The added relative path.
+ * @param followRedirects shall redirects be accepted
+ */
+ public WebdavResource(HttpURL httpURL, String additionalPath, boolean
followRedirects)
+ throws HttpException, IOException {
+
+ setFollowRedirects(followRedirects);
+ setHttpURL(httpURL, additionalPath);
+ }
+
// -------------------------------------- Constants for WebDAV properties.
@@ -730,6 +822,7 @@
*/
protected LockDiscoveryProperty lockDiscovery;
+ protected boolean followRedirects = false;
// --------------------------------------------------------- Basic settings
@@ -1083,6 +1176,21 @@
return false;
}
+ /**
+ * Sets a flag indicating that redirect responses from
+ * the server shall be followed.
+ */
+ public void setFollowRedirects(boolean value) {
+ this.followRedirects = value;
+ }
+ /**
+ * Returns the current "follow redirects" flag.
+ * @see #setFollowRedirects(boolean)
+ */
+ public boolean getFollowRedirects() {
+ return this.followRedirects;
+ }
+
/**
* Test that the httpURL is the same with the client.
@@ -2102,6 +2210,7 @@
AclMethod method = new AclMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
for (int i=0; i<aces.length ; i++) {
@@ -2137,7 +2246,8 @@
PropFindMethod method = new PropFindMethod(URIUtil.encodePath(path),
DepthSupport.DEPTH_0,
properties.elements());
- method.setDebug(debug);
+ method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
@@ -2190,6 +2300,7 @@
DepthSupport.DEPTH_0,
properties.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
Enumeration responses = method.getResponses();
@@ -2242,6 +2353,7 @@
DepthSupport.DEPTH_0,
properties.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
Enumeration responses = method.getResponses();
@@ -2664,6 +2776,7 @@
method = new OptionsMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
int statusCode = client.executeMethod(method);
@@ -2720,6 +2833,7 @@
OptionsMethod method = new OptionsMethod(httpURL.getEscapedPath());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
@@ -2777,6 +2891,7 @@
OptionsMethod method = new OptionsMethod(httpURL.getEscapedPath(),
type);
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
@@ -2829,7 +2944,7 @@
OptionsMethod method = new OptionsMethod(URIUtil.encodePath(path),
type);
method.setDebug(debug);
-
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
@@ -2914,6 +3029,7 @@
LabelMethod method = new LabelMethod(URIUtil.encodePath(path),
labeltype, labelname);
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
int statusCode = client.executeMethod(method);
@@ -2932,7 +3048,7 @@
ReportMethod method = new ReportMethod(httpURL.getEscapedPath(),
depth);
method.setDebug(debug);
-
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
Vector results = new Vector();
@@ -2970,6 +3086,7 @@
new ReportMethod(httpURL.getEscapedPath(), DepthSupport.DEPTH_0,
properties.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
return method.getResponses();
@@ -2984,6 +3101,7 @@
ReportMethod method = new ReportMethod(httpURL.getEscapedPath(), depth,
properties.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
/*first draft, does work anyhow
@@ -3035,6 +3153,7 @@
properties.elements(),
histUri.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
Vector results = new Vector();
@@ -3071,6 +3190,7 @@
sQuery);
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
client.executeMethod(method);
Vector results = new Vector();
@@ -3221,6 +3341,7 @@
properties.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
int status = client.executeMethod(method);
@@ -3319,6 +3440,7 @@
DepthSupport.DEPTH_0,
properties.elements());
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
int status = client.executeMethod(method);
@@ -3610,6 +3732,7 @@
setClient();
PropPatchMethod method = new PropPatchMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
Enumeration names = properties.keys();
@@ -3721,6 +3844,7 @@
setClient();
DeleteMethod method = new DeleteMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -3767,6 +3891,7 @@
MoveMethod method = new MoveMethod(URIUtil.encodePath(source),
URIUtil.encodePath(destination));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
method.setOverwrite(overwrite);
@@ -3814,6 +3939,7 @@
CopyMethod method = new CopyMethod(URIUtil.encodePath(source),
URIUtil.encodePath(destination));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
method.setOverwrite(overwrite);
@@ -3974,6 +4100,7 @@
LockMethod method = new LockMethod(URIUtil.encodePath(path), owner,
lockType, timeout);
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4082,6 +4209,7 @@
// unlock for the given path.
UnlockMethod method = new UnlockMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
method.setLockToken(lock);
@@ -4180,6 +4308,7 @@
UpdateMethod method = new UpdateMethod(URIUtil.encodePath(path),
URIUtil.encodePath(target));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4198,6 +4327,7 @@
VersionControlMethod method = new VersionControlMethod(
URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4217,6 +4347,7 @@
URIUtil.encodePath(path),
URIUtil.encodePath(target));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4260,6 +4391,7 @@
MkWorkspaceMethod method =
new MkWorkspaceMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4388,6 +4520,7 @@
setClient();
CheckinMethod method = new CheckinMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4426,6 +4559,7 @@
setClient();
CheckoutMethod method = new CheckoutMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4467,6 +4601,7 @@
UncheckoutMethod method =
new UncheckoutMethod(URIUtil.encodePath(path));
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
generateIfHeader(method);
int statusCode = client.executeMethod(method);
@@ -4574,6 +4709,7 @@
reportType);
method.setDebug(debug);
+ method.setFollowRedirects(this.followRedirects);
int status = client.executeMethod(method);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]