Skip to content

Commit

Permalink
Servlet 4.0
Browse files Browse the repository at this point in the history
Update web applications that should be using the current web.xml schema to 4.0

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1707868 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
markt-asf committed Oct 10, 2015
1 parent 560b041 commit 4f933f7
Show file tree
Hide file tree
Showing 24 changed files with 95 additions and 48 deletions.
4 changes: 2 additions & 2 deletions conf/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">

<!-- ======================== Introduction ============================== -->
<!-- This document defines default values for *all* web applications -->
Expand Down
4 changes: 2 additions & 2 deletions res/META-INF/jasper.jar/web-fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
version="4.0"
metadata-complete="true">
<name>org_apache_jasper</name>
<distributable/>
Expand Down
4 changes: 2 additions & 2 deletions res/META-INF/tomcat-websocket.jar/web-fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
version="4.0"
metadata-complete="true">
<name>org_apache_tomcat_websocket</name>
<distributable/>
Expand Down
2 changes: 1 addition & 1 deletion test/javax/servlet/resources/TestSchemaValidation.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void testWebapp() throws Exception {
digester.push(new WebXml());
WebXml desc = (WebXml) digester.parse(
new File("test/webapp/WEB-INF/web.xml"));
Assert.assertEquals("3.1", desc.getVersion());
Assert.assertEquals("4.0", desc.getVersion());
Assert.assertEquals(0, handler.getErrors().size());
Assert.assertEquals(0, handler.getWarnings().size());
}
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-1lifecyclecallback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
<post-construct>
<lifecycle-callback-class>test.TestServlet</lifecycle-callback-class>
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-1ordering.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
<absolute-ordering>
<name>bar</name>
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-2lifecyclecallback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
<post-construct>
<lifecycle-callback-class>test.TestServlet</lifecycle-callback-class>
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-2ordering.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">
<absolute-ordering>
<name>foo</name>
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-fragment-1name.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
version="4.0"
metadata-complete="true">
<name>name1</name>
</web-fragment>
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-fragment-1ordering.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
version="4.0"
metadata-complete="true">
<ordering>
<before>
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-fragment-2name.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
version="4.0"
metadata-complete="true">
<name>name1</name>
<name>name2</name>
Expand Down
4 changes: 2 additions & 2 deletions test/org/apache/catalina/startup/web-fragment-2ordering.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-fragment xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd"
version="4.0"
metadata-complete="true">
<ordering>
<after>
Expand Down
8 changes: 8 additions & 0 deletions test/org/apache/jasper/TestJspC.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ public void precompileWebapp_3_1() throws IOException {
verify(webappOut);
}

@Test
public void precompileWebapp_4_0() throws IOException {
File appDir = new File("test/webapp-4.0");
File webappOut = new File(outputDir, appDir.getName());
precompile(appDir, webappOut);
verify(webappOut);
}

private void verify(File webappOut) {
// for now, just check some expected files exist
Assert.assertTrue(new File(webappOut, "generated_web.xml").exists());
Expand Down
33 changes: 23 additions & 10 deletions test/org/apache/jasper/compiler/TestJspConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public class TestJspConfig extends TomcatBaseTest {
public void testServlet22NoEL() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir =
new File("test/webapp-2.2");
File appDir = new File("test/webapp-2.2");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

Expand Down Expand Up @@ -73,8 +72,7 @@ public void testServlet23NoEL() throws Exception {
public void testServlet24NoEL() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir =
new File("test/webapp-2.4");
File appDir = new File("test/webapp-2.4");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

Expand All @@ -93,8 +91,7 @@ public void testServlet24NoEL() throws Exception {
public void testServlet25NoEL() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir =
new File("test/webapp-2.5");
File appDir = new File("test/webapp-2.5");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

Expand All @@ -112,8 +109,7 @@ public void testServlet25NoEL() throws Exception {
public void testServlet30NoEL() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir =
new File("test/webapp-3.0");
File appDir = new File("test/webapp-3.0");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

Expand All @@ -131,8 +127,25 @@ public void testServlet30NoEL() throws Exception {
public void testServlet31NoEL() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir =
new File("test/webapp-3.1");
File appDir = new File("test/webapp-3.1");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

tomcat.start();

ByteChunk res = getUrl("http://localhost:" + getPort() +
"/test/el-as-literal.jsp");

String result = res.toString();

assertTrue(result.indexOf("<p>00-hello world</p>") > 0);
}

@Test
public void testServlet40NoEL() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir = new File("test/webapp-4.0");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

Expand Down
25 changes: 25 additions & 0 deletions test/org/apache/jasper/compiler/TestValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,31 @@ public void testTldVersions31() throws Exception {
assertTrue(result.indexOf("<p>06-hello world</p>") > 0);
}

@Test
public void testTldVersions40() throws Exception {
Tomcat tomcat = getTomcatInstance();

File appDir =
new File("test/webapp-4.0");
// app dir is relative to server home
tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());

tomcat.start();

ByteChunk res = getUrl("http://localhost:" + getPort() +
"/test/tld-versions.jsp");

String result = res.toString();

assertTrue(result.indexOf("<p>00-hello world</p>") > 0);
assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0);
assertTrue(result.indexOf("<p>02-hello world</p>") > 0);
assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0);
assertTrue(result.indexOf("<p>04-hello world</p>") > 0);
assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0);
assertTrue(result.indexOf("<p>06-hello world</p>") > 0);
}

public static class Echo extends TagSupport {

private static final long serialVersionUID = 1L;
Expand Down
4 changes: 2 additions & 2 deletions test/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">

<display-name>Tomcat Test Application</display-name>
Expand Down
4 changes: 2 additions & 2 deletions webapps/ROOT/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">

<display-name>Welcome to Tomcat</display-name>
Expand Down
4 changes: 2 additions & 2 deletions webapps/docs/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">

<display-name>Tomcat Documentation</display-name>
Expand Down
2 changes: 1 addition & 1 deletion webapps/docs/appdev/deployment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ drivers that are required for both your application or internal Tomcat use
<p>Out of the box, a standard Tomcat installation includes a variety
of pre-installed shared library files, including:</p>
<ul>
<li>The <em>Servlet 3.1</em> and <em>JSP 2.3</em> APIs that are fundamental
<li>The <em>Servlet 4.0</em> and <em>JSP 2.3</em> APIs that are fundamental
to writing servlets and JavaServer Pages.<br/><br/></li>
</ul>

Expand Down
1 change: 1 addition & 0 deletions webapps/docs/appdev/introduction.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ web applications with Tomcat.</p>
and packaging JSP pages (Appendix A) is useful. The Javadoc
API Documentation is included in the specification, and with the
Tomcat download.</p></li>
<!-- TODO Servley 4.0 -->
<li><p><a href="http://jcp.org/aboutJava/communityprocess/final/jsr340/index.html">http://jcp.org/aboutJava/communityprocess/final/jsr340/index.html</a> -
<i>Servlet API Specification, Version 3.1</i>. Describes the
programming environment that must be provided by all servlet
Expand Down
4 changes: 2 additions & 2 deletions webapps/docs/appdev/sample/web/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">

<display-name>Hello, World Application</display-name>
<description>
Expand Down
4 changes: 2 additions & 2 deletions webapps/examples/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">

<description>
Expand Down
4 changes: 2 additions & 2 deletions webapps/host-manager/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">

<display-name>Tomcat Host Manager Application</display-name>
Expand Down
4 changes: 2 additions & 2 deletions webapps/manager/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1"
http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0"
metadata-complete="true">

<display-name>Tomcat Manager Application</display-name>
Expand Down

0 comments on commit 4f933f7

Please sign in to comment.