cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/util NetUtils.java
Date Wed, 18 Jul 2001 17:34:37 GMT
dims        01/07/18 10:34:37

  Modified:    src/org/apache/cocoon/components/language/markup/xsp
                        XSPUtil.java
               src/org/apache/cocoon/components/language/markup/xsp/java
                        util.xsl
               src/org/apache/cocoon/util NetUtils.java
  Log:
  - Path for util logicsheet for making encoding attribute optional.
  - Patch for relative path name not working
  
  Revision  Changes    Path
  1.4       +2 -2      xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPUtil.java
  
  Index: XSPUtil.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/XSPUtil.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XSPUtil.java	2001/07/07 11:43:18	1.3
  +++ XSPUtil.java	2001/07/18 17:34:37	1.4
  @@ -41,7 +41,7 @@
    * The XSP <code>Utility</code> object helper
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
    * @author <a href="mailto:bloritsch@apache.org>Berin Loritsch</a>
  - * @version $Revision: 1.3 $ $Date: 2001/07/07 11:43:18 $
  + * @version $Revision: 1.4 $ $Date: 2001/07/18 17:34:37 $
    */
   public class XSPUtil {
       public static String pathComponent(String filename) {
  @@ -95,7 +95,7 @@
       public static String relativeFilename(String filename, Map objectModel)
           throws IOException {
               File file = new File(filename);
  -            if (file.isAbsolute()) {
  +            if (file.isAbsolute() && file.exists()) {
                   return filename;
               }
               Context context = (Context) objectModel.get(Constants.CONTEXT_OBJECT);
  
  
  
  1.6       +21 -8     xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/util.xsl
  
  Index: util.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/language/markup/xsp/java/util.xsl,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- util.xsl	2001/07/12 11:03:21	1.5
  +++ util.xsl	2001/07/18 17:34:37	1.6
  @@ -240,14 +240,27 @@
         </xsl:choose>
       </xsl:variable>
   
  -    <xsp:expr>
  -      XSPUtil.getFileContents(
  -    XSPUtil.relativeFilename(
  -          String.valueOf(<xsl:copy-of select="$name"/>),
  -      this.objectModel
  -    ), "<xsl:value-of select="@encoding"/>"
  -      )
  -    </xsp:expr>
  +    <xsl:choose>
  +      <xsl:when test="@encoding">
  +	    <xsp:expr>
  +	      XSPUtil.getFileContents(
  +		    XSPUtil.relativeFilename(
  +		          String.valueOf(<xsl:copy-of select="$name"/>),
  +		      this.objectModel
  +		    ), "<xsl:value-of select="@encoding"/>"
  +		      )
  +	    </xsp:expr>
  +	  </xsl:when>
  +      <xsl:otherwise>
  +	    <xsp:expr>
  +	      XSPUtil.getFileContents(
  +		    XSPUtil.relativeFilename(
  +		          String.valueOf(<xsl:copy-of select="$name"/>),
  +		      this.objectModel
  +		    ))
  +	    </xsp:expr>
  +      </xsl:otherwise>
  +    </xsl:choose>
     </xsl:template>
   
   
  
  
  
  1.3       +5 -2      xml-cocoon2/src/org/apache/cocoon/util/NetUtils.java
  
  Index: NetUtils.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/util/NetUtils.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NetUtils.java	2001/07/12 15:01:42	1.2
  +++ NetUtils.java	2001/07/18 17:34:37	1.3
  @@ -18,7 +18,7 @@
    * utility methods
    *
    * @author <a href="mailto:stefano@apache.org">Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/07/12 15:01:42 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/07/18 17:34:37 $
    */
   
   public class NetUtils {
  @@ -31,7 +31,10 @@
        */
       public static String getPath(String uri) {
           int i = uri.lastIndexOf('/');
  -        return (i > -1) ? uri.substring(0, i) : "";
  +        if(i > -1)
  +            return uri.substring(0, i);
  +        i = uri.indexOf(':');
  +        return (i > -1) ? uri.substring(i+1,uri.length()) : "";
       }
   
      /**
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Mime
View raw message