geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From xuhaih...@apache.org
Subject svn commit: r937587 - in /geronimo/external/trunk/tomcat-parent-7.0.0: ./ catalina/ jasper/src/main/java/org/apache/jasper/ jasper/src/main/java/org/apache/jasper/compiler/ jasper/src/main/java/org/apache/jasper/servlet/
Date Sat, 24 Apr 2010 03:46:05 GMT
Author: xuhaihong
Date: Sat Apr 24 03:46:05 2010
New Revision: 937587

URL: http://svn.apache.org/viewvc?rev=937587&view=rev
Log:
1. Merge Bug-48689.patch
2. Update SCM configurations
3. Not import org.apache.juli for catalina

Added:
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
  (with props)
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
  (with props)
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
  (with props)
Modified:
    geronimo/external/trunk/tomcat-parent-7.0.0/catalina/pom.xml
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/Parser.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ParserController.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java
    geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
    geronimo/external/trunk/tomcat-parent-7.0.0/pom.xml

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/catalina/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/catalina/pom.xml?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/catalina/pom.xml (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/catalina/pom.xml Sat Apr 24 03:46:05 2010
@@ -74,7 +74,7 @@
                 <artifactId>maven-bundle-plugin</artifactId>
                 <configuration>
                     <instructions>                        
-                        <Import-Package>javax.servlet.resources,javax.servlet.jsp.resources,*</Import-Package>
+                        <Import-Package>javax.servlet.resources,javax.servlet.jsp.resources,!org.apache.juli,*</Import-Package>
                     </instructions>
                 </configuration>
             </plugin>

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
Sat Apr 24 03:46:05 2010
@@ -30,10 +30,12 @@ import javax.servlet.ServletContext;
 import javax.servlet.jsp.tagext.TagInfo;
 
 import org.apache.jasper.compiler.Compiler;
+import org.apache.jasper.compiler.JarResource;
 import org.apache.jasper.compiler.JspRuntimeContext;
 import org.apache.jasper.compiler.JspUtil;
 import org.apache.jasper.compiler.Localizer;
 import org.apache.jasper.compiler.ServletWriter;
+import org.apache.jasper.compiler.TldLocation;
 import org.apache.jasper.servlet.JasperLoader;
 import org.apache.jasper.servlet.JspServletWrapper;
 import org.apache.juli.logging.Log;
@@ -57,7 +59,7 @@ public class JspCompilationContext {
 
     private final Log log = LogFactory.getLog(JspCompilationContext.class); // must not be
static
 
-    protected Map<String, URL> tagFileJarUrls;
+    protected Map<String, JarResource> tagFileJarUrls;
     protected boolean isPackagedTagFile;
 
     protected String className;
@@ -91,7 +93,7 @@ public class JspCompilationContext {
     protected boolean isTagFile;
     protected boolean protoTypeMode;
     protected TagInfo tagInfo;
-    protected URL tagFileJarUrl;
+    protected JarResource tagFileJarLocation;
 
     // jspURI _must_ be relative to the context
     public JspCompilationContext(String jspUri,
@@ -121,7 +123,7 @@ public class JspCompilationContext {
         }
 
         this.rctxt = rctxt;
-        this.tagFileJarUrls = new HashMap<String, URL>();
+        this.tagFileJarUrls = new HashMap<String, JarResource>();
         this.basePackageName = Constants.JSP_PACKAGE_NAME;
     }
 
@@ -131,12 +133,12 @@ public class JspCompilationContext {
                                  ServletContext context,
                                  JspServletWrapper jsw,
                                  JspRuntimeContext rctxt,
-                                 URL tagFileJarUrl) {
+                                 JarResource tagFileJarLocation) {
         this(tagfile, false, options, context, jsw, rctxt);
         this.isTagFile = true;
         this.tagInfo = tagInfo;
-        this.tagFileJarUrl = tagFileJarUrl;
-        if (tagFileJarUrl != null) {
+        this.tagFileJarLocation = tagFileJarLocation;
+        if (tagFileJarLocation != null) {
             isPackagedTagFile = true;
         }
     }
@@ -288,12 +290,12 @@ public class JspCompilationContext {
 
         if (res.startsWith("/META-INF/")) {
             // This is a tag file packaged in a jar that is being compiled
-            URL jarUrl = tagFileJarUrls.get(res);
-            if (jarUrl == null) {
-                jarUrl = tagFileJarUrl;
+            JarResource jarLocation = tagFileJarUrls.get(res);
+            if (jarLocation == null) {
+                jarLocation = tagFileJarLocation;
             }
-            if (jarUrl != null) {
-                result = new URL(jarUrl.toExternalForm() + res.substring(1));
+            if (jarLocation != null) {
+                result = jarLocation.getEntry(res.substring(1));
             } else {
                 // May not be in a JAR in some IDE environments
                 result = context.getResource(canonicalURI(res));
@@ -333,12 +335,12 @@ public class JspCompilationContext {
      * The map is populated when parsing the tag-file elements of the TLDs
      * of any imported taglibs. 
      */
-    public URL getTagFileJarUrl(String tagFile) {
+    public JarResource getTagFileJarLocation(String tagFile) {
         return this.tagFileJarUrls.get(tagFile);
     }
 
-    public void setTagFileJarUrl(String tagFile, URL tagFileURL) {
-        this.tagFileJarUrls.put(tagFile, tagFileURL);
+    public void setTagFileJarLocation(String tagFile, JarResource jarLocation) {
+        this.tagFileJarUrls.put(tagFile, jarLocation);
     }
 
     /**
@@ -347,8 +349,8 @@ public class JspCompilationContext {
      * JspCompilationContext does not correspond to a tag file, or if the
      * corresponding tag file is not packaged in a JAR.
      */
-    public URL getTagFileJarUrl() {
-        return this.tagFileJarUrl;
+    public JarResource getTagFileJarLocation() {
+        return this.tagFileJarLocation;
     }
 
     /* ==================== Common implementation ==================== */
@@ -549,8 +551,8 @@ public class JspCompilationContext {
      * Returns null if the given uri is not associated with any tag library
      * 'exposed' in the web application.
      */
-    public String[] getTldLocation(String uri) throws JasperException {
-        String[] location = 
+    public TldLocation getTldLocation(String uri) throws JasperException {
+        TldLocation location = 
             getOptions().getTldLocationsCache().getLocation(uri);
         return location;
     }

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
Sat Apr 24 03:46:05 2010
@@ -195,7 +195,7 @@ class ImplicitTagLibraryInfo extends Tag
                 tagInfo = TagFileProcessor.parseTagFileDirectives(pc,
                         shortName,
                         path,
-                        pc.getJspCompilationContext().getTagFileJarUrl(path),
+                        pc.getJspCompilationContext().getTagFileJarLocation(path),
                         this);
             } catch (JasperException je) {
                 throw new RuntimeException(je.toString(), je);

Added: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java?rev=937587&view=auto
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
(added)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
Sat Apr 24 03:46:05 2010
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jasper.compiler;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.jar.JarFile;
+
+public interface JarResource {
+       
+    /**     
+     * @return The JarFile for this resource. A new instance of JarFile
+     *         should be returned on each call.
+     * @throws IOException
+     */
+    JarFile getJarFile() throws IOException;
+       
+    /**     
+     * @return The URL of this resource. May or may not point 
+     *         to the actual Jar file.    
+     */
+    String getUrl();
+    
+    /**     
+     * @param name
+     * @return The URL for the entry within this resource.
+     */
+    URL getEntry(String name);
+
+}

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java?rev=937587&view=auto
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
(added)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
Sat Apr 24 03:46:05 2010
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jasper.compiler;
+
+import java.io.IOException;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.jar.JarFile;
+
+public class JarURLResource implements JarResource {
+    
+    private String jarUrl;
+    
+    public JarURLResource(URL jarURL) {
+        this(jarURL.toExternalForm());
+    }
+    
+    public JarURLResource(String jarUrl) {
+        this.jarUrl = jarUrl;
+    }
+    
+    public JarFile getJarFile() throws IOException {
+        URL jarFileUrl = new URL("jar:" + jarUrl + "!/");
+        JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
+        conn.setUseCaches(false);
+        conn.connect();
+        return conn.getJarFile();
+    }
+       
+    public String getUrl() {
+        return jarUrl;
+    }
+    
+    public URL getEntry(String name) {
+        try {
+            return new URL("jar:" + jarUrl + "!/" + name);
+        } catch (MalformedURLException e) {
+            throw new RuntimeException("", e);
+        }
+    }
+}

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java
Sat Apr 24 03:46:05 2010
@@ -1271,7 +1271,7 @@ class JspDocumentParser
                 isPlainUri = true;
             }
 
-            String[] location = ctxt.getTldLocation(uri);
+            TldLocation location = ctxt.getTldLocation(uri);
             if (location != null || !isPlainUri) {
                 if (ctxt.getOptions().isCaching()) {
                     result = ctxt.getOptions().getCache().get(uri);

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/Parser.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/Parser.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/Parser.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/Parser.java
Sat Apr 24 03:46:05 2010
@@ -60,7 +60,7 @@ class Parser implements TagConstants {
 
     private boolean directivesOnly;
 
-    private URL jarFileUrl;
+    private JarResource jarLocation;
 
     private PageInfo pageInfo;
 
@@ -79,7 +79,7 @@ class Parser implements TagConstants {
      * The constructor
      */
     private Parser(ParserController pc, JspReader reader, boolean isTagFile,
-            boolean directivesOnly, URL jarFileUrl) {
+            boolean directivesOnly, JarResource jarLocation) {
         this.parserController = pc;
         this.ctxt = pc.getJspCompilationContext();
         this.pageInfo = pc.getCompiler().getPageInfo();
@@ -88,7 +88,7 @@ class Parser implements TagConstants {
         this.scriptlessCount = 0;
         this.isTagFile = isTagFile;
         this.directivesOnly = directivesOnly;
-        this.jarFileUrl = jarFileUrl;
+        this.jarLocation = jarLocation;
         start = reader.mark();
     }
 
@@ -106,12 +106,12 @@ class Parser implements TagConstants {
      */
     public static Node.Nodes parse(ParserController pc, JspReader reader,
             Node parent, boolean isTagFile, boolean directivesOnly,
-            URL jarFileUrl, String pageEnc, String jspConfigPageEnc,
+            JarResource jarLocation, String pageEnc, String jspConfigPageEnc,
             boolean isDefaultPageEncoding, boolean isBomPresent)
             throws JasperException {
 
         Parser parser = new Parser(pc, reader, isTagFile, directivesOnly,
-                jarFileUrl);
+                jarLocation);
 
         Node.Root root = new Node.Root(reader.mark(), parent, false);
         root.setPageEncoding(pageEnc);
@@ -295,7 +295,7 @@ class Parser implements TagConstants {
         }
 
         try {
-            parserController.parse(file, parent, jarFileUrl);
+            parserController.parse(file, parent, jarLocation);
         } catch (FileNotFoundException ex) {
             err.jspError(start, "jsp.error.file.not.found", file);
         } catch (Exception ex) {
@@ -384,7 +384,7 @@ class Parser implements TagConstants {
                                 .getCache().get(uri);
                     }
                     if (impl == null) {
-                        String[] location = ctxt.getTldLocation(uri);
+                        TldLocation location = ctxt.getTldLocation(uri);
                         impl = new TagLibraryInfoImpl(ctxt, parserController,
                                 pageInfo, prefix, uri, location, err);
                         if (ctxt.getOptions().isCaching()) {
@@ -394,8 +394,8 @@ class Parser implements TagConstants {
                         // Current compilation context needs location of cached
                         // tag files
                         for (TagFileInfo info : impl.getTagFiles()) {
-                            ctxt.setTagFileJarUrl(info.getPath(),
-                                    ctxt.getTagFileJarUrl());
+                            ctxt.setTagFileJarLocation(info.getPath(),
+                                    ctxt.getTagFileJarLocation());
                         }
                     }
                     pageInfo.addTaglib(uri, impl);

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ParserController.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ParserController.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ParserController.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/ParserController.java
Sat Apr 24 03:46:05 2010
@@ -100,7 +100,7 @@ class ParserController implements TagCon
         // respectively.
         isTagFile = ctxt.isTagFile();
         directiveOnly = false;
-        return doParse(inFileName, null, ctxt.getTagFileJarUrl());
+        return doParse(inFileName, null, ctxt.getTagFileJarLocation());
     }
 
     /**
@@ -117,7 +117,7 @@ class ParserController implements TagCon
         // respectively.
         isTagFile = ctxt.isTagFile();
         directiveOnly = true;
-        return doParse(inFileName, null, ctxt.getTagFileJarUrl());
+        return doParse(inFileName, null, ctxt.getTagFileJarLocation());
     }
 
 
@@ -129,12 +129,11 @@ class ParserController implements TagCon
      * @param jarFileUrl The JAR file from which to read the included resource,
      * or null of the included resource is to be read from the filesystem
      */
-    public Node.Nodes parse(String inFileName, Node parent,
-            URL jarFileUrl)
+    public Node.Nodes parse(String inFileName, Node parent, JarResource jarLocation)
     throws FileNotFoundException, JasperException, IOException {
         // For files that are statically included, isTagfile and directiveOnly
         // remain unchanged.
-        return doParse(inFileName, parent, jarFileUrl);
+        return doParse(inFileName, parent, jarLocation);
     }
 
     /**
@@ -145,14 +144,13 @@ class ParserController implements TagCon
      * @param inFileName    The name of the tag file to be parsed.
      * @param tagFileJarUrl The location of the tag file.
      */
-    public Node.Nodes parseTagFileDirectives(String inFileName,
-            URL tagFileJarUrl)
+    public Node.Nodes parseTagFileDirectives(String inFileName, JarResource jarLocation)
             throws FileNotFoundException, JasperException, IOException {
         boolean isTagFileSave = isTagFile;
         boolean directiveOnlySave = directiveOnly;
         isTagFile = true;
         directiveOnly = true;
-        Node.Nodes page = doParse(inFileName, null, tagFileJarUrl);
+        Node.Nodes page = doParse(inFileName, null, jarLocation);
         directiveOnly = directiveOnlySave;
         isTagFile = isTagFileSave;
         return page;
@@ -174,7 +172,7 @@ class ParserController implements TagCon
      */
     private Node.Nodes doParse(String inFileName,
             Node parent,
-            URL jarFileUrl)
+            JarResource jarLocation)
     throws FileNotFoundException, JasperException, IOException {
 
         Node.Nodes parsedPage = null;
@@ -182,7 +180,7 @@ class ParserController implements TagCon
         isBomPresent = false;
         isDefaultPageEncoding = false;
 
-        JarFile jarFile = getJarFile(jarFileUrl);
+        JarFile jarFile = (jarLocation == null) ? null : jarLocation.getJarFile();
         String absFileName = resolveFileName(inFileName);
         String jspConfigPageEnc = getJspConfigPageEncoding(absFileName);
 
@@ -196,7 +194,7 @@ class ParserController implements TagCon
                 compiler.getPageInfo().addDependant(absFileName);
             } else {
                 compiler.getPageInfo().addDependant(
-                        jarFileUrl.toExternalForm() + absFileName.substring(1));
+                        jarLocation.getEntry(absFileName.substring(1)).toExternalForm());
             }
         }
 
@@ -237,7 +235,7 @@ class ParserController implements TagCon
                         sourceEnc, inStreamReader,
                         err);
                 parsedPage = Parser.parse(this, jspReader, parent, isTagFile,
-                        directiveOnly, jarFileUrl,
+                        directiveOnly, jarLocation,
                         sourceEnc, jspConfigPageEnc,
                         isDefaultPageEncoding, isBomPresent);
             } finally {
@@ -606,17 +604,4 @@ class ParserController implements TagCon
         return false;
     }
 
-    private JarFile getJarFile(URL jarFileUrl) throws IOException {
-        JarFile jarFile = null;
-
-        if (jarFileUrl != null) {
-            JarURLConnection conn = (JarURLConnection) jarFileUrl.openConnection();
-            conn.setUseCaches(false);
-            conn.connect();
-            jarFile = conn.getJarFile();
-        }
-
-        return jarFile;
-    }
-
 }

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
Sat Apr 24 03:46:05 2010
@@ -489,7 +489,7 @@ class TagFileProcessor {
      * @return a TagInfo object assembled from the directives in the tag file.
      */
     public static TagInfo parseTagFileDirectives(ParserController pc,
-            String name, String path, URL tagFileJarUrl, TagLibraryInfo tagLibInfo)
+            String name, String path, JarResource tagFileJarLocation, TagLibraryInfo tagLibInfo)
             throws JasperException {
 
 
@@ -497,7 +497,7 @@ class TagFileProcessor {
 
         Node.Nodes page = null;
         try {
-            page = pc.parseTagFileDirectives(path, tagFileJarUrl);
+            page = pc.parseTagFileDirectives(path, tagFileJarLocation);
         } catch (FileNotFoundException e) {
             err.jspError("jsp.error.file.not.found", path);
         } catch (IOException e) {
@@ -518,33 +518,29 @@ class TagFileProcessor {
     private Class<?> loadTagFile(Compiler compiler, String tagFilePath,
             TagInfo tagInfo, PageInfo parentPageInfo) throws JasperException {
 
-        URL tagFileJarUrl = null;
+        JarResource tagFileJarLocation = null;
         if (tagFilePath.startsWith("/META-INF/")) {
-            try { 
-                tagFileJarUrl = new URL("jar:" +
+            tagFileJarLocation = 
                         compiler.getCompilationContext().getTldLocation(
-                        tagInfo.getTagLibrary().getURI())[0] + "!/");
-            } catch (MalformedURLException e) {
-                // Ignore - tagFileJarUrl will be null
-            }
+                        tagInfo.getTagLibrary().getURI()).getJarResource();
         }
-        String tagFileJarPath;
-        if (tagFileJarUrl == null) {
-            tagFileJarPath = "";
+        
+        String wrapperUri;
+        if (tagFileJarLocation == null) {
+            wrapperUri = tagFilePath;
         } else {
-            tagFileJarPath = tagFileJarUrl.toString();
+            wrapperUri = tagFileJarLocation.getEntry(tagFilePath).toExternalForm();
         }
 
         JspCompilationContext ctxt = compiler.getCompilationContext();
         JspRuntimeContext rctxt = ctxt.getRuntimeContext();
-        String wrapperUri = tagFileJarPath + tagFilePath;
         JspServletWrapper wrapper = rctxt.getWrapper(wrapperUri);
 
         synchronized (rctxt) {
             if (wrapper == null) {
                 wrapper = new JspServletWrapper(ctxt.getServletContext(), ctxt
                         .getOptions(), tagFilePath, tagInfo, ctxt
-                        .getRuntimeContext(), tagFileJarUrl);
+                        .getRuntimeContext(), tagFileJarLocation);
                 rctxt.addWrapper(wrapperUri, wrapper);
 
                 // Use same classloader and classpath for compiling tag files
@@ -571,7 +567,7 @@ class TagFileProcessor {
                     JspServletWrapper tempWrapper = new JspServletWrapper(ctxt
                             .getServletContext(), ctxt.getOptions(),
                             tagFilePath, tagInfo, ctxt.getRuntimeContext(),
-                            ctxt.getTagFileJarUrl(tagFilePath));
+                            ctxt.getTagFileJarLocation(tagFilePath));
                     tagClazz = tempWrapper.loadTagFilePrototype();
                     tempVector.add(tempWrapper.getJspEngineContext()
                             .getCompiler());
@@ -625,15 +621,14 @@ class TagFileProcessor {
                 String tagFilePath = tagFileInfo.getPath();
                 if (tagFilePath.startsWith("/META-INF/")) {
                     // For tags in JARs, add the TLD and the tag as a dependency
-                    String[] location =
+                    TldLocation location =
                         compiler.getCompilationContext().getTldLocation(
                             tagFileInfo.getTagInfo().getTagLibrary().getURI());
+                    JarResource jarResource = location.getJarResource();
                     // Add TLD
-                    pageInfo.addDependant("jar:" + location[0] + "!/" +
-                            location[1]);
+                    pageInfo.addDependant(jarResource.getEntry(location.getName()).toExternalForm());
                     // Add Tag
-                    pageInfo.addDependant("jar:" + location[0] + "!" +
-                            tagFilePath);
+                    pageInfo.addDependant(jarResource.getEntry(tagFilePath.substring(1)).toExternalForm());
                 } else {
                     pageInfo.addDependant(tagFilePath);
                 }

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
Sat Apr 24 03:46:05 2010
@@ -23,7 +23,6 @@ import java.io.FileNotFoundException;
 import java.io.InputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.net.JarURLConnection;
 import java.net.URL;
 import java.util.Collection;
 import java.util.Enumeration;
@@ -31,8 +30,6 @@ import java.util.Hashtable;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Vector;
-import java.util.jar.JarFile;
-import java.util.zip.ZipEntry;
 
 import javax.servlet.jsp.tagext.FunctionInfo;
 import javax.servlet.jsp.tagext.PageData;
@@ -137,7 +134,7 @@ class TagLibraryInfoImpl extends TagLibr
      * Constructor.
      */
     public TagLibraryInfoImpl(JspCompilationContext ctxt, ParserController pc, PageInfo pi,
-            String prefix, String uriIn, String[] location, ErrorDispatcher err)
+            String prefix, String uriIn, TldLocation location, ErrorDispatcher err)
             throws JasperException {
         super(prefix, uriIn);
 
@@ -146,7 +143,6 @@ class TagLibraryInfoImpl extends TagLibr
         this.pi = pi;
         this.err = err;
         InputStream in = null;
-        JarFile jarFile = null;
 
         if (location == null) {
             // The URI points to the TLD itself or to a JAR file in which the
@@ -154,39 +150,34 @@ class TagLibraryInfoImpl extends TagLibr
             location = generateTLDLocation(uri, ctxt);
         }
 
+        String name = location.getName();
+        JarResource jarResource = location.getJarResource();
         try {
-            if (location[1] == null) {
+            if (jarResource == null) {
                 // Location points directly to TLD file
                 try {
-                    in = getResourceAsStream(location[0]);
+                    in = getResourceAsStream(name);
                     if (in == null) {
-                        throw new FileNotFoundException(location[0]);
+                        throw new FileNotFoundException(name);
                     }
                 } catch (FileNotFoundException ex) {
-                    err.jspError("jsp.error.file.not.found", location[0]);
+                    err.jspError("jsp.error.file.not.found", name);
                 }
 
-                parseTLD(location[0], in, null);
+                parseTLD(name, in, null);
                 // Add TLD to dependency list
                 PageInfo pageInfo = ctxt.createCompiler().getPageInfo();
                 if (pageInfo != null) {
-                    pageInfo.addDependant(location[0]);
+                    pageInfo.addDependant(name);
                 }
             } else {
                 // Tag library is packaged in JAR file
                 try {
-                    URL jarFileUrl = new URL("jar:" + location[0] + "!/");
-                    JarURLConnection conn = (JarURLConnection) jarFileUrl
-                            .openConnection();
-                    conn.setUseCaches(false);
-                    conn.connect();
-                    jarFile = conn.getJarFile();
-                    ZipEntry jarEntry = jarFile.getEntry(location[1]);
-                    in = jarFile.getInputStream(jarEntry);
-                    parseTLD(location[0], in, jarFileUrl);
+                    in = jarResource.getEntry(name).openStream();
+                    parseTLD(jarResource.getUrl(), in, jarResource);
                 } catch (Exception ex) {
-                    err.jspError("jsp.error.tld.unable_to_read", location[0],
-                            location[1], ex.toString());
+                    err.jspError("jsp.error.tld.unable_to_read", jarResource.getUrl(),
+                            name, ex.toString());
                 }
             }
         } finally {
@@ -196,12 +187,6 @@ class TagLibraryInfoImpl extends TagLibr
                 } catch (Throwable t) {
                 }
             }
-            if (jarFile != null) {
-                try {
-                    jarFile.close();
-                } catch (Throwable t) {
-                }
-            }
         }
 
     }
@@ -217,7 +202,7 @@ class TagLibraryInfoImpl extends TagLibr
      * in The TLD's input stream @param jarFileUrl The JAR file containing the
      * TLD, or null if the tag library is not packaged in a JAR
      */
-    private void parseTLD(String uri, InputStream in, URL jarFileUrl)
+    private void parseTLD(String uri, InputStream in, JarResource jarFileLocation)
             throws JasperException {
         Vector<TagInfo> tagVector = new Vector<TagInfo>();
         Vector<TagFileInfo> tagFileVector = new Vector<TagFileInfo>();
@@ -257,7 +242,7 @@ class TagLibraryInfoImpl extends TagLibr
                 tagVector.addElement(createTagInfo(element, jspversion));
             else if ("tag-file".equals(tname)) {
                 TagFileInfo tagFileInfo = createTagFileInfo(element,
-                        jarFileUrl);
+                        jarFileLocation);
                 tagFileVector.addElement(tagFileInfo);
             } else if ("function".equals(tname)) { // JSP2.0
                 FunctionInfo funcInfo = createFunctionInfo(element);
@@ -314,7 +299,7 @@ class TagLibraryInfoImpl extends TagLibr
      * the name of the TLD entry in the jar file, which is hardcoded to
      * META-INF/taglib.tld.
      */
-    private String[] generateTLDLocation(String uri, JspCompilationContext ctxt)
+    private TldLocation generateTLDLocation(String uri, JspCompilationContext ctxt)
             throws JasperException {
 
         int uriType = TldLocationsCache.uriType(uri);
@@ -325,24 +310,21 @@ class TagLibraryInfoImpl extends TagLibr
             uri = ctxt.resolveRelativeUri(uri);
         }
 
-        String[] location = new String[2];
-        location[0] = uri;
-        if (location[0].endsWith(".jar")) {
+        if (uri.endsWith(".jar")) {
             URL url = null;
             try {
-                url = ctxt.getResource(location[0]);
+                url = ctxt.getResource(uri);
             } catch (Exception ex) {
-                err.jspError("jsp.error.tld.unable_to_get_jar", location[0], ex
+                err.jspError("jsp.error.tld.unable_to_get_jar", uri, ex
                         .toString());
             }
             if (url == null) {
-                err.jspError("jsp.error.tld.missing_jar", location[0]);
+                err.jspError("jsp.error.tld.missing_jar", uri);
             }
-            location[0] = url.toString();
-            location[1] = "META-INF/taglib.tld";
+            return new TldLocation("META-INF/taglib.tld", new JarURLResource(url));
+        } else {
+            return new TldLocation(uri);
         }
-
-        return location;
     }
 
     private TagInfo createTagInfo(TreeNode elem, String jspVersion)
@@ -453,7 +435,7 @@ class TagLibraryInfoImpl extends TagLibr
      * 
      * @return TagInfo corresponding to tag file directives
      */
-    private TagFileInfo createTagFileInfo(TreeNode elem, URL jarFileUrl)
+    private TagFileInfo createTagFileInfo(TreeNode elem, JarResource jarLocation)
             throws JasperException {
 
         String name = null;
@@ -488,13 +470,13 @@ class TagLibraryInfoImpl extends TagLibr
             // See https://issues.apache.org/bugzilla/show_bug.cgi?id=46471
             // This needs to be removed once all the broken code that depends on
             // it has been removed
-            ctxt.setTagFileJarUrl(path, jarFileUrl);
+            ctxt.setTagFileJarLocation(path, jarLocation);
         } else if (!path.startsWith("/WEB-INF/tags")) {
             err.jspError("jsp.error.tagfile.illegalPath", path);
         }
 
         TagInfo tagInfo = TagFileProcessor.parseTagFileDirectives(
-                parserController, name, path, jarFileUrl, this);
+                parserController, name, path, jarLocation, this);
         return new TagFileInfo(name, path, tagInfo);
     }
 

Added: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java?rev=937587&view=auto
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
(added)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
Sat Apr 24 03:46:05 2010
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jasper.compiler;
+
+public class TldLocation {
+    
+    private String entryName;
+    private JarResource jar;
+    
+    public TldLocation(String entryName) {
+        this(entryName, (JarResource)null);
+    }
+    
+    public TldLocation(String entryName, String resourceUrl) {
+        this(entryName, getJarResource(resourceUrl));
+    }
+    
+    public TldLocation(String entryName, JarResource jarResource) {
+        if (entryName == null) {
+            throw new IllegalArgumentException("Tld name is required");
+        }
+        this.entryName = entryName;
+        this.jar = jarResource;
+    }
+        
+    private static JarResource getJarResource(String resourceUrl) {
+        return (resourceUrl != null) ? new JarURLResource(resourceUrl) : null;
+    }
+    
+    /**
+     * @return The name of the tag library.
+     */
+    public String getName() {
+        return entryName;
+    }
+    
+    /**
+     * 
+     * @return The jar resource the tag library is contained in. 
+     *         Might return null if the tag library is not contained in jar resource.
+     */
+    public JarResource getJarResource() {
+        return jar;
+    }
+}

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java
Sat Apr 24 03:46:05 2010
@@ -96,7 +96,7 @@ public class TldLocationsCache {
      *    [0] The location
      *    [1] If the location is a jar file, this is the location of the tld.
      */
-    private Hashtable<String, String[]> mappings;
+    private Hashtable<String, TldLocation> mappings;
 
     private boolean initialized;
     private ServletContext ctxt;
@@ -108,7 +108,7 @@ public class TldLocationsCache {
      */
     public TldLocationsCache(ServletContext ctxt) {
         this.ctxt = ctxt;
-        mappings = new Hashtable<String, String[]>();
+        mappings = new Hashtable<String, TldLocation>();
         initialized = false;
     }
 
@@ -150,7 +150,7 @@ public class TldLocationsCache {
      * Returns null if the uri is not associated with any tag library 'exposed'
      * in the web application.
      */
-    public String[] getLocation(String uri) throws JasperException {
+    public TldLocation getLocation(String uri) throws JasperException {
         if (!initialized) {
             init();
         }
@@ -262,12 +262,13 @@ public class TldLocationsCache {
                     continue;
                 if (uriType(tagLoc) == NOROOT_REL_URI)
                     tagLoc = "/WEB-INF/" + tagLoc;
-                String tagLoc2 = null;
+                TldLocation location;
                 if (tagLoc.endsWith(JAR_EXT)) {
-                    tagLoc = ctxt.getResource(tagLoc).toString();
-                    tagLoc2 = "META-INF/taglib.tld";
+                    location = new TldLocation("META-INF/taglib.tld", ctxt.getResource(tagLoc).toString());
+                } else {
+                    location = new TldLocation(tagLoc);
                 }
-                mappings.put(tagUri, new String[] { tagLoc, tagLoc2 });
+                mappings.put(tagUri, location);
             }
         } finally {
             if (webXml != null) {
@@ -422,7 +423,13 @@ public class TldLocationsCache {
             // Add implicit map entry only if its uri is not already
             // present in the map
             if (uri != null && mappings.get(uri) == null) {
-                mappings.put(uri, new String[]{ resourcePath, entryName });
+                TldLocation location;
+                if (entryName == null) {
+                    location = new TldLocation(resourcePath);
+                } else {
+                    location = new TldLocation(entryName, resourcePath);
+                }
+                mappings.put(uri, location);
             }
         } catch (JasperException e) {
             // Hack - makes exception handling simpler

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
(original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
Sat Apr 24 03:46:05 2010
@@ -35,6 +35,7 @@ import org.apache.jasper.JasperException
 import org.apache.jasper.JspCompilationContext;
 import org.apache.jasper.Options;
 import org.apache.jasper.compiler.ErrorDispatcher;
+import org.apache.jasper.compiler.JarResource;
 import org.apache.jasper.compiler.JavacErrorDetail;
 import org.apache.jasper.compiler.JspRuntimeContext;
 import org.apache.jasper.compiler.Localizer;
@@ -105,7 +106,7 @@ public class JspServletWrapper {
                              String tagFilePath,
                              TagInfo tagInfo,
                              JspRuntimeContext rctxt,
-                             URL tagFileJarUrl) {
+                             JarResource tagFileJarLocation) {
 
         this.isTagFile = true;
         this.config = null;        // not used
@@ -114,7 +115,7 @@ public class JspServletWrapper {
         this.tripCount = 0;
         ctxt = new JspCompilationContext(jspUri, tagInfo, options,
                                          servletContext, this, rctxt,
-                                         tagFileJarUrl);
+                                         tagFileJarLocation);
     }
 
     public JspCompilationContext getJspEngineContext() {

Modified: geronimo/external/trunk/tomcat-parent-7.0.0/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/pom.xml?rev=937587&r1=937586&r2=937587&view=diff
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/pom.xml (original)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/pom.xml Sat Apr 24 03:46:05 2010
@@ -42,9 +42,9 @@ mvn archetype:generate -DarchetypeCatalo
     -->
 
     <scm>
-        <connection>scm:svn:https://svn.apache.org/repos/asf/geronimo/external/trunk/tomcat-archetype/</connection>
-        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/geronimo/external/trunk/tomcat-archetype/</developerConnection>
-        <url>http://svn.apache.org/viewcvs.cgi/geronimo/external/trunk/tomcat-archetype/</url>
+        <connection>scm:svn:https://svn.apache.org/repos/asf/geronimo/external/trunk/tomcat-parent-7.0.0/</connection>
+        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/geronimo/external/trunk/tomcat-parent-7.0.0/</developerConnection>
+        <url>http://svn.apache.org/viewcvs.cgi/geronimo/external/trunk/tomcat-parent-7.0.0/</url>
     </scm>
 
     <dependencyManagement>



Mime
View raw message