Fixes #5880 - Move test-simple-webapp to demos. (#5881)

* Fixes #5880 - Move test-simple-webapp to demos.

Moved test-simple-webapp to demos under demo-simple-webapp.
Moved the JSP demos into their own module: out of demo-jetty-webapp into demo-jsp-webapp.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2021-01-21 15:27:03 +01:00 committed by GitHub
parent f2cde85390
commit 9fe5700260
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
48 changed files with 359 additions and 179 deletions

View File

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>acme</short-name>
<uri>http://www.acme.com/taglib</uri>
<description>taglib example</description>
<listener>
<listener-class>com.acme.TagListener</listener-class>
</listener>
<tag>
<name>date</name>
<tag-class>com.acme.DateTag</tag-class>
<body-content>TAGDEPENDENT</body-content>
<description>Display Date</description>
<attribute>
<name>tz</name>
<required>false</required>
</attribute>
</tag>
</taglib>

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<taglib 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 web-jsptaglibrary_2_0.xsd"
version="2.0">
<description>Acme JSP2 tags</description>
<tlib-version>1.0</tlib-version>
<short-name>acme2</short-name>
<uri>http://www.acme.com/taglib2</uri>
<tag>
<description>Simple Date formatting</description>
<name>date2</name>
<tag-class>com.acme.Date2Tag</tag-class>
<body-content>scriptless</body-content>
<variable>
<description>Day of the Month</description>
<name-given>day</name-given>
</variable>
<variable>
<description>Month of the Year</description>
<name-given>month</name-given>
</variable>
<variable>
<description>Year</description>
<name-given>year</name-given>
</variable>
<attribute>
<name>format</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

View File

@ -180,15 +180,6 @@
<url-pattern>/secureMode/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>foo.jsp</servlet-name>
<jsp-file>/jsp/foo/foo.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>foo.jsp</servlet-name>
<url-pattern>/jsp/foo/</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>TestServlet</servlet-name>

View File

@ -41,8 +41,6 @@
<li><a href="javax.websocket">WebSocket (javax.websocket)</a></li>
</ul>
</li>
<li>JSP: <a href="jsp/">examples</a></li>
</ul></td><td><ul>
<li><a href="auth.html">Authentication</a></li>
<li><a href="dispatch">Dispatcher Servlet</a></li>

View File

