jericho 01/02/28 04:56:40
Modified: src/webdav/client/src/org/apache/webdav/util GenericURI.java
Log:
- Could be set the userinfo(username and password).
Revision Changes Path
1.6 +21 -3
jakarta-slide/src/webdav/client/src/org/apache/webdav/util/GenericURI.java
Index: GenericURI.java
===================================================================
RCS file:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/util/GenericURI.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- GenericURI.java 2001/02/28 05:48:21 1.5
+++ GenericURI.java 2001/02/28 12:56:38 1.6
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/util/GenericURI.java,v
1.5 2001/02/28 05:48:21 jericho Exp $
- * $Revision: 1.5 $
- * $Date: 2001/02/28 05:48:21 $
+ * $Header:
/home/cvs/jakarta-slide/src/webdav/client/src/org/apache/webdav/util/GenericURI.java,v
1.6 2001/02/28 12:56:38 jericho Exp $
+ * $Revision: 1.6 $
+ * $Date: 2001/02/28 12:56:38 $
*
* ====================================================================
*
@@ -315,6 +315,24 @@
return authority.substring(0, to);
else
return null;
+ }
+
+
+ /*
+ * Set the username and password for this URI.
+ *
+ * @param the username of URI
+ * @param the password of URI
+ * @exception MalformedURLException
+ */
+ public void setUserInfo(String userName, String password)
+ throws MalformedURLException {
+
+ if (userName == null || password == null)
+ throw new MalformedURLException("No credentials set");
+
+ uri = getScheme() + "://" + userName + ":" + password +
+ "@" + getHostPort() + getPath();
}