cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gian...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl WebDAVSourceFactory.java
Date Thu, 17 Jul 2003 12:24:53 GMT
gianugo     2003/07/17 05:24:53

  Modified:    .        status.xml
               src/blocks/webdav/java/org/apache/cocoon/components/source/impl
                        WebDAVSourceFactory.java
  Log:
  Added URL encoding of user/password in the WebDAV source
  (webdav://user:password@host/path)
  
  Revision  Changes    Path
  1.92      +5 -1      cocoon-2.1/status.xml
  
  Index: status.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/status.xml,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- status.xml	13 Jul 2003 17:16:54 -0000	1.91
  +++ status.xml	17 Jul 2003 12:24:52 -0000	1.92
  @@ -184,6 +184,10 @@
     <changes>
   
    <release version="@version@" date="@date@">
  +  <action dev="GR" type="update">
  +    Added URL encoding of user/password in the WebDAV source 
  +    (webdav://user:password@host/path)
  +  </action>
     <action dev="VG" type="update">
       Decouple core XSP logicsheet from database classes to allow XSP deployment
       without excalibur datasource JAR file. If your XSP pages use datasources
  
  
  
  1.3       +15 -26    cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSourceFactory.java
  
  Index: WebDAVSourceFactory.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/webdav/java/org/apache/cocoon/components/source/impl/WebDAVSourceFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- WebDAVSourceFactory.java	13 Jul 2003 01:25:43 -0000	1.2
  +++ WebDAVSourceFactory.java	17 Jul 2003 12:24:52 -0000	1.3
  @@ -58,6 +58,7 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
   import org.apache.avalon.framework.thread.ThreadSafe;
  +import org.apache.commons.httpclient.HttpURL;
   import org.apache.excalibur.source.Source;
   import org.apache.excalibur.source.SourceException;
   import org.apache.excalibur.source.SourceFactory;
  @@ -98,33 +99,21 @@
           }
   
           final String protocol = location.substring(0, location.indexOf(':'));
  -        int position = location.indexOf("://");
  -        if (position >= 0)
  -            position += 3;
  -        else
  -            position = 0;
  -
  -        // create the queryString (if available)
  -        String queryString = null;
  -        SourceParameters locationParameters = null;
  -        int queryStringPos = location.indexOf('?');
  -        if (queryStringPos != -1) {
  -            queryString = location.substring(queryStringPos + 1);
  -            location = location.substring(position, queryStringPos);
  -            locationParameters = new SourceParameters(queryString);
  -
  -        } else if (position > 0) {
  -            location = location.substring(position);
  -            locationParameters = new SourceParameters();
  -        }
   
  -        String repository = locationParameters.getParameter("repository", null);
  -        String namespace = locationParameters.getParameter("namespace", null);
  -        String principal = locationParameters.getParameter("principal", null);
  -        String password = locationParameters.getParameter("password", null);
  -        String revision = locationParameters.getParameter("revision", null);
  +		HttpURL url = new HttpURL("http://" + location.substring(location.indexOf(':')+3)); 
     
  +		String principal = url.getUser();
  +		String password = url.getPassword();
  +		location = url.getHost() + ":" + url.getPort();
  +		if(url.getPathQuery() != null) location += url.getPathQuery();
  +
  +        if(principal == null || password == null) {
  +			String queryString = url.getQuery();
  +			SourceParameters locationParameters = new SourceParameters(queryString);
  +			principal = locationParameters.getParameter("principal", principal);
  +			password = locationParameters.getParameter("password", password);
  +        }
   
  -        WebDAVSource source = 
  +        WebDAVSource source =
               WebDAVSource.newWebDAVSource(location, principal, password, protocol);
   
           return source;
  
  
  

Mime
View raw message