You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2013/12/13 12:55:33 UTC

svn commit: r1550695 - in /tomcat/trunk: java/org/apache/jasper/compiler/TagLibraryInfoImpl.java test/org/apache/jasper/compiler/TestTagLibraryInfo.java test/webapp/jsp/ test/webapp/jsp/test.jsp

Author: remm
Date: Fri Dec 13 11:55:32 2013
New Revision: 1550695

URL: http://svn.apache.org/r1550695
Log:
Add back uri normalization for cache lookup. Test submitted by Violeta Georgieva.

Added:
    tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfo.java
    tomcat/trunk/test/webapp/jsp/
    tomcat/trunk/test/webapp/jsp/test.jsp
Modified:
    tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java

Modified: tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java?rev=1550695&r1=1550694&r2=1550695&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java (original)
+++ tomcat/trunk/java/org/apache/jasper/compiler/TagLibraryInfoImpl.java Fri Dec 13 11:55:32 2013
@@ -46,6 +46,7 @@ import org.apache.tomcat.util.descriptor
 import org.apache.tomcat.util.descriptor.tld.TaglibXml;
 import org.apache.tomcat.util.descriptor.tld.TldResourcePath;
 import org.apache.tomcat.util.descriptor.tld.ValidatorXml;
+import org.apache.tomcat.util.http.RequestUtil;
 import org.apache.tomcat.util.scan.Jar;
 
 /**
@@ -214,6 +215,9 @@ class TagLibraryInfoImpl extends TagLibr
         } else if (uri.charAt(0) != '/') {
             // noroot_rel_uri, resolve against the current JSP page
             uri = ctxt.resolveRelativeUri(uri);
+            if (uri != null) {
+                uri = RequestUtil.normalize(uri);
+            }
         }
 
         URL url = null;

Added: tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfo.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfo.java?rev=1550695&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfo.java (added)
+++ tomcat/trunk/test/org/apache/jasper/compiler/TestTagLibraryInfo.java Fri Dec 13 11:55:32 2013
@@ -0,0 +1,51 @@
+/*
+ * 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.File;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.tomcat.util.buf.ByteChunk;
+
+/**
+ * Test case for {@link TagLibraryInfo}.
+ */
+public class TestTagLibraryInfo extends TomcatBaseTest {
+
+    @Test
+    public void testRelativeTldLocation() throws Exception {
+        Tomcat tomcat = getTomcatInstance();
+
+        File appDir = new File("test/webapp");
+        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
+
+        tomcat.start();
+
+        ByteChunk res = new ByteChunk();
+
+        int rc = getUrl("http://localhost:" + getPort() +
+                "/test/jsp/test.jsp", res, null);
+        Assert.assertEquals(HttpServletResponse.SC_OK, rc);
+    }
+
+}

Added: tomcat/trunk/test/webapp/jsp/test.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp/jsp/test.jsp?rev=1550695&view=auto
==============================================================================
--- tomcat/trunk/test/webapp/jsp/test.jsp (added)
+++ tomcat/trunk/test/webapp/jsp/test.jsp Fri Dec 13 11:55:32 2013
@@ -0,0 +1,2 @@
++<%@ page contentType="text/plain" %>
++<%@ taglib uri="../WEB-INF/test.tld" prefix="test" %>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org