restore jetty-ee8-demo-simple-webapp and jetty-ee8-demo-async-rest (#8299)

Signed-off-by: Olivier Lamy <oliver.lamy@gmail.com>
This commit is contained in:
Olivier Lamy 2022-07-14 12:18:23 +10:00 committed by GitHub
parent 3beaa3997f
commit 08865ed5a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 443 additions and 18 deletions

View File

@ -57,7 +57,7 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<!-- Jetty EE 9 Dependencies -->
<!-- Jetty EE 8 Dependencies -->
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-annotations</artifactId>

View File

@ -0,0 +1,33 @@
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-async-rest</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-async-rest-jar</artifactId>
<packaging>jar</packaging>
<name>EE8 :: Jetty Demo :: Async Rest :: Jar</name>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-async-rest-jar</ee9.module>
<bundle-symbolic-name>${project.parent.groupId}.async.rest</bundle-symbolic-name>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util-ajax</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,31 @@
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-async-rest</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-async-rest-server</artifactId>
<packaging>jar</packaging>
<name>EE8 :: Jetty Demo :: Async Rest :: Server</name>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-server</ee9.module>
<bundle-symbolic-name>${project.parent.groupId}.async.rest.server</bundle-symbolic-name>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-webapp</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,35 @@
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-async-rest</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-async-rest-webapp</artifactId>
<packaging>war</packaging>
<name>EE8 :: Jetty Demo :: Async Rest :: WebApp</name>
<!-- FIXME we should be able to reuse some files from the original ee9 src/main/webapp path -->
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-slf4j-impl</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-async-rest-jar</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,18 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demo Async Rest webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
[files]
basehome:modules/demo.d/ee8-demo-async-rest.properties|webapps/ee8-demo-async-rest.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-async-rest-webapp/${jetty.version}/war|webapps/ee8-demo-async-rest.war

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!--
This is the jetty specific web application configuration file. When starting
a Web Application, the WEB-INF/jetty-web.xml file is looked for and if found, treated
as a org.eclipse.jetty.server.server.xml.XmlConfiguration file and is applied to the
org.eclipse.jetty.ee8.servlet.WebApplicationContext object
-->
<Configure class="org.eclipse.jetty.ee8.webapp.WebAppContext">
<Get name="servletContext">
<Call name="log"><Arg>The ee8-demo-async-rest webapp is deployed. DO NOT USE IN PRODUCTION!</Arg><Arg></Arg></Call>
</Get>
</Configure>

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<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">
<display-name>EE8 Demo Async REST WebApp</display-name>
</web-app>

View File

@ -0,0 +1,83 @@
body
{
font-family: Arial, Verdana, Helvetica, sans-serif;
}
.topnav
{
overflow: hidden;
padding: 10px;
border: 1px solid #f6815c;
border-radius: 10px;
text-align: right;
}
.menu
{
margin-left: 3em;
}
.content
{
padding: 10px;
}
.footer
{
padding: 10px;
border-radius: 10px;
border: 1px solid #f6815c;
}
.test
{
background-color: #0099cc;
color: white;
padding: 10px 15px;
border: none;
font-size: 12pt;
border-radius: 10px;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2), 0 3px 10px 0 rgba(0,0,0,0.19);
}
.test:hover
{
background-color: #f6815c;
color: white;
}
A:link
{
color: #0099cc;
text-decoration: none;
font-weight: normal;
font-size: 11pt;
font-family:sans-serif;
}
A:visited
{
color: #0099cc;
text-decoration: none;
font-weight: normal;
font-size: 11pt;
font-family:sans-serif;
}
A:hover
{
color: #ff6600;
text-decoration: none;
font-weight: normal;
font-size: 11pt;
font-family:sans-serif;
}
A:active
{
color: #0099cc;
text-decoration: none;
font-weight: normal;
font-size: 11pt;
font-family:sans-serif;
}

View File

