jericho 01/05/11 15:52:52
Modified: src/webdav/client/src/org/apache/webdav/lib
WebdavSession.java WebdavResource.java
Log:
- Fix a bug not to set the whole bug function
Patch submitted by Dirk Verbeeck <dirk.verbeeck at the-ecorp.com>
- Apply subdivied authentication in http library to the session class.
- Fix a bug with the static optionsMethod method not to get a new client instance.
- Add the getSessionInstance method of a reset arguement.
Revision Changes Path
1.10 +43 -14
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java
Index: WebdavSession.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- WebdavSession.java 2001/05/11 07:39:34 1.9
+++ WebdavSession.java 2001/05/11 22:52:49 1.10
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java,v
1.9 2001/05/11 07:39:34 jericho Exp $
- * $Revision: 1.9 $
- * $Date: 2001/05/11 07:39:34 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavSession.java,v
1.10 2001/05/11 22:52:49 jericho Exp $
+ * $Revision: 1.10 $
+ * $Date: 2001/05/11 22:52:49 $
*
* ====================================================================
*
@@ -120,6 +120,9 @@
*/
public void setDebug(int debug) {
this.debug = debug;
+ if (client != null) {
+ client.setDebug(debug);
+ }
}
@@ -128,16 +131,37 @@
/**
* Get a <code>HttpClient</code> instance.
- * This method returns a new client instance.
+ * This method returns a new client instance for the first time.
+ * And it is saved util it's closed or reset.
*
* @param httpURL The http URL to connect. only used the authority part.
* @return An instance of <code>HttpClient</code>.
* @exception IOException
*/
- public synchronized HttpClient getSessionInstance(HttpURL httpURL)
+ public HttpClient getSessionInstance(HttpURL httpURL)
throws IOException {
+
+ return getSessionInstance(httpURL, false);
+ }
+
+
+ /**
+ * Get a <code>HttpClient</code> instance.
+ * This method returns a new client instance, when reset is true.
+ *
+ * @param httpURL The http URL to connect. only used the authority part.
+ * @param reset The reset flag to represent whether the saved information
+ * is used or not.
+ * @return An instance of <code>HttpClient</code>.
+ * @exception IOException
+ */
+ public synchronized HttpClient getSessionInstance(HttpURL httpURL,
+ boolean reset)
+ throws IOException {
String authority = httpURL.getAuthority();
+ if (reset)
+ clientInfo.remove(authority);
HttpClient client = (HttpClient) clientInfo.get(authority);
if (client == null) {
client = new HttpClient();
@@ -150,7 +174,8 @@
client.setConnectionInterceptor(this);
clientInfo.put(authority, client);
}
-
+ client.setDebug(debug);
+
return client;
}
@@ -283,7 +308,7 @@
*/
public boolean retry(int status) {
if (debug > 9) {
- System.err.println("CLIENT: retried.");
+ System.err.println("CLIENT: retrying.");
}
return false;
}
@@ -358,9 +383,19 @@
/**
* Authenticate.
*/
+ public void requiredAuthentication() {
+ if (debug > 9) {
+ System.err.println("CLIENT: required authentication.");
+ }
+ }
+
+
+ /**
+ * Authenticate.
+ */
public void authenticate() {
if (debug > 9) {
- System.err.println("CLIENT: authenticated.");
+ System.err.println("CLIENT: authenticating.");
}
try {
if (client != null) {
@@ -402,9 +437,3 @@
}
*/
}
-
-
-
-
-
-
1.8 +4 -5
jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java
Index: WebdavResource.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- WebdavResource.java 2001/05/10 19:04:47 1.7
+++ WebdavResource.java 2001/05/11 22:52:50 1.8
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v
1.7 2001/05/10 19:04:47 jericho Exp $
- * $Revision: 1.7 $
- * $Date: 2001/05/10 19:04:47 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/lib/WebdavResource.java,v
1.8 2001/05/11 22:52:50 jericho Exp $
+ * $Revision: 1.8 $
+ * $Date: 2001/05/11 22:52:50 $
*
* ====================================================================
*
@@ -823,7 +823,6 @@
closeSession(client);
}
client = getSessionInstance(httpURL);
- client.setDebug(debug);
}
}
@@ -1956,7 +1955,7 @@
throws HttpException, IOException {
WebdavSession session = new WebdavSession();
- HttpClient client = session.getSessionInstance(httpURL);
+ HttpClient client = session.getSessionInstance(httpURL, true);
OptionsMethod method = new OptionsMethod(httpURL.getPath());
client.executeMethod(method);