Author: markt
Date: Wed Jun 27 18:50:50 2012
New Revision: 1354664
URL: http://svn.apache.org/viewvc?rev=1354664&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53467
Use more explicit URI constructor to ensure components are correctly encoded.
Added:
tomcat/trunk/test/webapp-3.0/bug53467].jsp (with props)
Modified:
tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
tomcat/trunk/test/org/apache/catalina/core/TestApplicationContext.java
Modified: tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java?rev=1354664&r1=1354663&r2=1354664&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java
(original)
+++ tomcat/trunk/java/org/apache/catalina/core/ApplicationContext.java Wed Jun
27 18:50:50 2012
@@ -518,7 +518,8 @@ public class ApplicationContext
String hostName = context.getParent().getName();
try {
resources.lookup(normPath);
- URI uri = new URI("jndi", getJNDIUri(hostName, fullPath),
null);
+ URI uri = new URI("jndi", null, "", -1,
+ getJNDIUri(hostName, fullPath), null, null);
return new URL(null, uri.toString(),
new DirContextURLStreamHandler(resources));
} catch (NamingException e) {
Modified: tomcat/trunk/test/org/apache/catalina/core/TestApplicationContext.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/core/TestApplicationContext.java?rev=1354664&r1=1354663&r2=1354664&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/core/TestApplicationContext.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/core/TestApplicationContext.java Wed
Jun 27 18:50:50 2012
@@ -18,6 +18,8 @@ package org.apache.catalina.core;
import java.io.File;
+import javax.servlet.http.HttpServletResponse;
+
import org.junit.Assert;
import org.junit.Test;
@@ -48,4 +50,23 @@ public class TestApplicationContext exte
}
}
}
+
+
+ @Test
+ public void testBug53467() throws Exception {
+ Tomcat tomcat = getTomcatInstance();
+
+ File appDir = new File("test/webapp-3.0");
+ // app dir is relative to server home
+ tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());
+
+ tomcat.start();
+
+ ByteChunk res = new ByteChunk();
+ int rc = getUrl("http://localhost:" + getPort() +
+ "/test/bug53467].jsp", res, null);
+
+ Assert.assertEquals(HttpServletResponse.SC_OK, rc);
+ Assert.assertTrue(res.toString().contains("<p>OK</p>"));
+ }
}
Added: tomcat/trunk/test/webapp-3.0/bug53467].jsp
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/bug53467%5D.jsp?rev=1354664&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0/bug53467].jsp (added)
+++ tomcat/trunk/test/webapp-3.0/bug53467].jsp Wed Jun 27 18:50:50 2012
@@ -0,0 +1,21 @@
+<%--
+ 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.
+--%>
+<head>
+ <body>
+ <p>OK</p>
+ </body>
+</head>
Propchange: tomcat/trunk/test/webapp-3.0/bug53467].jsp
------------------------------------------------------------------------------
svn:eol-style = native
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]