Author: kkolinko
Date: Sun Jan 9 08:10:33 2011
New Revision: 1056890
URL: http://svn.apache.org/viewvc?rev=1056890&view=rev
Log:
Enable testcase for 50413#c6, now that the issue is fixed with r1056889.
Update changelog.
Modified:
tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
tomcat/trunk/webapps/docs/changelog.xml
Modified: tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java?rev=1056890&r1=1056889&r2=1056890&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java
(original)
+++ tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java Sun
Jan 9 08:10:33 2011
@@ -220,8 +220,47 @@ public class TestDefaultServlet extends
client.connect();
client.processRequest();
assertTrue(client.isResponse404());
- // FIXME: The following currently fails
- // assertEquals("It is 404.html", client.getResponseBody());
+ assertEquals("It is 404.html", client.getResponseBody());
+ }
+
+ /**
+ * Test what happens if a custom 404 page is configured,
+ * but its file is actually missing.
+ */
+ public void testCustomErrorPageMissing() throws Exception {
+ File appDir = new File(getTemporaryDirectory(), "MyApp");
+ new File(appDir, "WEB-INF").mkdirs();
+ Writer w = new OutputStreamWriter(new FileOutputStream(new File(appDir,
+ "WEB-INF/web.xml")), "UTF-8");
+ try {
+ w.write("<?xml version='1.0' encoding='UTF-8'?>\n"
+ + "<web-app xmlns='http://java.sun.com/xml/ns/j2ee' "
+ + " xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"
+ + " xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee "
+ + " http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd'"
+ + " version='2.4'>\n"
+ + "<error-page>\n<error-code>404</error-code>\n"
+ + "<location>/404-absent.html</location>\n</error-page>\n"
+ + "</web-app>\n");
+ w.flush();
+ } finally {
+ w.close();
+ }
+
+ Tomcat tomcat = getTomcatInstance();
+ String contextPath = "/MyApp";
+ tomcat.addWebapp(null, contextPath, appDir.getAbsolutePath());
+ tomcat.start();
+
+ TestCustomErrorClient client = new TestCustomErrorClient();
+ client.setPort(getPort());
+
+ client.reset();
+ client.setRequest(new String[] { "GET /MyApp/missing HTTP/1.0" + CRLF
+ + CRLF });
+ client.connect();
+ client.processRequest();
+ assertTrue(client.isResponse404());
}
public static int getUrl(String path, ByteChunk out,
Modified: tomcat/trunk/webapps/docs/changelog.xml
URL:
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1056890&r1=1056889&r2=1056890&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Sun Jan 9 08:10:33 2011
@@ -165,7 +165,7 @@
</fix>
<fix>
<bug>50413</bug>: Ensure 304 responses are not returned when using
- static files as error pages. (markt)
+ static files as error pages. (markt/kkolinko)
</fix>
<fix>
<bug>50448</bug>: Fix possible <code>IllegalStateException</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]