@ -0,0 +1,62 @@
<html>
<head>
<link rel="stylesheet" href="demo.css"/>
<style type='text/css'>
iframe {border: 0px}
table, tr, td {border: 0px}
</style>
</head>
<body>
<div class="topnav">
<a class="menu" href="http://localhost:8080/">Demo Home</a>
<a class="menu" href="https://github.com/eclipse/jetty.project/tree/jetty-11.0.x/demos/demo-async-rest">Source</a>
<a class="menu" href="https://www.eclipse.org/jetty/">Jetty Project Home</a>
<a class="menu" href="https://www.eclipse.org/jetty/documentation/current/">Documentation</a>
<a class="menu" href="https://webtide.com">Commercial Support</a>
</div>
<div class="content">
<center>
<span style="color:red; font-style:italic; font-weight:bold">Demo Web Application Only - Do NOT Deploy in Production</span>
</center>
<h1>Blocking vs Asynchronous REST</h1>
<p>
This demo calls the EBay WS API both synchronously and asynchronously, to obtain items matching each of the keywords passed on the query string. The time the request thread is held by the servlet is displayed in red for both.
</p>
<table width='100%'>
<tr>
<td>
<iframe id="f1" width='100%' height='175px' src="testSerial?items=kayak"></iframe>
</td>
<td>
<iframe id="f3" width='100%' height='175px' src="testSerial?items=mouse,beer,gnome"></iframe>
</td>
</tr>
<tr>
<td>
<iframe id="f2" width='100%' height='175px' src="testAsync?items=kayak"/></iframe>
</td>
<td>
<iframe id="f4" width='100%' height='175px' src="testAsync?items=mouse,beer,gnome"/></iframe>
</td>
</tr>
</table>
<p>
By the use of Asynchronous Servlets and the Jetty Asynchronous client, the server is able to release the thread (green) while waiting for the response from Ebay. This thread goes back into the thread pool and can service many other requests during the wait. This greatly reduces the number of threads needed, which in turn greatly reduces the memory requirements of the server.
</p>
<p>
Press your browser's reload button to see even better results after JIT and TCP/IP warmup!
</p>
<div class="footer">
<center><a href="https://www.eclipse.org/jetty"><img style="border:0" src="small_powered_by.gif"/></a></center>
</div>
</body>
</html>

View File

@ -0,0 +1,29 @@
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-async-rest</artifactId>
<packaging>pom</packaging>
<name>EE8 :: Jetty Demo :: Async Rest</name>
<modules>
<module>jetty-ee8-demo-async-rest-jar</module>
<module>jetty-ee8-demo-async-rest-webapp</module>
<module>jetty-ee8-demo-async-rest-server</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-async-rest-jar</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -0,0 +1,19 @@
<?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.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-simple-webapp</artifactId>
<name>EE8 :: Jetty Demo :: Simple :: Webapp</name>
<packaging>war</packaging>
<properties>
<bundle-symbolic-name>${project.groupId}.simple</bundle-symbolic-name>
</properties>
<!-- FIXME we should be able to reuse some files from the original ee9 src/main/webapp path -->
</project>

View File

@ -0,0 +1,16 @@
[description]
Demo EE8 Simple Webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
[files]
basehome:modules/demo.d/ee8-demo-simple.properties|webapps/ee8-demo-simple.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-simple-webapp/${jetty.version}/war|webapps/ee8-demo-simple.war

View File

@ -0,0 +1,15 @@
<?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>EE8 Demo Simple WebApp</display-name>
<!-- using a mime-type and extension that does NOT exist in jetty-http's mime.properties -->
<mime-mapping>
<extension>icon</extension>
<mime-type>image/vnd.microsoft.icon</mime-type>
</mime-mapping>
</web-app>

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,48 @@
<?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/maven-v4_0_0.xsd">
<parent>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<name>EE8 :: Jetty Demos :: Parent</name>
<packaging>pom</packaging>
<properties>
<sonar.skip>true</sonar.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<!-- otherwise javadoc jars for these demos will not be created due to top level pom exclusions on "org.example" -->
<excludePackageNames>bogus.*</excludePackageNames>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>jetty-ee8-demo-simple-webapp</module>
<module>jetty-ee8-demo-async-rest</module>
<!-- <module>jetty-ee9-demo-jaas-webapp</module>-->
<!-- <module>jetty-ee9-demo-jndi-webapp</module>-->
<!-- <module>jetty-ee9-demo-jetty-webapp</module>-->
<!-- Needs jetty-ee9-proxy -->
<!-- module>jetty-ee9-demo-proxy-webapp</module -->
<!-- module>jetty-ee9-demo-embedded</module -->
<!-- <module>jetty-ee9-demo-jsp-webapp</module>-->
<!-- <module>jetty-ee9-demo-mock-resources</module>-->
<!-- <module>jetty-ee9-demo-spec</module>-->
<!-- <module>jetty-ee9-demo-template</module>-->
</modules>
</project>

View File

@ -501,14 +501,14 @@
<!-- <type>jar</type>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-async-rest-webapp</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>config</classifier>-->
<!-- <type>jar</type>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-async-rest-webapp</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-proxy-webapp</artifactId>-->
@ -517,14 +517,14 @@
<!-- <type>jar</type>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-simple-webapp</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>config</classifier>-->
<!-- <type>jar</type>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-simple-webapp</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-jsp-webapp</artifactId>-->

View File

@ -36,6 +36,7 @@
<module>jetty-ee8-annotations</module>
<module>jetty-ee8-websocket</module>
<module>jetty-ee8-bom</module>
<module>jetty-ee8-demos</module>
<module>jetty-ee8-home</module>
</modules>

View File

@ -7,7 +7,7 @@
<version>12.0.0-SNAPSHOT</version>
</parent>
<name>EE9 :: Jetty Demo :: Servlet Spec</name>
<artifactId>jetty-e9-demo-spec</artifactId>
<artifactId>jetty-ee9-demo-spec</artifactId>
<packaging>pom</packaging>
<modules>