bruno       2003/07/14 01:13:16

  Modified:    sourceresolve/src/java/org/apache/excalibur/source
                        SourceUtil.java
  Log:
  Added a variant of the absolutize method which allows to
  enable or disable the path-normalization behaviour.
  
  Revision  Changes    Path
  1.12      +14 -4     
avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceUtil.java
  
  Index: SourceUtil.java
  ===================================================================
  RCS file: 
/home/cvs/avalon-excalibur/sourceresolve/src/java/org/apache/excalibur/source/SourceUtil.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- SourceUtil.java   15 Jun 2003 16:08:53 -0000      1.11
  +++ SourceUtil.java   14 Jul 2003 08:13:16 -0000      1.12
  @@ -511,7 +511,15 @@
        */
       public static String absolutize(String url1, String url2)
       {
  -        return absolutize(url1, url2, false);
  +        return absolutize(url1, url2, false, true);
  +    }
  +
  +    /**
  +     * Calls absolutize(url1, url2, false, true).
  +     */
  +    public static String absolutize(String url1, String url2, boolean 
treatAuthorityAsBelongingToPath)
  +    {
  +        return absolutize(url1, url2, treatAuthorityAsBelongingToPath, true);
       }
   
       /**
  @@ -521,8 +529,9 @@
        * @param url2 the location
        * @param treatAuthorityAsBelongingToPath considers the authority to belong to 
the path. These
        * special kind of URIs are used in the Apache Cocoon project.
  +     * @param normalizePath should the path be normalized, i.e. remove ../ and /./ 
etc.
        */
  -    public static String absolutize(String url1, String url2, boolean 
treatAuthorityAsBelongingToPath)
  +    public static String absolutize(String url1, String url2, boolean 
treatAuthorityAsBelongingToPath, boolean normalizePath)
       {
           if (url1 == null)
               return url2;
  @@ -557,7 +566,8 @@
           // combine the 2 paths
           String path = stripLastSegment(url1Path);
           path = path + (path.endsWith("/") ? "" : "/") + url2Path;
  -        path = normalize(path);
  +        if (normalizePath)
  +            path = normalize(path);
   
           return makeUrl(url1Parts[SCHEME], url1Parts[AUTHORITY], path, 
url2Parts[QUERY], url2Parts[FRAGMENT]);
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to