You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2010/02/09 04:21:46 UTC
svn commit: r907905 - in /geronimo/external/trunk/tomcat-parent-7.0.0: ./
jasper/src/main/java/org/apache/jasper/
jasper/src/main/java/org/apache/jasper/compiler/
jasper/src/main/java/org/apache/jasper/servlet/
Author: gawor
Date: Tue Feb 9 03:21:45 2010
New Revision: 907905
URL: http://svn.apache.org/viewvc?rev=907905&view=rev
Log:
GERONIMO-5051: Update jasper so that it can parse TLDs from other (non-application) bundles. The same patch was submitted to Tomcat - Bug 48689
Added:
geronimo/external/trunk/tomcat-parent-7.0.0/Bug-48689.patch
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/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
Added: geronimo/external/trunk/tomcat-parent-7.0.0/Bug-48689.patch
URL: http://svn.apache.org/viewvc/geronimo/external/trunk/tomcat-parent-7.0.0/Bug-48689.patch?rev=907905&view=auto
==============================================================================
--- geronimo/external/trunk/tomcat-parent-7.0.0/Bug-48689.patch (added)
+++ geronimo/external/trunk/tomcat-parent-7.0.0/Bug-48689.patch Tue Feb 9 03:21:45 2010
@@ -0,0 +1,907 @@
+Index: jasper/src/main/java/org/apache/jasper/JspCompilationContext.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/JspCompilationContext.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/JspCompilationContext.java (working copy)
+@@ -30,10 +30,12 @@
+ 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 @@
+
+ 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 @@
+ 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 @@
+ }
+
+ 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 @@
+ 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 @@
+
+ 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 if (res.startsWith("jar:file:")) {
+ // This is a tag file packaged in a jar that is being checked
+@@ -330,12 +332,12 @@
+ * 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);
+ }
+
+ /**
+@@ -344,8 +346,8 @@
+ * 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 ==================== */
+@@ -546,8 +548,8 @@
+ * 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;
+ }
+Index: jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/servlet/JspServletWrapper.java (working copy)
+@@ -35,6 +35,7 @@
+ 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 @@
+ String tagFilePath,
+ TagInfo tagInfo,
+ JspRuntimeContext rctxt,
+- URL tagFileJarUrl) {
++ JarResource tagFileJarLocation) {
+
+ this.isTagFile = true;
+ this.config = null; // not used
+@@ -114,7 +115,7 @@
+ this.tripCount = 0;
+ ctxt = new JspCompilationContext(jspUri, tagInfo, options,
+ servletContext, this, rctxt,
+- tagFileJarUrl);
++ tagFileJarLocation);
+ }
+
+ public JspCompilationContext getJspEngineContext() {
+Index: jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/ImplicitTagLibraryInfo.java (working copy)
+@@ -195,7 +195,7 @@
+ tagInfo = TagFileProcessor.parseTagFileDirectives(pc,
+ shortName,
+ path,
+- pc.getJspCompilationContext().getTagFileJarUrl(path),
++ pc.getJspCompilationContext().getTagFileJarLocation(path),
+ this);
+ } catch (JasperException je) {
+ throw new RuntimeException(je.toString(), je);
+Index: jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java (revision 0)
++++ jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java (revision 0)
+@@ -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);
++ }
++ }
++}
+
+Property changes on: jasper/src/main/java/org/apache/jasper/compiler/JarURLResource.java
+___________________________________________________________________
+Added: svn:mime-type
+ + text/plain
+Added: svn:keywords
+ + Date Revision
+Added: svn:eol-style
+ + native
+
+Index: jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/JspDocumentParser.java (working copy)
+@@ -1267,7 +1267,7 @@
+ 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);
+Index: jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java (revision 0)
++++ jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java (revision 0)
+@@ -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;
++ }
++}
+
+Property changes on: jasper/src/main/java/org/apache/jasper/compiler/TldLocation.java
+___________________________________________________________________
+Added: svn:mime-type
+ + text/plain
+Added: svn:keywords
+ + Date Revision
+Added: svn:eol-style
+ + native
+
+Index: jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/JarResource.java (revision 0)
++++ jasper/src/main/java/org/apache/jasper/compiler/JarResource.java (revision 0)
+@@ -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);
++
++}
+
+Property changes on: jasper/src/main/java/org/apache/jasper/compiler/JarResource.java
+___________________________________________________________________
+Added: svn:mime-type
+ + text/plain
+Added: svn:keywords
+ + Date Revision
+Added: svn:eol-style
+ + native
+
+Index: jasper/src/main/java/org/apache/jasper/compiler/ParserController.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/ParserController.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/ParserController.java (working copy)
+@@ -100,7 +100,7 @@
+ // respectively.
+ isTagFile = ctxt.isTagFile();
+ directiveOnly = false;
+- return doParse(inFileName, null, ctxt.getTagFileJarUrl());
++ return doParse(inFileName, null, ctxt.getTagFileJarLocation());
+ }
+
+ /**
+@@ -117,7 +117,7 @@
+ // respectively.
+ isTagFile = ctxt.isTagFile();
+ directiveOnly = true;
+- return doParse(inFileName, null, ctxt.getTagFileJarUrl());
++ return doParse(inFileName, null, ctxt.getTagFileJarLocation());
+ }
+
+
+@@ -129,12 +129,11 @@
+ * @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 @@
+ * @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 @@
+ */
+ private Node.Nodes doParse(String inFileName,
+ Node parent,
+- URL jarFileUrl)
++ JarResource jarLocation)
+ throws FileNotFoundException, JasperException, IOException {
+
+ Node.Nodes parsedPage = null;
+@@ -182,7 +180,7 @@
+ 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 @@
+ compiler.getPageInfo().addDependant(absFileName);
+ } else {
+ compiler.getPageInfo().addDependant(
+- jarFileUrl.toExternalForm() + absFileName.substring(1));
++ jarLocation.getEntry(absFileName.substring(1)).toExternalForm());
+ }
+ }
+
+@@ -237,7 +235,7 @@
+ sourceEnc, inStreamReader,
+ err);
+ parsedPage = Parser.parse(this, jspReader, parent, isTagFile,
+- directiveOnly, jarFileUrl,
++ directiveOnly, jarLocation,
+ sourceEnc, jspConfigPageEnc,
+ isDefaultPageEncoding, isBomPresent);
+ } finally {
+@@ -606,17 +604,4 @@
+ 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;
+- }
+-
+ }
+Index: jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/TagFileProcessor.java (working copy)
+@@ -489,7 +489,7 @@
+ * @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 @@
+
+ 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 @@
+ 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 @@
+ 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 @@
+ 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);
+ }
+Index: jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/TldLocationsCache.java (working copy)
+@@ -96,7 +96,7 @@
+ * [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 TldLocationsCache(ServletContext ctxt) {
+ this.ctxt = ctxt;
+- mappings = new Hashtable<String, String[]>();
++ mappings = new Hashtable<String, TldLocation>();
+ initialized = false;
+ }
+
+@@ -150,7 +150,7 @@
+ * 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 @@
+ 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 @@
+ // 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
+Index: jasper/src/main/java/org/apache/jasper/compiler/Parser.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/Parser.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/Parser.java (working copy)
+@@ -60,7 +60,7 @@
+
+ private boolean directivesOnly;
+
+- private URL jarFileUrl;
++ private JarResource jarLocation;
+
+ private PageInfo pageInfo;
+
+@@ -79,7 +79,7 @@
+ * 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 @@
+ this.scriptlessCount = 0;
+ this.isTagFile = isTagFile;
+ this.directivesOnly = directivesOnly;
+- this.jarFileUrl = jarFileUrl;
++ this.jarLocation = jarLocation;
+ start = reader.mark();
+ }
+
+@@ -106,12 +106,12 @@
+ */
+ 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);
+@@ -291,7 +291,7 @@
+ }
+
+ 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) {
+@@ -380,7 +380,7 @@
+ .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()) {
+@@ -390,8 +390,8 @@
+ // 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);
+Index: jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
+===================================================================
+--- jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (revision 906656)
++++ jasper/src/main/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (working copy)
+@@ -23,7 +23,6 @@
+ 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.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 @@
+ * 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 @@
+ 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 @@
+ 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 @@
+ } catch (Throwable t) {
+ }
+ }
+- if (jarFile != null) {
+- try {
+- jarFile.close();
+- } catch (Throwable t) {
+- }
+- }
+ }
+
+ }
+@@ -217,7 +202,7 @@
+ * 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 @@
+ 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 @@
+ * 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 @@
+ 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 @@
+ *
+ * @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 @@
+ // 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);
+ }
+
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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -30,10 +30,12 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 if (res.startsWith("jar:file:")) {
// This is a tag file packaged in a jar that is being checked
@@ -330,12 +332,12 @@
* 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);
}
/**
@@ -344,8 +346,8 @@
* 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 ==================== */
@@ -546,8 +548,8 @@
* 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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -195,7 +195,7 @@
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=907905&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 Tue Feb 9 03:21:45 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=907905&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 Tue Feb 9 03:21:45 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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -1267,7 +1267,7 @@
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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -60,7 +60,7 @@
private boolean directivesOnly;
- private URL jarFileUrl;
+ private JarResource jarLocation;
private PageInfo pageInfo;
@@ -79,7 +79,7 @@
* 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 @@
this.scriptlessCount = 0;
this.isTagFile = isTagFile;
this.directivesOnly = directivesOnly;
- this.jarFileUrl = jarFileUrl;
+ this.jarLocation = jarLocation;
start = reader.mark();
}
@@ -106,12 +106,12 @@
*/
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);
@@ -291,7 +291,7 @@
}
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) {
@@ -380,7 +380,7 @@
.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()) {
@@ -390,8 +390,8 @@
// 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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -100,7 +100,7 @@
// respectively.
isTagFile = ctxt.isTagFile();
directiveOnly = false;
- return doParse(inFileName, null, ctxt.getTagFileJarUrl());
+ return doParse(inFileName, null, ctxt.getTagFileJarLocation());
}
/**
@@ -117,7 +117,7 @@
// respectively.
isTagFile = ctxt.isTagFile();
directiveOnly = true;
- return doParse(inFileName, null, ctxt.getTagFileJarUrl());
+ return doParse(inFileName, null, ctxt.getTagFileJarLocation());
}
@@ -129,12 +129,11 @@
* @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 @@
* @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 @@
*/
private Node.Nodes doParse(String inFileName,
Node parent,
- URL jarFileUrl)
+ JarResource jarLocation)
throws FileNotFoundException, JasperException, IOException {
Node.Nodes parsedPage = null;
@@ -182,7 +180,7 @@
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 @@
compiler.getPageInfo().addDependant(absFileName);
} else {
compiler.getPageInfo().addDependant(
- jarFileUrl.toExternalForm() + absFileName.substring(1));
+ jarLocation.getEntry(absFileName.substring(1)).toExternalForm());
}
}
@@ -237,7 +235,7 @@
sourceEnc, inStreamReader,
err);
parsedPage = Parser.parse(this, jspReader, parent, isTagFile,
- directiveOnly, jarFileUrl,
+ directiveOnly, jarLocation,
sourceEnc, jspConfigPageEnc,
isDefaultPageEncoding, isBomPresent);
} finally {
@@ -606,17 +604,4 @@
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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -489,7 +489,7 @@
* @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 @@
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 @@
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 @@
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 @@
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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -23,7 +23,6 @@
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.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 @@
* 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 @@
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 @@
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 @@
} catch (Throwable t) {
}
}
- if (jarFile != null) {
- try {
- jarFile.close();
- } catch (Throwable t) {
- }
- }
}
}
@@ -217,7 +202,7 @@
* 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 @@
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 @@
* 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 @@
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 @@
*
* @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 @@
// 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=907905&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 Tue Feb 9 03:21:45 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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -96,7 +96,7 @@
* [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 TldLocationsCache(ServletContext ctxt) {
this.ctxt = ctxt;
- mappings = new Hashtable<String, String[]>();
+ mappings = new Hashtable<String, TldLocation>();
initialized = false;
}
@@ -150,7 +150,7 @@
* 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 @@
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 @@
// 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=907905&r1=907904&r2=907905&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 Tue Feb 9 03:21:45 2010
@@ -35,6 +35,7 @@
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 @@
String tagFilePath,
TagInfo tagInfo,
JspRuntimeContext rctxt,
- URL tagFileJarUrl) {
+ JarResource tagFileJarLocation) {
this.isTagFile = true;
this.config = null; // not used
@@ -114,7 +115,7 @@
this.tripCount = 0;
ctxt = new JspCompilationContext(jspUri, tagInfo, options,
servletContext, this, rctxt,
- tagFileJarUrl);
+ tagFileJarLocation);
}
public JspCompilationContext getJspEngineContext() {