@ -1,20 +0,0 @@
<html>
<body>
<h1>JSP Examples</h1>
<ul>
<li><a href="dump.jsp">JSP 1.2 embedded java</a><br/>
<li><a href="bean1.jsp">JSP 1.2 Bean demo</a><br/>
<li><a href="tag.jsp">JSP 1.2 BodyTag demo</a><br/>
<li><a href="tag2.jsp">JSP 2.0 SimpleTag demo</a><br/>
<li><a href="tagfile.jsp">JSP 2.0 Tag File demo</a><br/>
<li><a href="expr.jsp?A=1">JSP 2.0 Tag Expression</a><br/>
<li><a href="jstl.jsp">JSTL Expression</a><br/>
<li><a href="foo/">Mapping to &lt;jsp-file&gt;</a><br/>
</ul>
<a href="/">Main Menu</a>
</body>
</html>

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>10.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>demo-jsp-webapp</artifactId>
<name>Demo :: JSP :: Webapp</name>
<packaging>war</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.jsp</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Import-Package>javax.servlet.jsp.*;version="[2.2.0,4.1)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package>
<Export-Package>!com.acme.*</Export-Package>
<Web-ContextPath>/demo-jsp</Web-ContextPath>
<Bundle-ClassPath>.,WEB-INF/classes</Bundle-ClassPath>
</instructions>
</configuration>
</plugin>
<!-- also make this webapp an osgi bundle -->
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>web-bundle-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/assembly/web-bundle.xml</descriptor>
</descriptors>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>2.3.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>1.2.7</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<assembly>
<id>webbundle</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
<fileSet>
<directory>${basedir}/${project.build.directory}/${project.build.finalName}/</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>WEB-INF/lib/**</exclude>
</excludes>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,13 @@
[description]
Demo Simple JSP Webapp
[tags]
demo
webapp
[depends]
jsp
deploy
[files]
maven://org.eclipse.jetty.demos/demo-jsp-webapp/${jetty.version}/war|webapps/demo-jsp.war

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>
<taglib 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-jsptaglibrary_2_0.xsd"
version="2.0">
<description>taglib example</description>
<tlib-version>1.0</tlib-version>
<short-name>acme</short-name>
<uri>http://www.acme.com/taglib</uri>
<listener>
<listener-class>com.acme.TagListener</listener-class>
</listener>
<tag>
<description>Display Date</description>
<name>date</name>
<tag-class>com.acme.DateTag</tag-class>
<body-content>tagdependent</body-content>
<attribute>
<name>tz</name>
<required>false</required>
</attribute>
</tag>
</taglib>

View File

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<taglib 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-jsptaglibrary_2_0.xsd"
version="2.0">
<description>Acme JSP2 tags</description>
<tlib-version>1.0</tlib-version>
<short-name>acme2</short-name>
<uri>http://www.acme.com/taglib2</uri>
<tag>
<description>Simple Date formatting</description>
<name>date2</name>
<tag-class>com.acme.Date2Tag</tag-class>
<body-content>scriptless</body-content>
<variable>
<description>Day of the Month</description>
<name-given>day</name-given>
</variable>
<variable>
<description>Month of the Year</description>
<name-given>month</name-given>
</variable>
<variable>
<description>Year</description>
<name-given>year</name-given>
</variable>
<attribute>
<name>format</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
<Get name="servletContext">
<Call name="log"><Arg>The demo-jsp webapp is deployed. DO NOT USE IN PRODUCTION!</Arg><Arg></Arg></Call>
</Get>
</Configure>

View File

@ -1,6 +1,6 @@
<%--
- Copyright (c) 2002 The Apache Software Foundation. All rights
- reserved.
Copyright (c) 2002 The Apache Software Foundation.
All rights reserved.
--%>
<%@ attribute name="color" %>
<%@ attribute name="bgcolor" %>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-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_4_0.xsd"
version="4.0">
<display-name>Demo JSP Web Application</display-name>
<servlet>
<servlet-name>foo.jsp</servlet-name>
<jsp-file>/foo/foo.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>foo.jsp</servlet-name>
<url-pattern>/foo/</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -4,6 +4,7 @@
<h1>JSP Dump</h1>
<table border="1">
<tr><th>Protocol:</th><td><%= request.getProtocol() %></td></tr>
<tr><th>Request URI:</th><td><%= request.getRequestURI() %></td></tr>
<tr><th>ServletPath:</th><td><%= request.getServletPath() %></td></tr>
<tr><th>PathInfo:</th><td><%= request.getPathInfo() %></td></tr>

View File

@ -0,0 +1,20 @@
<%@ page import="java.time.format.DateTimeFormatter" %>
<%@ page import="java.time.LocalDate" %>
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE html>
<html>
<body>
<h2>JSP Examples on <%= DateTimeFormatter.ofPattern("d MMMM yyyy").format(LocalDate.now()) %></h2>
<ul>
<li><a href="dump.jsp">JSP with Embedded Java</a><br/>
<li><a href="bean1.jsp">JSP with Beans</a><br/>
<li><a href="tag.jsp">JSP with BodyTag</a><br/>
<li><a href="tag2.jsp">JSP with SimpleTag</a><br/>
<li><a href="tagfile.jsp">JSP with Tag File</a><br/>
<li><a href="expr.jsp?A=1">JSP with Tag Expression</a><br/>
<li><a href="jstl.jsp">JSTL Expression</a><br/>
<li><a href="foo/">Mapping to &lt;jsp-file&gt;</a><br/>
</ul>
<a href="/">Main Menu</a>
</body>
</html>

View File

@ -1,15 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-webapps-parent</artifactId>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demos-parent</artifactId>
<version>10.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test-simple-webapp</artifactId>
<artifactId>demo-simple-webapp</artifactId>
<name>Demo :: Simple :: Webapp</name>
<packaging>war</packaging>
<name>Test :: Jetty Test Simple Webapp</name>
<properties>
<bundle-symbolic-name>${project.groupId}.simple</bundle-symbolic-name>
</properties>
</project>

View File

@ -0,0 +1,12 @@
[description]
Demo Simple Webapp
[tags]
demo
webapp
[depends]
deploy
[files]
maven://org.eclipse.jetty.demos/demo-simple-webapp/${jetty.version}/war|webapps/demo-simple.war

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-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_4_0.xsd"
version="4.0">
<display-name>Simple Web Application</display-name>
</web-app>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>

View File

@ -46,7 +46,7 @@ public class OneWebAppWithJsp
// the webapp will unpack itself.
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
Path warFile = JettyDemoBase.resolve("webapps/demo-jetty.war");
Path warFile = JettyDemoBase.resolve("webapps/demo-jsp.war");
if (!Files.exists(warFile))
{
throw new FileNotFoundException(warFile.toString());

View File

@ -55,7 +55,7 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest
@Test
public void testGetDumpInfo() throws Exception
{
URI uri = serverLocalUri.resolve("/dump/info");
URI uri = serverLocalUri.resolve("/dump.jsp");
ContentResponse response = client.newRequest(uri)
.method(HttpMethod.GET)
.send();
@ -65,13 +65,13 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest
// test response content
String responseBody = response.getContentAsString();
assertThat("Response Content", responseBody, containsString("getProtocol:&nbsp;</th><td>HTTP/1.1"));
assertThat("Response Content", responseBody, containsString("Protocol:</th><td>HTTP/1.1"));
}
@Test
public void testGetJspExpr() throws Exception
{
URI uri = serverLocalUri.resolve("/jsp/expr.jsp?A=1");
URI uri = serverLocalUri.resolve("/expr.jsp?A=1");
ContentResponse response = client.newRequest(uri)
.method(HttpMethod.GET)
.send();
@ -88,7 +88,7 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest
@Test
public void testGetJstlExpr() throws Exception
{
URI uri = serverLocalUri.resolve("/jsp/jstl.jsp");
URI uri = serverLocalUri.resolve("/jstl.jsp");
ContentResponse response = client.newRequest(uri)
.method(HttpMethod.GET)
.send();
@ -101,7 +101,7 @@ public class OneWebAppWithJspTest extends AbstractEmbeddedTest
assertThat("Response Content", responseBody, containsString("<h1>JSTL Example</h1>"));
for (int i = 1; i <= 10; i++)
{
assertThat("Reponse content (counting)", responseBody, containsString("" + i));
assertThat("Response content (counting)", responseBody, containsString("" + i));
}
}
}

View File

@ -35,6 +35,8 @@
<module>demo-jndi-webapp</module>
<module>demo-jetty-webapp</module>
<module>demo-proxy-webapp</module>
<module>demo-simple-webapp</module>
<module>demo-jsp-webapp</module>
<module>demo-mock-resources</module>
<module>demo-spec</module>
<module>embedded</module>

View File

@ -839,6 +839,22 @@
<type>jar</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-jsp-webapp</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -31,13 +31,14 @@
<table>
<tr>
<td>
<h2>tests ...</h2>
<h2>demos ...</h2>
<ul>
<li><a href="/test/">Test Jetty Webapp</a></li>
<li><a href="/test/">Demo Jetty Webapp</a></li>
<li><a href="/test-spec/">Servlet 4.0 Test</a></li>
<li><a href="/test-jaas/">JAAS Test</a></li>
<li><a href="/test-jndi/">JNDI Test</a></li>
<li><a href="/demo-async-rest/">Async Rest</a></li>
<li><a href="/demo-jsp/">JSP Demos</a></li>
<li><a href="/test-jaas/">JAAS Demo</a></li>
<li><a href="/test-jndi/">JNDI Demo</a></li>
<li><a href="/demo-async-rest/">Async Rest Demo</a></li>
<li><a href="/oldContextPath/">Redirected Context</a></li>
</ul>
</td>

View File

@ -21,8 +21,9 @@ demo-rewrite
demo-root
demo-jndi
demo-spec
demo-jsp
[ini-template]
# Websocket chat examples needs websocket enabled
# Don't start for all contexts (set to true in test.xml context)
org.eclipse.jetty.websocket.jsr356=false
org.eclipse.jetty.websocket.jsr356=false

View File

@ -391,6 +391,13 @@
</dependency>
<!-- Eclipse OSGi Deps -->
<dependency>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-jsp-webapp</artifactId>
<version>${project.version}</version>
<classifier>webbundle</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-jetty-webapp</artifactId>

View File

@ -73,7 +73,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt
options.addAll(TestOSGiUtil.coreJettyDependencies());
options.addAll(TestOSGiUtil.jspDependencies());
//deploy a test webapp
options.add(mavenBundle().groupId("org.eclipse.jetty.demos").artifactId("demo-jetty-webapp").classifier("webbundle").versionAsInProject());
options.add(mavenBundle().groupId("org.eclipse.jetty.demos").artifactId("demo-jsp-webapp").classifier("webbundle").versionAsInProject());
options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-conscrypt-client").versionAsInProject().start());
options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-client").versionAsInProject().start());
options.add(mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-client").versionAsInProject().start());
@ -150,7 +150,7 @@ public class TestJettyOSGiBootHTTP2Conscrypt
httpClient.start();
ContentResponse response = httpClient.GET("https://localhost:" + port + "/jsp/jstl.jsp");
ContentResponse response = httpClient.GET("https://localhost:" + port + "/demo-jsp/jstl.jsp");
assertEquals(200, response.getStatus());
assertTrue(response.getContentAsString().contains("JSTL Example"));
}

View File

@ -70,7 +70,7 @@ public class TestJettyOSGiBootHTTP2JDK9
options.addAll(TestOSGiUtil.coreJettyDependencies());
options.addAll(TestOSGiUtil.jspDependencies());
//deploy a test webapp
options.add(mavenBundle().groupId("org.eclipse.jetty.demos").artifactId("demo-jetty-webapp").classifier("webbundle").versionAsInProject());
options.add(mavenBundle().groupId("org.eclipse.jetty.demos").artifactId("demo-jsp-webapp").classifier("webbundle").versionAsInProject());
options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-java-client").versionAsInProject().start());
options.add(mavenBundle().groupId("org.eclipse.jetty").artifactId("jetty-alpn-client").versionAsInProject().start());
options.add(mavenBundle().groupId("org.eclipse.jetty.http2").artifactId("http2-client").versionAsInProject().start());
@ -132,7 +132,7 @@ public class TestJettyOSGiBootHTTP2JDK9
httpClient.setExecutor(executor);
httpClient.start();
ContentResponse response = httpClient.GET("https://localhost:" + port + "/jsp/jstl.jsp");
ContentResponse response = httpClient.GET("https://localhost:" + port + "/demo-jsp/jstl.jsp");
assertEquals(200, response.getStatus());
assertTrue(response.getContentAsString().contains("JSTL Example"));
}

View File

@ -69,7 +69,7 @@ public class TestJettyOSGiBootWithJsp
{
List<Option> res = new ArrayList<>(TestOSGiUtil.jspDependencies());
//test webapp bundle
res.add(mavenBundle().groupId("org.eclipse.jetty.demos").artifactId("demo-jetty-webapp").classifier("webbundle").versionAsInProject());
res.add(mavenBundle().groupId("org.eclipse.jetty.demos").artifactId("demo-jsp-webapp").classifier("webbundle").versionAsInProject());
return res;
}
@ -86,7 +86,7 @@ public class TestJettyOSGiBootWithJsp
String port = System.getProperty("boot.jsp.port");
assertNotNull(port);
ContentResponse response = client.GET("http://127.0.0.1:" + port + "/jsp/jstl.jsp");
ContentResponse response = client.GET("http://127.0.0.1:" + port + "/demo-jsp/jstl.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
String content = response.getContentAsString();

View File

@ -88,8 +88,8 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.tests</groupId>
<artifactId>test-simple-webapp</artifactId>
<groupId>org.eclipse.jetty.demos</groupId>
<artifactId>demo-simple-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
<scope>test</scope>

View File

@ -83,7 +83,7 @@ import org.slf4j.LoggerFactory;
* assertEquals(0, run1.getExitValue());
*
* // Install a web application.
* File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
* File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-simple-webapp:war:" + jettyVersion);
* distribution.installWarFile(war, "test");
*
* // The second run starts the distribution.
@ -96,7 +96,7 @@ import org.slf4j.LoggerFactory;
* // Make an HTTP request to the web application.
* HttpClient client = new HttpClient();
* client.start();
* ContentResponse response = client.GET("http://localhost:" + port + "/test/index.jsp");
* ContentResponse response = client.GET("http://localhost:" + port + "/test/index.html");
* assertEquals(HttpStatus.OK_200, response.getStatus());
* }
* }

View File

@ -69,7 +69,7 @@ public class DemoModulesTests extends AbstractJettyHomeTest
assertTrue(runStart.awaitConsoleLogsFor("Started Server@", 20, TimeUnit.SECONDS));
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + httpPort + "/test/jsp/dump.jsp");
ContentResponse response = client.GET("http://localhost:" + httpPort + "/demo-jsp/dump.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus(), new ResponseDetails(response));
assertThat(response.getContentAsString(), containsString("PathInfo"));
assertThat(response.getContentAsString(), not(containsString("<%")));

View File

@ -74,7 +74,7 @@ public class DistributionTests extends AbstractJettyHomeTest
try (JettyHomeTester.Run run1 = distribution.start("--add-modules=http"))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
int port = distribution.freePort();
@ -87,7 +87,7 @@ public class DistributionTests extends AbstractJettyHomeTest
assertEquals(HttpStatus.NOT_FOUND_404, response.getStatus());
run2.stop();
assertTrue(run2.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run2.awaitFor(10, TimeUnit.SECONDS));
}
}
}
@ -108,10 +108,10 @@ public class DistributionTests extends AbstractJettyHomeTest
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-jsp-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
try (JettyHomeTester.Run run2 = distribution.start("jetty.quickstart.mode=GENERATE"))
@ -134,7 +134,7 @@ public class DistributionTests extends AbstractJettyHomeTest
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + port + "/test/index.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Hello"));
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
@ -159,13 +159,13 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
// Verify that --create-start-ini works
assertTrue(Files.exists(jettyBase.resolve("start.ini")));
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-jsp-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
int port = distribution.freePort();
@ -176,7 +176,7 @@ public class DistributionTests extends AbstractJettyHomeTest
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + port + "/test/index.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Hello"));
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
@ -198,10 +198,10 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-jsp-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
int port = distribution.freePort();
@ -216,7 +216,7 @@ public class DistributionTests extends AbstractJettyHomeTest
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + port + "/test/index.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Hello"));
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
@ -249,10 +249,10 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-jsp-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
int port = distribution.freePort();
@ -267,7 +267,7 @@ public class DistributionTests extends AbstractJettyHomeTest
startHttpClient(() -> new HttpClient(new HttpClientTransportOverHTTP2(h2Client)));
ContentResponse response = client.GET((ssl ? "https" : "http") + "://localhost:" + port + "/test/index.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Hello"));
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
@ -308,7 +308,7 @@ public class DistributionTests extends AbstractJettyHomeTest
assertTrue(run1.awaitFor(30, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-jsp-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
try (JettyHomeTester.Run run2 = distribution.start("jetty.unixsocket.path=" + sockFile.toString()))
@ -318,7 +318,7 @@ public class DistributionTests extends AbstractJettyHomeTest
startHttpClient(() -> new HttpClient(new HttpClientTransportOverUnixSockets(sockFile.toString())));
ContentResponse response = client.GET("http://localhost/test/index.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Hello"));
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), not(containsString("<%")));
}
}
@ -345,11 +345,11 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
assertTrue(Files.exists(jettyBase.resolve("resources/log4j2.xml")));
File war = distribution.resolveArtifact("org.eclipse.jetty.tests:test-simple-webapp:war:" + jettyVersion);
File war = distribution.resolveArtifact("org.eclipse.jetty.demos:demo-jsp-webapp:war:" + jettyVersion);
distribution.installWarFile(war, "test");
int port = distribution.freePort();
@ -360,7 +360,7 @@ public class DistributionTests extends AbstractJettyHomeTest
startHttpClient();
ContentResponse response = client.GET("http://localhost:" + port + "/test/index.jsp");
assertEquals(HttpStatus.OK_200, response.getStatus());
assertThat(response.getContentAsString(), containsString("Hello"));
assertThat(response.getContentAsString(), containsString("JSP Examples"));
assertThat(response.getContentAsString(), not(containsString("<%")));
assertTrue(Files.exists(jettyBase.resolve("resources/log4j2.xml")));
}
@ -391,7 +391,7 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File webApp = distribution.resolveArtifact("org.eclipse.jetty.tests:test-websocket-client-provided-webapp:war:" + jettyVersion);
@ -440,7 +440,7 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File webApp = distribution.resolveArtifact("org.eclipse.jetty.tests:test-websocket-client-webapp:war:" + jettyVersion);
@ -487,7 +487,7 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run = distribution.start(args1))
{
assertTrue(run.awaitConsoleLogsFor("Base directory was modified", 15, TimeUnit.SECONDS));
assertTrue(run.awaitConsoleLogsFor("Base directory was modified", 110, TimeUnit.SECONDS));
Path target = jettyBase.resolve(outPath);
assertTrue(Files.exists(target), "could not create " + target);
}
@ -507,7 +507,7 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
Path logFile = distribution.getJettyBase().resolve("resources").resolve("jetty-logging.properties");
@ -532,7 +532,7 @@ public class DistributionTests extends AbstractJettyHomeTest
}
/**
* This reproduces some classloading issue with MethodHandles in JDK14-15, this has been fixed in JDK16.
* This reproduces some classloading issue with MethodHandles in JDK14-110, This has been fixed in JDK16.
* @throws Exception if there is an error during the test.
* @see <a href="https://bugs.openjdk.java.net/browse/JDK-8244090">JDK-8244090</a>
*/
@ -552,7 +552,7 @@ public class DistributionTests extends AbstractJettyHomeTest
};
try (JettyHomeTester.Run run1 = distribution.start(args1))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
File webApp = distribution.resolveArtifact("org.eclipse.jetty.tests:test-websocket-webapp:war:" + jettyVersion);
@ -578,20 +578,20 @@ public class DistributionTests extends AbstractJettyHomeTest
// Verify /test1 is able to establish a WebSocket connection.
WsListener webSocketListener = new WsListener();
Session session = wsClient.connect(webSocketListener, serverUri.resolve("/test1")).get(5, TimeUnit.SECONDS);
Session session = wsClient.connect(webSocketListener, serverUri.resolve("/test1")).get(10, TimeUnit.SECONDS);
session.getRemote().sendString("echo message");
assertThat(webSocketListener.textMessages.poll(5, TimeUnit.SECONDS), is("echo message"));
assertThat(webSocketListener.textMessages.poll(10, TimeUnit.SECONDS), is("echo message"));
session.close();
assertTrue(webSocketListener.closeLatch.await(5, TimeUnit.SECONDS));
assertTrue(webSocketListener.closeLatch.await(10, TimeUnit.SECONDS));
assertThat(webSocketListener.closeCode, is(StatusCode.NORMAL));
// Verify /test2 is able to establish a WebSocket connection.
webSocketListener = new WsListener();
session = wsClient.connect(webSocketListener, serverUri.resolve("/test2")).get(5, TimeUnit.SECONDS);
session = wsClient.connect(webSocketListener, serverUri.resolve("/test2")).get(10, TimeUnit.SECONDS);
session.getRemote().sendString("echo message");
assertThat(webSocketListener.textMessages.poll(5, TimeUnit.SECONDS), is("echo message"));
assertThat(webSocketListener.textMessages.poll(10, TimeUnit.SECONDS), is("echo message"));
session.close();
assertTrue(webSocketListener.closeLatch.await(5, TimeUnit.SECONDS));
assertTrue(webSocketListener.closeLatch.await(10, TimeUnit.SECONDS));
assertThat(webSocketListener.closeCode, is(StatusCode.NORMAL));
}
}
@ -623,10 +623,10 @@ public class DistributionTests extends AbstractJettyHomeTest
Path jettyBase = newTestJettyBaseDirectory();
String jettyVersion = System.getProperty("jettyVersion");
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance() //
.jettyVersion(jettyVersion) //
.jettyBase(jettyBase) //
.mavenLocalRepository(System.getProperty("mavenRepoPath")) //
JettyHomeTester distribution = JettyHomeTester.Builder.newInstance()
.jettyVersion(jettyVersion)
.jettyBase(jettyBase)
.mavenLocalRepository(System.getProperty("mavenRepoPath"))
.build();
String[] args = {
@ -636,18 +636,18 @@ public class DistributionTests extends AbstractJettyHomeTest
try (JettyHomeTester.Run run1 = distribution.start(args))
{
assertTrue(run1.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run1.awaitFor(10, TimeUnit.SECONDS));
assertEquals(0, run1.getExitValue());
Files.copy(Paths.get("src/test/resources/log4j2.xml"), //
Paths.get(jettyBase.toString(), "resources").resolve("log4j2.xml"), //
Files.copy(Paths.get("src/test/resources/log4j2.xml"),
Paths.get(jettyBase.toString(), "resources").resolve("log4j2.xml"),
StandardCopyOption.REPLACE_EXISTING);
int port = distribution.freePort();
try (JettyHomeTester.Run run2 = distribution.start("jetty.http.port=" + port))
{
assertTrue(run2.awaitLogsFileFor(
jettyBase.resolve("logs").resolve("jetty.log"), //
jettyBase.resolve("logs").resolve("jetty.log"),
"Started Server@", 10, TimeUnit.SECONDS));
startHttpClient();
@ -655,7 +655,7 @@ public class DistributionTests extends AbstractJettyHomeTest
assertEquals(HttpStatus.NOT_FOUND_404, response.getStatus());
run2.stop();
assertTrue(run2.awaitFor(5, TimeUnit.SECONDS));
assertTrue(run2.awaitFor(10, TimeUnit.SECONDS));
}
}
}

View File

@ -32,7 +32,6 @@
<modules>
<module>test-webapp-rfc2616</module>
<module>test-http2-webapp</module>
<module>test-simple-webapp</module>
<module>test-felix-webapp</module>
<module>test-cdi-common-webapp</module>
<module>test-weld-cdi-webapp</module>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-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"
metadata-complete="false"
version="3.1">
<display-name>Very Simple Web Application</display-name>
</web-app>

View File

@ -1,5 +0,0 @@
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>