jericho 01/03/11 23:49:22
Modified: src/webdav/client/src/org/apache/webdav/cmd Slide.java
Log:
- There is a case that the options command is requried to have authentication.
Because, currently, the command support to work in the status even not to connect
the server aleady.
- Some messages and their order are changed.
Revision Changes Path
1.8 +89 -44
jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java
Index: Slide.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Slide.java 2001/03/09 11:07:44 1.7
+++ Slide.java 2001/03/12 07:49:22 1.8
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.7
2001/03/09 11:07:44 jericho Exp $
- * $Revision: 1.7 $
- * $Date: 2001/03/09 11:07:44 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/cmd/Slide.java,v 1.8
2001/03/12 07:49:22 jericho Exp $
+ * $Revision: 1.8 $
+ * $Date: 2001/03/12 07:49:22 $
*
* ====================================================================
*
@@ -235,7 +235,7 @@
+ e.getMessage());
httpUrl = null;
} catch (IOException e) {
- System.err.println("Error: check! "
+ System.err.println("Error: Check! "
+ e.getMessage());
httpUrl = null;
}
@@ -248,7 +248,7 @@
httpUrl = null;
}
} catch (IOException e) {
- System.err.println("Error: check! " + e.getMessage());
+ System.err.println("Error: Check! " + e.getMessage());
httpUrl = null;
}
}
@@ -329,7 +329,7 @@
+ e.getMessage());
httpUrl = null;
} catch (IOException e) {
- System.err.println("Error: check! "
+ System.err.println("Error: Check! "
+ e.getMessage());
httpUrl = null;
}
@@ -342,7 +342,7 @@
httpUrl = null;
}
} catch (IOException e) {
- System.err.println("Error: check! " + e.getMessage());
+ System.err.println("Error: Check! " + e.getMessage());
httpUrl = null;
}
updatePrompt(getPath());
@@ -472,15 +472,62 @@
if (param != null) {
if (!param.startsWith("/")) {
httpUrl = new HttpURL(param);
- Enumeration enum =
- WebdavResource.optionsMethod(httpUrl);
- while (enum.hasMoreElements()) {
- System.out.print(enum.nextElement());
- if (enum.hasMoreElements()) {
- System.out.print(", ");
+ Enumeration enum = null;
+ try {
+ // OPTIONS business logic
+ enum =
+ WebdavResource.optionsMethod(httpUrl);
+ while (enum.hasMoreElements()) {
+ System.out.print(enum.nextElement());
+ if (enum.hasMoreElements()) {
+ System.out.print(", ");
+ } else {
+ System.out.println();
+ }
+ }
+ } catch (WebdavException we) {
+ if (we.getStatusCode() ==
+ WebdavStatus.SC_UNAUTHORIZED) {
+
+ System.out.print("UserName: ");
+ String userName = in.readLine();
+ if (userName != null &&
+ userName.length() > 0) {
+ userName = userName.trim();
+ System.out.print("Password: ");
+ String password = in.readLine();
+ if (password != null)
+ password= password.trim();
+ try {
+ // OPTIONS business logic
+ httpUrl.setUserInfo(userName,
+ password);
+ enum = WebdavResource.
+ optionsMethod(httpUrl);
+ while (
+ enum.hasMoreElements()) {
+ System.out.print
+ (enum.nextElement());
+ if (enum.
+ hasMoreElements()) {
+ System.out.print
+ (", ");
+ } else {
+ System.out.println();
+ }
+ }
+ } catch (Exception e) {
+ System.err.println("Error: "
+ + e.getMessage());
+ }
+ }
} else {
- System.out.println();
+ System.err.println("Error: " +
+ we.getMessage());
}
+ } catch (IOException e) {
+ System.err.println(
+ "Error: Check! " + e.getMessage());
}
httpUrl = null;
continue;
@@ -523,7 +570,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " + e.getMessage());
+ System.err.println("Error: Check! " + e.getMessage());
}
} else
// Check the status of connection
@@ -596,7 +643,7 @@
+ e.getMessage());
httpUrl = null;
} catch (IOException e) {
- System.err.println("Error: check! "
+ System.err.println("Error: Check! "
+ e.getMessage());
httpUrl = null;
}
@@ -609,7 +656,7 @@
}
} catch (IOException e) {
System.err.println(
- "Error: check! " + e.getMessage());
+ "Error: Check! " + e.getMessage());
httpUrl = null;
}
updatePrompt(getPath());
@@ -707,7 +754,7 @@
System.err.println("Warning: "
+ we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
break;
@@ -761,7 +808,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
} else
@@ -778,8 +825,6 @@
if (webdavResource.proppatchMethod(
path, propertyName, propertyValue)) {
System.out.println("succeeded.");
- System.out.println
- ("�� WebDAV dead property doesn't work.");
} else {
System.err.println("failed.");
System.err.println(
@@ -788,7 +833,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -819,7 +864,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -864,7 +909,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -887,7 +932,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -910,7 +955,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -933,7 +978,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -956,7 +1001,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -976,7 +1021,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -996,7 +1041,7 @@
} catch (WebdavException we) {
System.err.println("Warning: " + we.getMessage());
} catch (IOException e) {
- System.err.println("Error: check! " +
+ System.err.println("Error: Check! " +
e.getMessage());
}
}
@@ -1151,7 +1196,7 @@
System.out.println("Usage: Slide [-vh] " +
"[http://][username:password@]hostname[:port]/path");
System.out.println
- (" Default protocol: http, port: 80, default path: /");
+ (" Default protocol: http, port: 80, path: /");
System.out.println("Options:");
System.out.println(" -v: Print version information.");
System.out.println(" -h: Print this help message.");
@@ -1166,6 +1211,8 @@
private static void printSlideClientUsage() {
System.out.println(version + " commands:");
+ System.out.println(" options [abs_path|http_URL] " +
+ "Print available http methods");
System.out.println(" open [http_URL] " +
"Connect to specified URL");
System.out.println(" close " +
@@ -1180,30 +1227,24 @@
"Change local working directory");
System.out.println(" lls [-lF] [path] " +
"List contents of local directory");
- System.out.println(" options [abs_path|http_URL] " +
- "Print available http methods");
- System.out.println(" url " +
- "Print working URL");
- System.out.println(" status " +
- "Print latest http status message");
System.out.println(" pwc " +
"Print working collection");
System.out.println(" cc [path] " +
"Change working collection");
System.out.println(" ls [-lF] [path] " +
"List contents of collection");
- System.out.println(" propget path property ... " +
- "Print value of specified property");
- System.out.println(" propput path property value " +
- "Set property with given value");
+ System.out.println(" url " +
+ "Print working URL");
+ System.out.println(" status " +
+ "Print latest http status message");
System.out.println(" get path [file] " +
"Get a resource to a file");
System.out.println(" put file path " +
"Put a file to path");
- System.out.println(" delete path ... " +
- "Delete resources");
System.out.println(" mkcol path ... " +
"Make new collections");
+ System.out.println(" delete path ... " +
+ "Delete resources");
System.out.println(" copy source destination " +
"Copy resource from source to destination path");
System.out.println(" move source destination " +
@@ -1212,9 +1253,13 @@
"Lock specified resource");
System.out.println(" unlock path " +
"Unlock specified resource");
+ System.out.println(" propget path property ... " +
+ "Print value of specified property");
+ System.out.println(" propput path property value " +
+ "Set property with given value");
System.out.println("Aliases: help=?, ls=dir, pwc=pwd, cc=cd, " +
"copy=cp, move=mv, delete=del=rm,\n mkcol=mkdir, " +
- "exit=quit, lls=ldir\n");
+ "lls=ldir, exit=quit \n");
}
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/webdav/... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... remm
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... juergen
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... remm
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... remm
- cvs commit: jakarta-slide/src/webdav/client/src/org/apache/we... jericho
