cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r465066 - /cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
Date Tue, 17 Oct 2006 21:38:57 GMT
Author: danielf
Date: Tue Oct 17 14:38:56 2006
New Revision: 465066

URL: http://svn.apache.org/viewvc?view=rev&rev=465066
Log:
Allow file system URLs for blockContextURL in BlockServlets (COCOON-1934). Due to Alexander
Klimetschek.

Modified:
    cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java

Modified: cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java?view=diff&rev=465066&r1=465065&r2=465066
==============================================================================
--- cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
(original)
+++ cocoon/trunk/core/cocoon-blocks-fw/cocoon-blocks-fw-impl/src/main/java/org/apache/cocoon/blocks/BlockContext.java
Tue Oct 17 14:38:56 2006
@@ -103,15 +103,19 @@
     public URL getResource(String path) throws MalformedURLException {
         if (path.length() == 0 || path.charAt(0) != '/')
             throw new MalformedURLException("The path must start with '/' " + path);
-        if (this.blockContextURL.length() != 0 && this.blockContextURL.charAt(0)
!= '/')
-            throw new MalformedURLException("The blockContextURL must be empty or start with
'/' "
-                    + this.blockContextURL);
         
-        // prefix the path with the block context resolve and resolve in the embeding
-        // servlet context
-        path = this.blockContextURL + path;
-        
-        return super.getResource(path);
+        // HACK: allow file:/ URLs for reloading of sitemaps during development
+        if (this.blockContextURL.startsWith("file:")) {
+            return new URL(this.blockContextURL + path);
+        } else {
+            if (this.blockContextURL.length() != 0 && this.blockContextURL.charAt(0)
!= '/')
+                throw new MalformedURLException("The blockContextURL must be empty or start
with '/' "
+                        + this.blockContextURL);
+            
+            // prefix the path with the block context resolve and resolve in the embeding
+            // servlet context
+            return super.getResource(this.blockContextURL + path);
+        }
     }
 
     /*



Mime
View raw message