geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From viol...@apache.org
Subject svn commit: r1371042 - in /geronimo/server/branches/3.0: ./ plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/ plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/internal/
Date Thu, 09 Aug 2012 05:37:42 GMT
Author: violalu
Date: Thu Aug  9 05:37:42 2012
New Revision: 1371042

URL: http://svn.apache.org/viewvc?rev=1371042&view=rev
Log:
GERONIMO-6370 pass unpackagedjarresource to tomat jasper if tld files are expanded in an EBA
and use tomcat 7.0.27.2-SNAPSHOT

Modified:
    geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/GeronimoTldLocationsCache.java
    geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/TldProvider.java
    geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/internal/TldRegistryImpl.java
    geronimo/server/branches/3.0/pom.xml

Modified: geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/GeronimoTldLocationsCache.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/GeronimoTldLocationsCache.java?rev=1371042&r1=1371041&r2=1371042&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/GeronimoTldLocationsCache.java
(original)
+++ geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/GeronimoTldLocationsCache.java
Thu Aug  9 05:37:42 2012
@@ -17,8 +17,10 @@
 
 package org.apache.geronimo.jasper;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -32,6 +34,9 @@ import org.apache.xbean.osgi.bundle.util
 import org.apache.xbean.osgi.bundle.util.BundleUtils;
 import org.apache.xbean.osgi.bundle.util.BundleResourceFinder.ResourceFinderCallback;
 import org.apache.xbean.osgi.bundle.util.jar.BundleJarFile;
+import org.apache.geronimo.kernel.osgi.FrameworkUtils;
+import org.apache.geronimo.kernel.util.UnpackedJarEntry;
+import org.apache.geronimo.kernel.util.UnpackedJarFile;
 import org.apache.jasper.JasperException;
 import org.apache.jasper.compiler.JarResource;
 import org.apache.jasper.compiler.TldLocation;
@@ -297,6 +302,8 @@ public class GeronimoTldLocationsCache e
                 URL url = entry.getURL();
                 if (entry.getJarUrl() != null) { 
                     tldScanStream(url, new TldLocation(entry.getName(), entry.getJarUrl().toExternalForm()));
+                } else if (entry.getFileUrl() != null){
+                   tldScanStream(url, new TldLocation(entry.getName(), new UnpackedJarResource(entry.getFileUrl())));
                 } else {
                     tldScanStream(url, new TldLocation(entry.getName(), new BundleJarResource(entry.getBundle())));
                 }
@@ -366,8 +373,38 @@ public class GeronimoTldLocationsCache e
             return url.toExternalForm();
         }
         
+        public URL getEntry(String name) {            
+            return bundle.getEntry(name);            
+        }
+    }
+    
+    private static class UnpackedJarResource implements JarResource {
+        
+        private UnpackedJarFile bundle;
+        private URL url;
+        
+        public UnpackedJarResource(URL url) {
+            this.url = url;
+            try {
+                this.bundle = new UnpackedJarFile(new File(url.getPath()));
+            } catch (IOException e) {                
+            }
+        }
+        
+        public JarFile getJarFile() throws IOException {
+            return bundle;
+        }
+        
+        public String getUrl() {
+            return url.toExternalForm();
+        }
+        
         public URL getEntry(String name) {
-            return bundle.getEntry(name);
+            try {
+                return ((UnpackedJarEntry)bundle.getEntry(name)).getFile().toURI().toURL();
+            } catch (MalformedURLException e) {
+            	return null;
+            }
         }
     }
 }

Modified: geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/TldProvider.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/TldProvider.java?rev=1371042&r1=1371041&r2=1371042&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/TldProvider.java
(original)
+++ geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/TldProvider.java
Thu Aug  9 05:37:42 2012
@@ -30,16 +30,32 @@ public interface TldProvider {
         private URL url;
         private Bundle bundle;
         private URL jarUrl;
+        private URL fileUrl;
         private String name;
         
         public TldEntry(Bundle bundle, URL url) {
-            this(bundle, url, null);
+            this(bundle, url, null, null);
         }
         
         public TldEntry(Bundle bundle, URL url, URL jarUrl) {
             this.bundle = bundle;
             this.url = url;            
             this.jarUrl = jarUrl;
+            this.fileUrl = null;
+            
+            String path = url.getPath();
+            if (path.startsWith("/")) {
+                name = path.substring(1);
+            } else {
+                name = path;
+            }
+        }
+        
+        public TldEntry(Bundle bundle, URL url, URL jarUrl, URL fileUrl) {
+            this.bundle = bundle;
+            this.url = url;            
+            this.jarUrl = jarUrl;
+            this.fileUrl = fileUrl;
             
             String path = url.getPath();
             if (path.startsWith("/")) {
@@ -65,5 +81,9 @@ public interface TldProvider {
             return name;
         }
 
+        public URL getFileUrl() {
+            return fileUrl;
+        }
+
     }
 }

Modified: geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/internal/TldRegistryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/internal/TldRegistryImpl.java?rev=1371042&r1=1371041&r2=1371042&view=diff
==============================================================================
--- geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/internal/TldRegistryImpl.java
(original)
+++ geronimo/server/branches/3.0/plugins/jasper/geronimo-jasper/src/main/java/org/apache/geronimo/jasper/internal/TldRegistryImpl.java
Thu Aug  9 05:37:42 2012
@@ -151,6 +151,7 @@ public class TldRegistryImpl implements 
         public boolean foundInDirectory(Bundle bundle, String basePath, URL url) throws Exception
{
             LOGGER.debug("Found {} TLD in bundle {}", url, bundle);
             URL jarURL = null;
+            URL fileURL = null;
             /* 
              * Try to convert to jar: url if possible. Makes life easier for Japser. 
              * See GERONIMO-6295. 
@@ -162,8 +163,14 @@ public class TldRegistryImpl implements 
                 if (pos != -1) {
                     jarURL = new URL(urlString.substring(4 /* jar: */, pos));
                 }
+            } else if("file".equals(convertedURL.getProtocol())){            	 
+                String urlString = convertedURL.toExternalForm();
+                int pos = urlString.indexOf(basePath);
+                if (pos != -1) {
+                   fileURL = new URL(urlString.substring(0, pos));
+                }
             }
-            tlds.add(new TldProvider.TldEntry(bundle, url, jarURL));            
+            tlds.add(new TldProvider.TldEntry(bundle, url, jarURL, fileURL));           

             return true;
         }
 

Modified: geronimo/server/branches/3.0/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/3.0/pom.xml?rev=1371042&r1=1371041&r2=1371042&view=diff
==============================================================================
--- geronimo/server/branches/3.0/pom.xml (original)
+++ geronimo/server/branches/3.0/pom.xml Thu Aug  9 05:37:42 2012
@@ -66,7 +66,7 @@
         FIXME: STOP using properties for dependency versions unless you absolutly need them,
                ie. you have a hundred dependencies that all use the same version.
         -->
-        <tomcatVersion>7.0.27.1</tomcatVersion>
+        <tomcatVersion>7.0.27.2-SNAPSHOT</tomcatVersion>
         <tomcatGroupId>org.apache.geronimo.ext.tomcat</tomcatGroupId>
 
         <openejbVersion>4.0.0-beta-1</openejbVersion>



Mime
View raw message