Merged branch 'jetty-12.0.x' into 'jetty-12.0.x-module-renaming'.

Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
Simone Bordet 2022-08-12 17:31:01 +02:00
commit 6f0f8854de
No known key found for this signature in database
GPG Key ID: 1677D141BCF3584D
138 changed files with 3079 additions and 1292 deletions

2
Jenkinsfile vendored
View File

@ -177,7 +177,7 @@ def mavenBuild(jdk, cmdline, mvnName) {
"MAVEN_OPTS=-Xms2g -Xmx4g -Djava.awt.headless=true"]) {
configFileProvider(
[configFile(fileId: 'oss-settings.xml', variable: 'GLOBAL_MVN_SETTINGS')]) {
sh "mvn --no-transfer-progress -s $GLOBAL_MVN_SETTINGS -Dmaven.repo.local=.repository -Pci -DexcludedGroups=\"external, large-disk-resource, stress, slow\" -V -B -e -Djetty.testtracker.log=true $cmdline"
sh "mvn -Dmaven.test.failure.ignore=true --no-transfer-progress -s $GLOBAL_MVN_SETTINGS -Dmaven.repo.local=.repository -Pci -DexcludedGroups=\"external, large-disk-resource, stress, slow\" -V -B -e -Djetty.testtracker.log=true $cmdline"
}
}
}

View File

@ -541,7 +541,29 @@ public class StartArgs
{
Map<Boolean, List<Path>> dirsAndFiles = StreamSupport.stream(coreEnvironment.getClasspath().spliterator(), false)
.collect(Collectors.groupingBy(Files::isDirectory));
List<Path> files = dirsAndFiles.get(false);
Set<Path> files = new HashSet<>(dirsAndFiles.get(false));
// FIXMW I'm not sure it's a good idea especially with multiple environment..
// ee9 may use jakarta.annotation 2.0.0
// but ee10 use jakarta.annotation 2.1.0
// and both having different module-info.
getEnvironments().stream().filter(environment -> !environment.getName().equals(coreEnvironment.getName()))
.forEach(environment ->
{
Map<Boolean, List<Path>> dirsAndFilesModules = StreamSupport.stream(environment.getClasspath().spliterator(), false)
.collect(Collectors.groupingBy(Files::isDirectory));
dirsAndFiles.putAll(dirsAndFilesModules);
if (dirsAndFilesModules.containsKey(false))
{
files.addAll(dirsAndFilesModules.get(false));
}
else
{
System.out.println("null dirsAndFilesModules");
}
});
if (files != null && !files.isEmpty())
{
cmd.addRawArg("--module-path");

View File

@ -84,6 +84,10 @@
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http-tools</artifactId>

View File

@ -117,6 +117,18 @@
<artifactId>jetty-ee10-websocket-jetty-client</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10.demos</groupId>
<artifactId>jetty-ee10-demo-jsp-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee10.demos</groupId>
<artifactId>jetty-ee10-demo-spec-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -65,6 +65,7 @@ public class FastFileServerTest extends AbstractEmbeddedTest
server.stop();
}
// FIXME
@Disabled
@Test
public void testGetSimpleText() throws Exception

View File

@ -44,6 +44,16 @@
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
</dependency>
<dependency>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>

View File

@ -107,23 +107,6 @@
<outputDirectory>${assembly-directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-transaction-api-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>${jakarta.transaction.api.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-servlet-api-src-deps</id>
<phase>generate-resources</phase>
@ -142,6 +125,43 @@
<outputDirectory>${source-assembly-directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-transaction-api-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>${jakarta.transaction-api.version}</version>
</artifactItem>
<artifactItem>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
<version>${jakarta.interceptor.api.version}</version>
</artifactItem>
<artifactItem>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>${jakarta.enterprise.cdi.api.version}</version>
</artifactItem>
<artifactItem>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>${jakarta.inject.api.version}</version>
</artifactItem>
<artifactItem>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.lang-model</artifactId>
<version>${jakarta.enterprise.lang.model.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${assembly-directory}/lib</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-lib-transaction-api-src-deps</id>
<phase>generate-resources</phase>
@ -153,7 +173,7 @@
<artifactItem>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<version>${jakarta.transaction.api.version}</version>
<version>${jakarta.transaction-api.version}</version>
<classifier>sources</classifier>
</artifactItem>
</artifactItems>
@ -224,8 +244,8 @@
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>
<includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web,jakarta.el,jakarta.servlet.jsp,jakarta.el</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl,jakarta.el-api,jakarta.servlet.jsp-api,jakarta.el-api</includeArtifactIds>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>
<outputDirectory>${source-assembly-directory}/lib/ee10-glassfish-jstl</outputDirectory>
@ -239,8 +259,8 @@
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>
<includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web,jakarta.el,jakarta.servlet.jsp,jakarta.el</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl,jakarta.el-api,jakarta.servlet.jsp-api,jakarta.el-api</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/ee10-glassfish-jstl</outputDirectory>
</configuration>

View File

@ -46,6 +46,16 @@
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.lang-model</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.interceptor</groupId>
<artifactId>jakarta.interceptor-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jndi</artifactId>

View File

@ -12,4 +12,8 @@ ee10-webapp
[lib]
lib/jetty-ee10-plus-${jetty.version}.jar
lib/jakarta.transaction-api-2.0.1.jar
lib/jakarta.transaction-api-@jakarta.transaction-api.version@.jar
lib/jakarta.interceptor-api-@jakarta.interceptor.api.version@.jar
lib/jakarta.enterprise.cdi-api-@jakarta.enterprise.cdi.api.version@.jar
lib/jakarta.inject-api-@jakarta.inject.api.version@.jar
lib/jakarta.enterprise.lang-model-@jakarta.enterprise.lang.model.version@.jar

View File

@ -24,6 +24,7 @@
<jakarta.authentication.api.version>3.0.0</jakarta.authentication.api.version>
<jakarta.el.api.version>5.0.0</jakarta.el.api.version>
<jakarta.enterprise.cdi.api.version>4.0.1</jakarta.enterprise.cdi.api.version>
<jakarta.enterprise.lang.model.version>4.0.1</jakarta.enterprise.lang.model.version>
<jakarta.inject.api.version>2.0.1</jakarta.inject.api.version>
<jakarta.interceptor.api.version>2.1.0</jakarta.interceptor.api.version>
<jakarta.mail.api.version>2.1.0</jakarta.mail.api.version>
@ -294,6 +295,11 @@
<artifactId>jakarta.enterprise.cdi-api</artifactId>
<version>${jakarta.enterprise.cdi.api.version}</version>
</dependency>
<dependency>
<groupId>jakarta.enterprise</groupId>
<artifactId>jakarta.enterprise.lang-model</artifactId>
<version>${jakarta.enterprise.lang.model.version}</version>
</dependency>
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>

View File

@ -7,11 +7,11 @@ Enables Annotation scanning for deployed web applications.
ee8
[depend]
plus
ee8-plus
[lib]
lib/jetty-ee8-annotations-${jetty.version}.jar
lib/annotations/*.jar
lib/ee8-annotations/*.jar
[jpms]
add-modules:org.objectweb.asm

View File

@ -11,7 +11,7 @@
<name>EE8 :: Jetty Demo :: Async Rest :: Jar</name>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-async-rest-jar</ee9.module>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-jar</ee9.module>
<bundle-symbolic-name>${project.parent.groupId}.async.rest</bundle-symbolic-name>
</properties>

View File

@ -10,7 +10,9 @@
<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 -->
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp</ee9.module>
</properties>
<dependencies>
<dependency>

View File

@ -1,15 +0,0 @@
<?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

@ -1,9 +0,0 @@
<?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

@ -1,83 +0,0 @@
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

@ -1,62 +0,0 @@
<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,46 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<artifactId>jetty-ee8-demo-jaas-webapp</artifactId>
<name>EE8 :: Jetty Demo :: JAAS :: WebApp</name>
<packaging>war</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-jaas-webapp</ee9.module>
<bundle-symbolic-name>${project.groupId}.jaas</bundle-symbolic-name>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<scan>10</scan>
<systemProperties>
<!-- This is for convenience so that the src/etc/login.conf file can stay unmodified when copied to $jetty.home/etc directory -->
<jetty.base>${basedir}/src/main/config/modules/demo.d</jetty.base>
<!-- Mandatory. This system property tells JAAS where to find the login module configuration file -->
<java.security.auth.login.config>${basedir}/src/main/config/modules/demo.d/ee8-demo-login.conf</java.security.auth.login.config>
</systemProperties>
<webApp>
<contextPath>/test-jaas</contextPath>
<securityHandler implementation="org.eclipse.jetty.security.ConstraintSecurityHandler">
<loginService implementation="org.eclipse.jetty.jaas.JAASLoginService">
<name>Test JAAS Realm</name>
<loginModuleName>xyz</loginModuleName>
</loginService>
</securityHandler>
</webApp>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -0,0 +1,26 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- =============================================================== -->
<!-- Configure the demo-jaas webapp -->
<!-- =============================================================== -->
<Configure id='wac' class="org.eclipse.jetty.ee8.webapp.WebAppContext">
<Set name="contextPath">/test-jaas</Set>
<Set name="war"><Property name="jetty.webapps" default="." />/ee8-demo-jaas.war
</Set>
<Set name="extractWAR">true</Set>
<Set name="securityHandler">
<New class="org.eclipse.jetty.ee8.security.ConstraintSecurityHandler">
<Set name="loginService">
<New class="org.eclipse.jetty.ee8.jaas.JAASLoginService">
<Set name="name">Demo JAAS Realm</Set>
<Set name="loginModuleName">xyz</Set>
</New>
</Set>
</New>
</Set>
</Configure>

View File

@ -0,0 +1,5 @@
xyz {
org.eclipse.jetty.ee8.jaas.spi.PropertyFileLoginModule required
debug="true"
file="${jetty.base}/etc/ee8-demo-login.properties";
};

View File

@ -0,0 +1,30 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demo Spec webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
ee8-jaas
jdbc
ee8-jsp
ee8-annotations
ext
[files]
basehome:modules/demo.d/ee8-demo-jaas.xml|webapps/ee8-demo-jaas.xml
basehome:modules/demo.d/ee8-demo-jaas.properties|webapps/ee8-demo-jaas.properties
basehome:modules/demo.d/ee8-demo-login.conf|etc/ee8-demo-login.conf
basehome:modules/demo.d/ee8-demo-login.properties|etc/ee8-demo-login.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-jaas-webapp/${jetty.version}/war|webapps/ee8-demo-jaas.war
[ini]
# Enable security via jaas, and configure it
jetty.jaas.login.conf?=etc/demo-login.conf

View File

@ -0,0 +1,195 @@
<?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.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-jetty-webapp</artifactId>
<name>EE8 :: Jetty Demo :: Jetty :: WebApp</name>
<packaging>war</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-jetty-webapp</ee9.module>
<bundle-symbolic-name>${project.groupId}.webapp</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
</execution>
</executions>
<configuration>
<excludes>
<exclude>**/WebAppTest.java</exclude>
<exclude>**/Test*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<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>
<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="[3,4)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package>
<Export-Package>!org.example*</Export-Package>
<!-- the test webapp is configured via a jetty xml file
in order to add the security handler. -->
<Web-ContextPath>/</Web-ContextPath>
<!-- in fact the '.' must not be there
but Felix-BND has a bug:
http://www.mail-archive.com/users@felix.apache.org/msg04730.html
https://issues.apache.org/jira/browse/FELIX-1571
-->
<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>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-maven-plugin</artifactId>
<version>${project.version}</version>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-servlet</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<configuration>
<stopPort>8087</stopPort>
<stopKey>foo</stopKey>
<scan>1</scan>
<systemProperties>
<fooprop>222</fooprop>
</systemProperties>
<webApp>
<contextPath>/test</contextPath>
<tempDirectory>${project.build.directory}/work</tempDirectory>
</webApp>
<loginServices>
<loginService implementation="org.eclipse.jetty.ee8.security.HashLoginService">
<name>Test Realm</name>
<config>${project.build.testOutputDirectory}/test-realm.properties</config>
</loginService>
</loginServices>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-servlets</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-test-helper</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-javax-websocket-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-jetty-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-jetty-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-javax-server</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- ==================================================================
Configure and deploy the test web application in $(jetty.home)/webapps/test
Note. If this file did not exist or used a context path other that /test
then the default configuration of jetty.xml would discover the test
webapplication with a WebAppDeployer. By specifying a context in this
directory, additional configuration may be specified and hot deployments
detected.
===================================================================== -->
<Configure class="org.eclipse.jetty.ee9.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/</Set>
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/ee9-demo-jetty.war</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><SystemProperty name="jetty.home" default="."/>/etc/webdefault-ee9.xml</Set>
<Set name="overrideDescriptor"><SystemProperty name="jetty.base" default="."/>/etc/ee9-demo-override-web.xml</Set>
<!-- virtual hosts
<Set name="virtualHosts">
<Array type="String">
<Item>www.myVirtualDomain.com</Item>
<Item>localhost</Item>
<Item>127.0.0.1</Item>
</Array>
</Set>
-->
<!-- disable cookies
<Get name="sessionHandler">
<Get name="sessionManager">
<Set name="usingCookies" type="boolean">false</Set>
</Get>
</Get>
-->
<Get name="securityHandler">
<Set name="loginService">
<New class="org.eclipse.jetty.ee9.security.HashLoginService">
<Set name="name">Test Realm</Set>
<Set name="config">
<Property name="web-inf.uri">/ee9-demo-realm.properties</Property>
</Set>
<!-- To enable reload of realm when properties change, uncomment the following lines -->
<!--
<Set name="hotReload">false</Set>
<Call name="start"></Call>
-->
</New>
</Set>
<Set name="checkWelcomeFiles">true</Set>
</Get>
</Configure>

View File

@ -0,0 +1,38 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>webbundle</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<!-- baseDirectory>${basedir}/${project.build.directory}/${project.build.finalName}</baseDirectory -->
<fileSets>
<fileSet>
<directory>${basedir}/${project.build.directory}/${project.build.finalName}/</directory>
<outputDirectory></outputDirectory>
<includes>
<include>**/*.*</include>
</includes>
<excludes>
<exclude>WEB-INF/lib/**</exclude>
<exclude>WEB-INF/jetty-web.xml</exclude>
</excludes>
</fileSet>
</fileSets>
<!-- Removed until PropertyUserStore supports packed realm.properties -->
<!--
<files>
<file>
<source>src/main/assembly/embedded-jetty-web-for-webbundle.xml</source>
<outputDirectory>WEB-INF</outputDirectory>
<destName>jetty-web.xml</destName>
</file>
<file>
<source>src/main/config/demo-base/etc/realm.properties</source>
<outputDirectory>WEB-INF</outputDirectory>
<destName>realm.properties</destName>
</file>
</files>
-->
</assembly>

View File

@ -0,0 +1,64 @@
<?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"
version="3.1">
<!-- This web.xml format file is an override file that is applied to the test webapp AFTER
it has been configured by the default descriptor and the WEB-INF/web.xml descriptor -->
<!-- Add or override context init parameter -->
<context-param>
<param-name>context-override-example</param-name>
<param-value>a context value</param-value>
</context-param>
<!-- Add or override servlet init parameter -->
<servlet>
<servlet-name>default</servlet-name>
<init-param>
<param-name>precompressed</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<!-- Add or override servlet init parameter -->
<servlet>
<servlet-name>Dump</servlet-name>
<init-param>
<param-name>servlet-override-example</param-name>
<param-value>a servlet value</param-value>
</init-param>
</servlet>
<!-- Add servlet mapping -->
<servlet-mapping>
<servlet-name>Dump</servlet-name>
<url-pattern>*.more</url-pattern>
</servlet-mapping>
<!-- Reset servlet class and/or start order -->
<servlet>
<servlet-name>Session</servlet-name>
<servlet-class>org.example.SessionDump</servlet-class>
<load-on-startup>5</load-on-startup>
</servlet>
<!-- Allow remote access to test webapp -->
<!--
<filter>
<filter-name>TestFilter</filter-name>
<filter-class>org.example.TestFilter</filter-class>
<async-supported>true</async-supported>
<init-param>
<param-name>remote</param-name>
<param-value>true</param-value>
</init-param>
</filter>
-->
</web-app>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- ==================================================================
Configure and deploy the test web application
===================================================================== -->
<Configure id="testWebapp" class="org.eclipse.jetty.ee8.webapp.WebAppContext">
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Required minimal context configuration : -->
<!-- + contextPath -->
<!-- + war OR resourceBase -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="contextPath">/ee8-test</Set>
<Set name="war"><Property name="jetty.webapps" default="." />/ee8-demo-jetty.war
</Set>
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<!-- Optional context configuration -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="defaultsDescriptor"><Property name="jetty.home" default="."/>/etc/webdefault-ee8.xml</Set>
<Set name="overrideDescriptor"><Property name="jetty.webapps" default="." />/ee8-demo-jetty.d/ee8-demo-jetty-override-web.xml
</Set>
<!-- Enable WebSocket container -->
<Call name="setAttribute">
<Arg>org.eclipse.jetty.websocket.jakarta</Arg>
<Arg type="Boolean">true</Arg>
</Call>
<Get name="coreContextHandler">
<Call name="insertHandler">
<Arg>
<New class="org.eclipse.jetty.server.handler.gzip.GzipHandler">
<Set name="minGzipSize">2048</Set>
</New>
</Arg>
</Call>
</Get>
</Configure>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- Simple handler to redirect from old path to new -->
<Configure class="org.eclipse.jetty.server.handler.MovedContextHandler">
<Set name="contextPath">/oldContextPath</Set>
<Set name="newContextURL">/test/dump/moved</Set>
<Set name="permanent">false</Set>
<Set name="discardPathInfo">false</Set>
<Set name="discardQuery">false</Set>
<Set name="expires">-1</Set>
</Configure>

View File

@ -0,0 +1,97 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- =============================================================== -->
<!-- Configure the demos -->
<!-- =============================================================== -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">
<!-- ============================================================= -->
<!-- Add rewrite rules -->
<!-- ============================================================= -->
<Ref refid="Rewrite">
<!-- protect favicon handling -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.HeaderPatternRule">
<Arg>/favicon.ico</Arg>
<Arg>Cache-Control</Arg>
<Arg>Max-Age=3600,public</Arg>
<Set name="terminating">true</Set>
</New>
</Arg>
</Call>
<!-- redirect from the welcome page to a specific page -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Arg>/test/rewrite/</Arg>
<Arg>/test/rewrite/info.html</Arg>
</New>
</Arg>
</Call>
<!-- replace the entire request URI -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Arg>/test/some/old/context</Arg>
<Arg>/test/rewritten/newcontext</Arg>
</New>
</Arg>
</Call>
<!-- replace the beginning of the request URI -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewritePatternRule">
<Arg>/test/rewrite/for/*</Arg>
<Arg>/test/rewritten/</Arg>
</New>
</Arg>
</Call>
<!-- reverse the order of the path sections -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RewriteRegexRule">
<Arg>(.*?)/reverse/([^/]*)/(.*)</Arg>
<Arg>$1/reverse/$3/$2</Arg>
</New>
</Arg>
</Call>
<!-- add a cookie to each path visited -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.CookiePatternRule">
<Arg>/*</Arg>
<Arg>visited</Arg>
<Arg>yes</Arg>
</New>
</Arg>
</Call>
<!-- actual redirect, instead of internal rewrite -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.RedirectPatternRule">
<Arg>/test/redirect/*</Arg>
<Arg>/test/redirected</Arg>
</New>
</Arg>
</Call>
<!-- add a response rule -->
<Call name="addRule">
<Arg>
<New class="org.eclipse.jetty.rewrite.handler.ResponsePatternRule">
<Arg>/400Error</Arg>
<Arg type="int">400</Arg>
<Arg>ResponsePatternRuleDemo</Arg>
</New>
</Arg>
</Call>
</Ref>
</Configure>

View File

@ -0,0 +1,30 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demo Jetty Webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
jdbc
ee8-jsp
ee8-jstl
ee8-annotations
ext
ee8-servlets
ee8-websocket-javax
ee8-websocket-jetty
ee8-demo-realm
[files]
webapps/demo-jetty.d/
basehome:modules/demo.d/ee8-demo-jetty.xml|webapps/ee8-demo-jetty.xml
basehome:modules/demo.d/ee8-demo-jetty-override-web.xml|webapps/ee8-demo-jetty.d/ee8-demo-jetty-override-web.xml
basehome:modules/demo.d/ee8-demo-jetty.properties|webapps/ee8-demo-jetty.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-jetty-webapp/${jetty.version}/war|webapps/ee8-demo-jetty.war

View File

@ -0,0 +1,17 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demonstrate a Moved Context Handler.
[environment]
ee8
[tags]
demo
[depends]
ee8-deploy
[files]
basehome:modules/demo.d/ee8-demo-moved-context.xml|webapps/ee8-demo-moved-context.xml

View File

@ -0,0 +1,20 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demonstrate the rewrite module.
[environment]
ee8
[tags]
demo
[depends]
rewrite
[xml]
etc/ee8-demo-rewrite-rules.xml
[files]
basehome:modules/demo.d/ee8-demo-rewrite-rules.xml|etc/ee8-demo-rewrite-rules.xml

View File

@ -0,0 +1,129 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<artifactId>jetty-ee8-demo-jndi-webapp</artifactId>
<name>EE8 :: Jetty Demo :: JNDI :: WebApp</name>
<packaging>war</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-jndi-webapp</ee9.module>
<bundle-symbolic-name>${project.groupId}.jndi</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-templates-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<mavenFilteringHints>
<mavenFilteringHint>ee9-to-ee8</mavenFilteringHint>
</mavenFilteringHints>
<outputDirectory>${project.build.directory}/templates</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${ee9.module.path}/src/main/templates</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-xml-files</id>
<phase>process-resources</phase>
<configuration>
<target>
<concat destfile="${project.build.directory}/plugin-context.xml">
<filelist dir="${project.build.directory}/templates" files="plugin-context-header.xml,env-definitions.xml" />
</concat>
<concat destfile="${project.build.directory}/test-jndi.xml">
<filelist dir="${project.build.directory}/templates" files="jetty-test-jndi-header.xml,env-definitions.xml" />
</concat>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>jakarta.transaction-api,ee8-demo-mock-resources</includeArtifactIds>
<outputDirectory>${project.build.directory}/lib/jndi</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<contextXml>${project.build.directory}/plugin-context.xml</contextXml>
<webApp>
<war>src/main/webapp</war>
<descriptor>${project.build.directory}/webapp/WEB-INF/web.xml</descriptor>
<contextPath>/test-jndi</contextPath>
</webApp>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-mock-resources</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-mock-resources</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,75 @@
<?xml version="1.0"?><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<!-- =============================================================== -->
<!-- Configure the test-jndi webapp -->
<!-- =============================================================== -->
<Configure id='wac' class="org.eclipse.jetty.ee8.webapp.WebAppContext">
<New id="tx" class="org.eclipse.jetty.ee8.plus.jndi.Transaction">
<Arg><Property name="environment" default="ee8"/></Arg>
<Arg>
<New class="org.example.MockUserTransaction" />
</Arg>
</New>
<Set name="contextPath">/test-jndi</Set>
<Set name="war"><Property name="jetty.webapps" default="." />/ee8-demo-jndi.war
</Set>
<Set name="extractWAR">true</Set>
<Set name="copyWebDir">false</Set>
<Set name="configurationDiscovered">true</Set>
<!-- Define an env entry with ee8 scope for java:comp/env -->
<New id="woggle" class="org.eclipse.jetty.ee8.plus.jndi.EnvEntry">
<Arg>
<Property name="environment" default="ee8"/>
</Arg>
<Arg>woggle</Arg>
<Arg type="java.lang.Integer">4000</Arg>
<Arg type="boolean">false</Arg>
</New>
<!-- Define an env entry with webapp scope for java:comp/env -->
<New id="wiggle" class="org.eclipse.jetty.ee8.plus.jndi.EnvEntry">
<Arg>
<Ref refid='wac' />
</Arg>
<Arg>wiggle</Arg>
<Arg type="java.lang.Double">100</Arg>
<Arg type="boolean">true</Arg>
</New>
<!-- Mail Session setup -->
<New id="xxxmail" class="org.eclipse.jetty.ee8.plus.jndi.Resource">
<Arg>
<Ref refid='wac' />
</Arg>
<Arg>mail/Session</Arg>
<Arg>
<New class="org.eclipse.jetty.ee8.jndi.factories.MailSessionReference">
<Set name="user">CHANGE-ME</Set>
<Set name="password">CHANGE-ME</Set>
<Set name="properties">
<New class="java.util.Properties">
<Put name="mail.smtp.auth">false</Put> <!-- change to true if you want to authenticate -->
<Put name="mail.smtp.host">CHANGE-ME</Put>
<Put name="mail.from">CHANGE-ME</Put>
<Put name="mail.debug">false</Put>
</New>
</Set>
</New>
</Arg>
</New>
<!-- A mock DataSource -->
<New id="mydatasource" class="org.eclipse.jetty.ee8.plus.jndi.Resource">
<Arg>
<Ref refid='wac' />
</Arg>
<Arg>jdbc/mydatasource</Arg>
<Arg>
<New class="org.example.MockDataSource" />
</Arg>
</New>
</Configure>

View File

@ -0,0 +1,28 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Demo JNDI Resources Webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
ext
jdbc
ee8-jndi
ee8-plus
ee8-demo-mock-resources
[files]
basehome:modules/demo.d/ee8-demo-jndi.xml|webapps/ee8-demo-jndi.xml
basehome:modules/demo.d/ee8-demo-jndi.properties|webapps/ee8-demo-jndi.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-jndi-webapp/${jetty.version}/war|webapps/ee8-demo-jndi.war
maven://org.eclipse.jetty.orbit/javax.mail.glassfish/@javax.mail.glassfish.version@/jar|lib/ee8/javax.mail.glassfish-@javax.mail.glassfish.version@.jar
[lib]
lib/ee8/javax.mail.glassfish-@javax.mail.glassfish.version@.jar

View File

@ -0,0 +1,125 @@
<?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-jsp-webapp</artifactId>
<name>EE8 :: Jetty Demo :: JSP :: Webapp</name>
<packaging>war</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-jsp-webapp</ee9.module>
<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="[3,4)",org.eclipse.jetty.*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))",*</Import-Package>
<Export-Package>!org.example.*</Export-Package>
<Web-ContextPath>/ee8-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>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>precompile-jsp</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jspc-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>jspc</id>
<goals>
<goal>jspc</goal>
</goals>
<!-- example configuration
<configuration>
<includes>**/*.foo</includes>
<excludes>**/*.fff</excludes>
<sourceVersion>1.8</sourceVersion>
<targetVersion>1.8</targetVersion>
</configuration>
-->
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webXml>${basedir}/target/web.xml</webXml>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</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,18 @@
[description]
Demo Simple JSP Webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-jsp
ee8-jstl
ee8-deploy
[files]
basehome:modules/demo.d/ee8-demo-jsp.properties|webapps/ee8-demo-jsp.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-jsp-webapp/${jetty.version}/war|webapps/ee8-demo-jsp.war

View File

@ -0,0 +1,61 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<name>EE8 :: Jetty Demo :: Mock Resources</name>
<artifactId>jetty-ee8-demo-mock-resources</artifactId>
<packaging>jar</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-mock-resources</ee9.module>
<bundle-symbolic-name>${project.groupId}.mocks</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<goals>
<goal>manifest</goal>
</goals>
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.ee8.demos.ee8-demo-mock-resources</Bundle-SymbolicName>
<Bundle-Description>Mock resources used for testing</Bundle-Description>
<Export-Package>
org.example;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"
</Export-Package>
<Import-Package>
javax.sql, jakarta.transaction;version="1.3.3"
</Import-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.mail.glassfish</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,20 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Download and install some Demo Mock Resources
[environment]
ee8
[tags]
demo
[depends]
jdbc
ee8-annotations
[files]
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-mock-resources/${jetty.version}/jar|lib/ee8/ee8-demo-mock-resources-${jetty.version}.jar
[lib]
lib/ee8/ee8-demo-mock-resources-${jetty.version}.jar

View File

@ -0,0 +1,94 @@
<?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.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jetty-ee8-demo-proxy-webapp</artifactId>
<name>EE8 :: Jetty Demo :: Proxy :: Webapp</name>
<packaging>war</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-proxy-webapp</ee9.module>
<bundle-symbolic-name>${project.groupId}.proxy</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>${warSourceDirectory}</warSourceDirectory>
<failOnMissingWebXml>true</failOnMissingWebXml>
<archive>
<manifestFile>${warSourceDirectory}/META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<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</groupId>
<artifactId>jetty-ee8-proxy</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-jmx</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.http2</groupId>
<artifactId>http2-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-alpn-java-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-annotations</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp.jstl</groupId>
<artifactId>jakarta.servlet.jsp.jstl-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 Proxy Webapp
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
[files]
basehome:modules/demo.d/ee8-demo-proxy.properties|webapps/ee8-demo-proxy.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-proxy-webapp/${jetty.version}/war|webapps/ee8-demo-proxy.war

View File

@ -16,7 +16,7 @@
<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 -->
<dependencies>
<dependency>

View File

@ -1,24 +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_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>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>org.eclipse.jetty.ee8.demo.simple.HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -1,6 +0,0 @@
<!DOCTYPE html>
<html>
<body>
<h2><a href="./hello">Hello World EE8!</a></h2>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@ -0,0 +1,41 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-spec</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<artifactId>jetty-ee8-demo-container-initializer</artifactId>
<packaging>jar</packaging>
<name>EE8 :: Jetty Demo :: Servlet Spec :: ServletContainerInitializer Jar</name>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-container-initializer</ee9.module>
<bundle-symbolic-name>${project.groupId}.sci</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>org.eclipse.jetty.ee8.demos.ee8-demo-servlet-container-initializer;singleton:=true</Bundle-SymbolicName>
<Bundle-Description>A bundle containing a ServletContainerInitializer for testing</Bundle-Description>
<Require-Capability>osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)"</Require-Capability>
<Provide-Capability>osgi.serviceloader; osgi.serviceloader=jakarta.servlet.ServletContainerInitializer</Provide-Capability>
<Export-Package>org.example.initializer;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}"</Export-Package>
<_nouses>true</_nouses>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,265 @@
<?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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-spec</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<name>ee8 :: Jetty Demo :: Servlet Spec :: Webapp</name>
<artifactId>jetty-ee8-demo-spec-webapp</artifactId>
<packaging>war</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp</ee9.module>
<bundle-symbolic-name>${project.groupId}.spec.webapp</bundle-symbolic-name>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<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>
<!-- 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>
<webResources>
<resource>
<directory>target</directory>
<includes>
<include>plugin-context.xml</include>
</includes>
<targetPath>META-INF</targetPath>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-Description>Test Webapp for Servlet 5.0 Features</Bundle-Description>
<!-- TODO Add 'org.eclipse.jetty.util;version="[9.4.19,9.4.20)",' below, once 9.4.19 is released with a fix for #3726 -->
<Import-Package>
jakarta.transaction*;version="2.0.0", jakarta.servlet*;version="[5,6)", org.eclipse.jetty*;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))", org.eclipse.jetty.webapp;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.eclipse.jetty.plus.jndi;version="[$(version;===;${parsedVersion.osgiVersion}),$(version;==+;${parsedVersion.osgiVersion}))";resolution:="optional", org.example;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}", *
</Import-Package>
<_nouses />
<Export-Package>org.example.test;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}";-noimport:=true</Export-Package>
<Web-ContextPath>/</Web-ContextPath>
<Bundle-ClassPath>.,WEB-INF/classes,WEB-INF/lib</Bundle-ClassPath>
<Jetty-ContextFilePath>/META-INF/plugin-context.xml</Jetty-ContextFilePath>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-templates-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<mavenFilteringHints>
<mavenFilteringHint>ee9-to-ee8</mavenFilteringHint>
</mavenFilteringHints>
<outputDirectory>${project.build.directory}/templates</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${ee9.module.path}/src/main/templates</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-realm</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/realm</outputDirectory>
<resources>
<resource>
<directory>${ee9.module.path}/src/etc</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>generate-xml-files</id>
<phase>process-resources</phase>
<configuration>
<target>
<concat destfile="${project.build.directory}/plugin-context.xml">
<filelist dir="${project.build.directory}/templates" files="plugin-context-header.xml,env-definitions.xml" />
</concat>
<concat destfile="${project.build.directory}/test-spec.xml">
<filelist dir="${project.build.directory}/templates" files="annotations-context-header.xml,env-definitions.xml" />
</concat>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-mock-resources</artifactId>
<version>${project.version}</version>
<type>jar</type>
<includes>**</includes>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/lib/jndi</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-java</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireUpperBoundDeps>
<excludes combine.children="append">
<exclude>org.eclipse.jetty:jetty-util</exclude>
</excludes>
</requireUpperBoundDeps>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-maven-plugin</artifactId>
<version>${project.version}</version>
<configuration>
<scan>10</scan>
<contextXml>${project.build.directory}/plugin-context.xml</contextXml>
<webApp>
<war>src/main/webapp</war>
<descriptor>src/main/webapp/WEB-INF/web.xml</descriptor>
<contextPath>/test-spec</contextPath>
<containerIncludeJarPattern>.*/jetty-jakarta-servlet-api-[^/]*\.jar$</containerIncludeJarPattern>
<configurationDiscovered>true</configurationDiscovered>
<jettyEnvXml>${basedir}/src/main/webapp/WEB-INF/jetty-env.xml</jettyEnvXml>
</webApp>
<loginServices>
<loginService implementation="org.eclipse.jetty.ee8.security.HashLoginService">
<name>Test Realm</name>
<config>${project.build.directory}/realm.properties</config>
</loginService>
</loginServices>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-mock-resources</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>jakarta.transaction</groupId>
<artifactId>jakarta.transaction-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-web-fragment</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-container-initializer</artifactId>
</dependency>
<!-- deliberately old version to test classloading -->
<!-- TODO uncomment and update the following once 9.4.19 is released with a fix for #3726
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.4.19.vXXXXXXXX</version>
<exclusions>
<exclusion>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
</dependencies>
</project>

View File

@ -0,0 +1,21 @@
#
# This file defines users passwords and roles for a HashUserRealm
#
# The format is
# <username>: <password>[,<rolename> ...]
#
# Passwords may be clear text, obfuscated or checksummed. The class
# org.eclipse.util.Password should be used to generate obfuscated
# passwords or password checksums
#
# If DIGEST Authentication is used, the password must be in a recoverable
# format, either plain text or OBF:.
#
jetty: MD5:164c88b302622e17050af52c89945d44,user
admin: CRYPT:adpexzg3FUZAk,server-administrator,content-administrator,admin,user
other: OBF:1xmk1w261u9r1w1c1xmq,user
plain: plain,user
user: password,user
# This entry is for digest auth. The credential is a MD5 hash of username:realmname:password
digest: MD5:6e120743ad67abfbc385bc2bb754e297,user

View File

@ -0,0 +1,18 @@
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<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>
</fileSet>
</fileSets>
</assembly>

View File

@ -0,0 +1,34 @@
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="wac" class="org.eclipse.jetty.ee8.webapp.WebAppContext">
<Set name="contextPath">/ee8-test-spec</Set>
<Set name="war"><Property name="jetty.webapps" />/ee8-demo-spec.war
</Set>
<Set name="configurationDiscovered">true</Set>
<New id="tx" class="org.eclipse.jetty.ee8.plus.jndi.Transaction">
<Arg><Property name="environment" default="ee"/></Arg>
<Arg>
<New class="org.example.MockUserTransaction" />
</Arg>
</New>
<New id="maxAmount" class="org.eclipse.jetty.ee8.plus.jndi.EnvEntry">
<Arg>
<Ref refid='wac' />
</Arg>
<Arg>maxAmount</Arg>
<Arg type="java.lang.Double">100</Arg>
<Arg type="boolean">true</Arg>
</New>
<New id="mydatasource" class="org.eclipse.jetty.ee8.plus.jndi.Resource">
<Arg><Ref refid='wac'/></Arg>
<Arg>jdbc/mydatasource</Arg>
<Arg>
<New class="org.example.MockDataSource">
</New>
</Arg>
</New>
</Configure>

View File

@ -0,0 +1,25 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Download and deploy the Test Spec webapp demo.
[environment]
ee8
[tags]
demo
webapp
[depends]
ee8-deploy
jdbc
ee8-jsp
ee8-annotations
ext
ee8-demo-realm
ee8-demo-mock-resources
[files]
basehome:modules/demo.d/ee8-demo-spec.xml|webapps/ee8-demo-spec.xml
basehome:modules/demo.d/ee8-demo-spec.properties|webapps/ee8-demo-spec.properties
maven://org.eclipse.jetty.ee8.demos/jetty-ee8-demo-spec-webapp/${jetty.version}/war|webapps/ee8-demo-spec.war

View File

@ -0,0 +1,25 @@
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-spec</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<name>EE8 :: Jetty Demo :: Servlet Spec :: Fragment Jar</name>
<artifactId>jetty-ee8-demo-web-fragment</artifactId>
<packaging>jar</packaging>
<properties>
<ee9.module>jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-web-fragment</ee9.module>
<bundle-symbolic-name>${project.groupId}.spec.fragment</bundle-symbolic-name>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demos</artifactId>
<version>12.0.0-SNAPSHOT</version>
</parent>
<name>EE8 :: Jetty Demo :: Servlet Spec</name>
<artifactId>jetty-ee8-demo-spec</artifactId>
<packaging>pom</packaging>
<modules>
<module>jetty-ee8-demo-spec-webapp</module>
<module>jetty-ee8-demo-container-initializer</module>
<module>jetty-ee8-demo-web-fragment</module>
</modules>
</project>

View File

@ -14,35 +14,87 @@
<properties>
<sonar.skip>true</sonar.skip>
<warSourceDirectory>${project.build.directory}/webapp</warSourceDirectory>
</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>
<pluginManagement>
<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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>${warSourceDirectory}</warSourceDirectory>
<failOnMissingWebXml>true</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</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>-->
<module>jetty-ee8-demo-jaas-webapp</module>
<module>jetty-ee8-demo-mock-resources</module>
<module>jetty-ee8-demo-jndi-webapp</module>
<module>jetty-ee8-demo-jetty-webapp</module>
<!-- Needs jetty-ee9-proxy -->
<!-- module>jetty-ee9-demo-proxy-webapp</module -->
<module>jetty-ee8-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-ee8-demo-jsp-webapp</module>
<module>jetty-ee8-demo-spec</module>
<!-- <module>jetty-ee9-demo-template</module>-->
</modules>
<profiles>
<profile>
<id>demo-webapp-module</id>
<activation>
<file>
<exists>src/main/config/modules/demo.d</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-ee8-webapp-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<mavenFilteringHints>
<mavenFilteringHint>ee9-to-ee8</mavenFilteringHint>
</mavenFilteringHints>
<outputDirectory>${project.build.directory}/webapp</outputDirectory>
<resources>
<resource>
<filtering>true</filtering>
<directory>${ee9.module.path}/src/main/webapp</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -215,35 +215,35 @@
<outputDirectory>${assembly-directory}/lib/ee8-apache-jsp</outputDirectory>
</configuration>
</execution>
<!-- <execution>-->
<!-- <id>copy-ee8-jstl-src-deps</id>-->
<!-- <phase>generate-resources</phase>-->
<!-- <goals>-->
<!-- <goal>copy-dependencies</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <prependGroupId>true</prependGroupId>-->
<!-- <includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web</includeGroupIds>-->
<!-- <includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>-->
<!-- <includeTypes>jar</includeTypes>-->
<!-- <classifier>sources</classifier>-->
<!-- <outputDirectory>${source-assembly-directory}/lib/ee8-glassfish-jstl</outputDirectory>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- <execution>-->
<!-- <id>copy-ee8-jstl-deps</id>-->
<!-- <phase>generate-resources</phase>-->
<!-- <goals>-->
<!-- <goal>copy-dependencies</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <prependGroupId>true</prependGroupId>-->
<!-- <includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web</includeGroupIds>-->
<!-- <includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>-->
<!-- <includeTypes>jar</includeTypes>-->
<!-- <outputDirectory>${assembly-directory}/lib/ee8-glassfish-jstl</outputDirectory>-->
<!-- </configuration>-->
<!-- </execution>-->
<execution>
<id>copy-ee8-jstl-src-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>
<includeTypes>jar</includeTypes>
<classifier>sources</classifier>
<outputDirectory>${source-assembly-directory}/lib/ee8-glassfish-jstl</outputDirectory>
</configuration>
</execution>
<execution>
<id>copy-ee8-jstl-deps</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<prependGroupId>true</prependGroupId>
<includeGroupIds>jakarta.servlet.jsp.jstl,org.glassfish.web</includeGroupIds>
<includeArtifactIds>jakarta.servlet.jsp.jstl-api,jakarta.servlet.jsp.jstl</includeArtifactIds>
<includeTypes>jar</includeTypes>
<outputDirectory>${assembly-directory}/lib/ee8-glassfish-jstl</outputDirectory>
</configuration>
</execution>
<!-- <execution>-->
<!-- <id>copy-ee8-jaspi-deps</id>-->
<!-- <phase>generate-resources</phase>-->
@ -382,48 +382,48 @@
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-servlets</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.websocket</groupId>-->
<!-- <artifactId>jetty-ee8-websocket-servlet</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.websocket</groupId>-->
<!-- <artifactId>jetty-ee8-websocket-jetty-server</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.websocket</groupId>-->
<!-- <artifactId>jetty-ee8-websocket-jetty-client</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.websocket</groupId>-->
<!-- <artifactId>jetty-ee8-websocket-jakarta-server</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8</groupId>-->
<!-- <artifactId>jetty-ee8-apache-jsp</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8</groupId>-->
<!-- <artifactId>jetty-ee8-glassfish-jstl</artifactId>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>javax.el</groupId>-->
<!-- <artifactId>el-api</artifactId>-->
<!-- </exclusion>-->
<!-- <exclusion>-->
<!-- <groupId>jakarta.el</groupId>-->
<!-- <artifactId>jakarta.el-api</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-jetty-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-jetty-client</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-javax-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-apache-jsp</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-glassfish-jstl</artifactId>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
<exclusion>
<groupId>jakarta.el</groupId>
<artifactId>jakarta.el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-plus</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8</groupId>-->
<!-- <artifactId>jetty-ee8-proxy</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-proxy</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8</groupId>-->
<!-- <artifactId>jetty-ee8-cdi</artifactId>-->
@ -438,11 +438,11 @@
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-annotations</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8</groupId>-->
<!-- <artifactId>jetty-ee8-openid</artifactId>-->
<!-- <optional>true</optional>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-openid</artifactId>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8</groupId>-->
<!-- <artifactId>jetty-ee8-jaspi</artifactId>-->
@ -454,52 +454,52 @@
<optional>true</optional>
</dependency>
<!-- Demo ee8 Apps -->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-mock-resources</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-jetty-webapp</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- <classifier>config</classifier>-->
<!-- <type>jar</type>-->
<!-- <optional>true</optional>-->
<!-- <exclusions>-->
<!-- <exclusion>-->
<!-- <groupId>javax.el</groupId>-->
<!-- <artifactId>el-api</artifactId>-->
<!-- </exclusion>-->
<!-- </exclusions>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-jaas-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-jndi-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-spec-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-mock-resources</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-jetty-webapp</artifactId>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
<exclusions>
<exclusion>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-jaas-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-jndi-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-spec-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>
@ -508,14 +508,14 @@
<type>jar</type>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-proxy-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>
<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>
@ -524,14 +524,14 @@
<type>jar</type>
<optional>true</optional>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee8.demos</groupId>-->
<!-- <artifactId>jetty-ee8-demo-jsp-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>
<version>${project.version}</version>
<classifier>config</classifier>
<type>jar</type>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@ -16,7 +16,7 @@ basehome:modules/openid/jetty-ee8-openid-baseloginservice.xml|etc/openid-baselog
[xml]
etc/openid-baseloginservice.xml
etc/jetty-openid.xml
etc/jetty-ee8-openid.xml
[ini-template]
## The OpenID Identity Provider's issuer ID (the entire URL *before* ".well-known/openid-configuration")

View File

@ -6,9 +6,9 @@ ee8
[depend]
server
security
jndi
webapp
ee8-security
ee8-webapp
[lib]
lib/jetty-ee8-plus-${jetty.version}.jar

View File

@ -9,7 +9,7 @@ MultiPartFilter, PushCacheFilter, QoSFilter, etc.) for use by all webapplication
ee8
[depend]
servlet
ee8-servlet
[lib]
lib/jetty-ee8-servlets-${jetty.version}.jar

View File

@ -0,0 +1,27 @@
[description]
Enable javax.websocket APIs for deployed web applications.
[environment]
ee8
[tags]
websocket
[depend]
client
ee8-annotations
[lib]
lib/ee8-websocket/jetty-websocket-core-common-${jetty.version}.jar
lib/ee8-websocket/jetty-websocket-core-client-${jetty.version}.jar
lib/ee8-websocket/jetty-websocket-core-server-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-servlet-${jetty.version}.jar
lib/ee8-websocket/jetty-jakarta-websocket-api-2.0.0.jar
lib/ee8-websocket/jetty-ee8-websocket-javax-client-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-javax-common-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jakarta-server-${jetty.version}.jar
[jpms]
# The implementation needs to access method handles in
# classes that are in the web application classloader.
add-reads: org.eclipse.jetty.websocket.jakarta.common=ALL-UNNAMED

View File

@ -1,28 +0,0 @@
[description]
Enable javax.websocket APIs for deployed web applications.
[environment]
ee8
[tags]
websocket
[depend]
client
annotations
[lib]
lib/websocket/jetty-websocket-core-common-${jetty.version}.jar
lib/websocket/jetty-websocket-core-client-${jetty.version}.jar
lib/websocket/jetty-websocket-core-server-${jetty.version}.jar
lib/websocket/websocket-servlet-${jetty.version}.jar
lib/websocket/jetty-jakarta-websocket-api-2.0.0.jar
lib/websocket/websocket-jakarta-client-${jetty.version}.jar
lib/websocket/websocket-jakarta-common-${jetty.version}.jar
lib/websocket/websocket-jakarta-server-${jetty.version}.jar
[jpms]
# The implementation needs to access method handles in
# classes that are in the web application classloader.
add-reads: org.eclipse.jetty.websocket.jakarta.common=ALL-UNNAMED

View File

@ -3,19 +3,22 @@
[description]
Expose the Jetty WebSocket Client classes to deployed web applications.
[environment]
ee8
[tags]
websocket
[depend]
client
annotations
ee8-annotations
[lib]
lib/websocket/jetty-websocket-core-common-${jetty.version}.jar
lib/websocket/jetty-websocket-core-client-${jetty.version}.jar
lib/websocket/websocket-jetty-api-${jetty.version}.jar
lib/websocket/websocket-jetty-common-${jetty.version}.jar
lib/websocket/websocket-jetty-client-${jetty.version}.jar
lib/ee8-websocket/jetty-websocket-core-common-${jetty.version}.jar
lib/ee8-websocket/jetty-websocket-core-client-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jetty-api-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jetty-common-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jetty-client-${jetty.version}.jar
[jpms]
# The implementation needs to access method handles in

View File

@ -0,0 +1,26 @@
# DO NOT EDIT - See: https://www.eclipse.org/jetty/documentation/current/startup-modules.html
[description]
Enable the Jetty WebSocket API support for deployed web applications.
[environment]
ee8
[tags]
websocket
[depend]
ee8-annotations
[lib]
lib/ee8-websocket/jetty-websocket-core-common-${jetty.version}.jar
lib/ee8-websocket/jetty-websocket-core-server-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-servlet-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jetty-api-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jetty-common-${jetty.version}.jar
lib/ee8-websocket/jetty-ee8-websocket-jetty-server-${jetty.version}.jar
[jpms]
# The implementation needs to access method handles in
# classes that are in the web application classloader.
add-reads: org.eclipse.jetty.websocket.jetty.common=ALL-UNNAMED

View File

@ -1,21 +0,0 @@
[description]
Enable the Jetty WebSocket API support for deployed web applications.
[tags]
websocket
[depend]
annotations
[lib]
lib/websocket/jetty-websocket-core-common-${jetty.version}.jar
lib/websocket/jetty-websocket-core-server-${jetty.version}.jar
lib/websocket/websocket-servlet-${jetty.version}.jar
lib/websocket/websocket-jetty-api-${jetty.version}.jar
lib/websocket/websocket-jetty-common-${jetty.version}.jar
lib/websocket/websocket-jetty-server-${jetty.version}.jar
[jpms]
# The implementation needs to access method handles in
# classes that are in the web application classloader.
add-reads: org.eclipse.jetty.websocket.jetty.common=ALL-UNNAMED

View File

@ -23,6 +23,7 @@
<checkstyle.skip>true</checkstyle.skip>
<sonar.skip>true</sonar.skip>
<ee9.module></ee9.module>
<ee9.module.path>${maven.multiModuleProjectDirectory}/jetty-ee9/${ee9.module}</ee9.module.path>
<modify-sources-plugin.version>1.0.0-SNAPSHOT</modify-sources-plugin.version>
</properties>
@ -83,6 +84,9 @@
<nonFilteredFileExtension>br</nonFilteredFileExtension>
<nonFilteredFileExtension>xcf</nonFilteredFileExtension>
<nonFilteredFileExtension>jsp</nonFilteredFileExtension>
<nonFilteredFileExtension>icon</nonFilteredFileExtension>
<nonFilteredFileExtension>png</nonFilteredFileExtension>
<nonFilteredFileExtension>webp</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
<dependencies>
@ -106,9 +110,13 @@
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
<mavenFilteringHints>
<mavenFilteringHint>ee9-to-ee8</mavenFilteringHint>
</mavenFilteringHints>
<resources>
<resource>
<directory>${maven.multiModuleProjectDirectory}/jetty-ee9/${ee9.module}/src/main/resources</directory>
<filtering>true</filtering>
<directory>${ee9.module.path}/src/main/resources</directory>
</resource>
</resources>
</configuration>
@ -128,7 +136,7 @@
<!-- <resources>-->
<!-- <resource>-->
<!-- <filtering>true</filtering>-->
<!-- <directory>${maven.multiModuleProjectDirectory}/jetty-ee9/${ee9.module}/src/main/config</directory>-->
<!-- <directory>${ee9.module.path}/src/main/config</directory>-->
<!-- </resource>-->
<!-- </resources>-->
<!-- </configuration>-->
@ -147,7 +155,7 @@
<resources>
<resource>
<filtering>true</filtering>
<directory>${maven.multiModuleProjectDirectory}/jetty-ee9/${ee9.module}/src/test/resources</directory>
<directory>${ee9.module.path}/src/test/resources</directory>
</resource>
</resources>
</configuration>
@ -165,7 +173,7 @@
<goal>modify-sources-ee9-to-ee8</goal>
</goals>
<configuration>
<sourceProjectLocation>${maven.multiModuleProjectDirectory}/jetty-ee9/${ee9.module}/src/main/java</sourceProjectLocation>
<sourceProjectLocation>${ee9.module.path}/src/main/java</sourceProjectLocation>
<outputDirectory>${project.build.sourceDirectory}</outputDirectory>
</configuration>
</execution>
@ -177,7 +185,7 @@
</goals>
<configuration>
<testSources>true</testSources>
<sourceProjectLocation>${maven.multiModuleProjectDirectory}/jetty-ee9/${ee9.module}/src/test/java</sourceProjectLocation>
<sourceProjectLocation>${ee9.module.path}/src/test/java</sourceProjectLocation>
<outputDirectory>${project.build.testSourceDirectory}</outputDirectory>
</configuration>
</execution>
@ -227,6 +235,11 @@
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
<version>1.2.7</version>
</dependency>
<dependency>
<groupId>jakarta.servlet.jsp</groupId>
<artifactId>jakarta.servlet.jsp-api</artifactId>
<version>2.3.6</version>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.servlet.jsp.jstl</artifactId>
@ -252,6 +265,11 @@
<artifactId>jetty-ee8-annotations</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-proxy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-nested</artifactId>
@ -282,6 +300,16 @@
<artifactId>jetty-ee8-plus</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-openid</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-glassfish-jstl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-javax-common</artifactId>
@ -322,6 +350,21 @@
<artifactId>jetty-ee8-websocket-javax-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-mock-resources</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-web-fragment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8.demos</groupId>
<artifactId>jetty-ee8-demo-container-initializer</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>

View File

@ -102,21 +102,21 @@
<artifactId>jetty-ee9-maven-plugin</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9</groupId>-->
<!-- <artifactId>jetty-ee9-openid</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-openid</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-plus</artifactId>
<version>${project.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9</groupId>-->
<!-- <artifactId>jetty-ee9-proxy</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-proxy</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9</groupId>
<artifactId>jetty-ee9-quickstart</artifactId>
@ -148,46 +148,46 @@
<version>${project.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jakarta-client</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jakarta-common</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jakarta-server</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jetty-api</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jetty-client</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jetty-common</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-jetty-server</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.eclipse.jetty.ee9.websocket</groupId>-->
<!-- <artifactId>jetty-ee9-websocket-servlet</artifactId>-->
<!-- <version>${project.version}</version>-->
<!-- </dependency>-->
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jakarta-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jakarta-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jakarta-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jetty-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jetty-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jetty-common</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-jetty-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.websocket</groupId>
<artifactId>jetty-ee9-websocket-servlet</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Jakarta EE 9 Dependencies -->
<!-- FIXME to review it is not sure to be a good idea to have this in the bom -->
<dependency>

View File

@ -121,12 +121,27 @@
<artifactId>jetty-ee9-websocket-jetty-client</artifactId>
<scope>test</scope>
</dependency>
<!-- sounds cyclic -->
<!--
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-home</artifactId>
<type>zip</type>
<scope>test</scope>
</dependency>
-->
<dependency>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>jetty-ee9-demo-jsp-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>jetty-ee9-demo-spec-webapp</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>

View File

@ -15,10 +15,11 @@ package org.eclipse.jetty.ee9.demos;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.server.Connector;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
public class ExampleServer
{
@ -35,7 +36,7 @@ public class ExampleServer
context.addServlet(HelloServlet.class, "/hello");
context.addServlet(AsyncEchoServlet.class, "/echo/*");
server.setHandler(new HandlerList(context, new DefaultHandler()));
server.setHandler(new Handler.Collection(context.getCoreContextHandler(), new DefaultHandler()));
return server;
}

View File

@ -15,6 +15,7 @@ package org.eclipse.jetty.ee9.demos;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
import org.eclipse.jetty.xml.XmlConfiguration;
/**
@ -26,7 +27,8 @@ public class ExampleServerXml
{
// Find Jetty XML (in classpath) that configures and starts Server.
// See src/main/resources/exampleserver.xml
Resource serverXml = Resource.newSystemResource("exampleserver.xml");
ResourceFactory.LifeCycle resourceFactory = ResourceFactory.lifecycle();
Resource serverXml = resourceFactory.newSystemResource("exampleserver.xml");
XmlConfiguration xml = new XmlConfiguration(serverXml);
xml.getProperties().put("http.port", Integer.toString(port));
Server server = (Server)xml.configure();

View File

@ -14,29 +14,20 @@
package org.eclipse.jetty.ee9.demos;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
import java.nio.channels.FileChannel.MapMode;
import java.nio.file.StandardOpenOption;
import jakarta.servlet.AsyncContext;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.ee9.servlet.DefaultServlet;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.server.HttpOutput;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.Callback;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* Fast FileServer.
@ -87,7 +78,7 @@ public class FastFileServer
server.join();
}
static class FastFileHandler extends AbstractHandler
static class FastFileHandler extends Handler.Abstract
{
private final MimeTypes mimeTypes = new MimeTypes();
private final File dir;
@ -98,119 +89,125 @@ public class FastFileServer
}
@Override
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
public Request.Processor handle(Request request) throws Exception
{
// define small medium and large.
// This should be turned for your content, JVM and OS, but we will
// huge HTTP response buffer size as a measure
final int SMALL = response.getBufferSize();
final int MEDIUM = 8 * SMALL;
// What file to serve?
final File file = new File(this.dir, request.getPathInfo());
// Only handle existing files
if (!file.exists())
return;
// we will handle this request
baseRequest.setHandled(true);
// Handle directories
if (file.isDirectory())
{
if (!request.getPathInfo().endsWith(URIUtil.SLASH))
{
response.sendRedirect(response.encodeRedirectURL(request.getRequestURI() + URIUtil.SLASH));
return;
}
String listing = Resource.newResource(file).getListHTML(
request.getRequestURI(),
request.getPathInfo().lastIndexOf("/") > 0,
request.getQueryString());
response.setContentType("text/html; charset=utf-8");
response.getWriter().println(listing);
return;
}
// Set some content headers.
// Jetty DefaultServlet will cache formatted date strings, but we
// will reformat for each request here
response.setDateHeader("Last-Modified", file.lastModified());
response.setContentLengthLong(file.length());
response.setContentType(mimeTypes.getMimeByExtension(file.getName()));
// send "small" files blocking directly from an input stream
if (file.length() < SMALL)
{
// need to caste to Jetty output stream for best API
((HttpOutput)response.getOutputStream())
.sendContent(FileChannel.open(file.toPath(),
StandardOpenOption.READ));
return;
}
// send not "small" files asynchronously so we don't hold threads if
// the client is slow
final AsyncContext async = request.startAsync();
Callback completionCB = new Callback()
{
@Override
public void succeeded()
{
// Async content write succeeded, so complete async response
async.complete();
}
@Override
public void failed(Throwable x)
{
// log error and complete async response;
x.printStackTrace();
async.complete();
}
@Override
public InvocationType getInvocationType()
{
return InvocationType.NON_BLOCKING;
}
};
// send "medium" files from an input stream
if (file.length() < MEDIUM)
{
// the file channel is closed by the async send
((HttpOutput)response.getOutputStream())
.sendContent(FileChannel.open(file.toPath(),
StandardOpenOption.READ), completionCB);
return;
}
// for "large" files get the file mapped buffer to send Typically
// the resulting buffer should be cached as allocating kernel memory
// can be hard to GC on some JVMs. But for this example we will
// create a new buffer per file
ByteBuffer buffer;
try (RandomAccessFile raf = new RandomAccessFile(file, "r");)
{
buffer = raf.getChannel().map(MapMode.READ_ONLY, 0,
raf.length());
}
// Assuming the file buffer might be shared cached version, so lets
// take our own view of it
buffer = buffer.asReadOnlyBuffer();
// send the content as a buffer with a callback to complete the
// async request need to caste to Jetty output stream for best API
((HttpOutput)response.getOutputStream()).sendContent(buffer,
completionCB);
return null;
// return (req, response, callback) ->
// {
// response.getHeaders().add(HttpHeader.CONTENT_TYPE, "text/html; charset=utf-8");
// response.setStatus(HttpServletResponse.SC_OK);
// response.write(true, BufferUtil.toBuffer("<h1>Hello World</h1>"), callback);
//
//
//
// // define small medium and large.
// // This should be turned for your content, JVM and OS, but we will
// // huge HTTP response buffer size as a measure
// final int SMALL = req.getBufferSize();
// final int MEDIUM = 8 * SMALL;
//
// // What file to serve?
// final File file = new File(this.dir, request.getPathInContext();
//
// // Only handle existing files
// if (!file.exists())
// return;
//
// // we will handle this request
// baseRequest.setHandled(true);
//
// // Handle directories
// if (file.isDirectory())
// {
// if (!request.getPathInfo().endsWith(URIUtil.SLASH))
// {
// response.sendRedirect(req.encodeRedirectURL(request.getRequestURI() + URIUtil.SLASH));
// return;
// }
// String listing = ResourceFactory.of(this).newResource(file.toPath()).getListHTML(
// request.getRequestURI(),
// request.getPathInfo().lastIndexOf("/") > 0,
// request.getQueryString());
// response.setContentType("text/html; charset=utf-8");
// response.getWriter().println(listing);
// return;
// }
//
// // Set some content headers.
//
// // Jetty DefaultServlet will cache formatted date strings, but we
// // will reformat for each request here
// response.setDateHeader("Last-Modified", file.lastModified());
// response.setContentLengthLong(file.length());
// response.setContentType(mimeTypes.getMimeByExtension(file.getName()));
//
// // send "small" files blocking directly from an input stream
// if (file.length() < SMALL)
// {
// // need to caste to Jetty output stream for best API
// ((HttpOutput)response.getOutputStream())
// .sendContent(FileChannel.open(file.toPath(),
// StandardOpenOption.READ));
// return;
// }
//
// // send not "small" files asynchronously so we don't hold threads if
// // the client is slow
// final AsyncContext async = request.startAsync();
// Callback completionCB = new Callback()
// {
// @Override
// public void succeeded()
// {
// // Async content write succeeded, so complete async response
// async.complete();
// }
//
// @Override
// public void failed(Throwable x)
// {
// // log error and complete async response;
// x.printStackTrace();
// async.complete();
// }
//
// @Override
// public InvocationType getInvocationType()
// {
// return InvocationType.NON_BLOCKING;
// }
// };
//
// // send "medium" files from an input stream
// if (file.length() < MEDIUM)
// {
// // the file channel is closed by the async send
// ((HttpOutput)response.getOutputStream())
// .sendContent(FileChannel.open(file.toPath(),
// StandardOpenOption.READ), completionCB);
// return;
// }
//
// // for "large" files get the file mapped buffer to send Typically
// // the resulting buffer should be cached as allocating kernel memory
// // can be hard to GC on some JVMs. But for this example we will
// // create a new buffer per file
// ByteBuffer buffer;
// try (RandomAccessFile raf = new RandomAccessFile(file, "r");)
// {
// buffer = raf.getChannel().map(MapMode.READ_ONLY, 0,
// raf.length());
// }
//
// // Assuming the file buffer might be shared cached version, so lets
// // take our own view of it
// buffer = buffer.asReadOnlyBuffer();
//
// // send the content as a buffer with a callback to complete the
// // async request need to caste to Jetty output stream for best API
// ((HttpOutput)response.getOutputStream()).sendContent(buffer,
// completionCB);
// };
}
}
}

View File

@ -16,12 +16,12 @@ package org.eclipse.jetty.ee9.demos;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* Simple Jetty FileServer.
@ -38,16 +38,16 @@ public class FileServer
// Create the ResourceHandler. It is the object that will actually handle the request for a given file. It is
// a Jetty Handler object so it is suitable for chaining with other handlers as you will see in other examples.
ResourceHandler resourceHandler = new ResourceHandler(_server);
ResourceHandler resourceHandler = new ResourceHandler();
// Configure the ResourceHandler. Setting the resource base indicates where the files should be served out of.
// In this example it is the current directory but it can be configured to anything that the jvm has access to.
resourceHandler.setDirectoriesListed(true);
resourceHandler.setWelcomeFiles(new String[]{"index.html"});
resourceHandler.setDirAllowed(true);
resourceHandler.setWelcomeFiles("index.html");
resourceHandler.setBaseResource(baseResource);
// Add the ResourceHandler to the server.
server.setHandler(new HandlerList(resourceHandler, new DefaultHandler()));
server.setHandler(new Handler.Collection(resourceHandler, new DefaultHandler()));
return server;
}
@ -56,7 +56,7 @@ public class FileServer
{
int port = ExampleUtil.getPort(args, "jetty.http.port", 8080);
Path userDir = Paths.get(System.getProperty("user.dir"));
PathResource pathResource = new PathResource(userDir);
Resource pathResource = ResourceFactory.root().newResource(userDir);
Server server = createServer(port, pathResource);

View File

@ -19,10 +19,13 @@ import java.io.PrintWriter;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.BufferUtil;
public class HelloHandler extends AbstractHandler
public class HelloHandler extends Handler.Abstract
{
final String greeting;
final String body;
@ -44,23 +47,20 @@ public class HelloHandler extends AbstractHandler
}
@Override
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
public Request.Processor handle(Request request) throws Exception
{
response.setContentType("text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
PrintWriter out = response.getWriter();
out.println("<h1>" + greeting + "</h1>");
if (body != null)
return (req, response, callback) ->
{
out.println(body);
}
response.getHeaders().add(HttpHeader.CONTENT_TYPE, "text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.write(true, BufferUtil.toBuffer("<h1>" + greeting + "</h1>"), callback);
if (body != null)
{
response.write(true, BufferUtil.toBuffer(body), callback);
}
};
baseRequest.setHandled(true);
}
}

View File

@ -13,35 +13,24 @@
package org.eclipse.jetty.ee9.demos;
import java.io.IOException;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.util.BufferUtil;
public class HelloWorld extends AbstractHandler
public class HelloWorld extends Handler.Abstract
{
@Override
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
public Request.Processor handle(Request request) throws Exception
{
// Declare response encoding and types
response.setContentType("text/html; charset=utf-8");
// Declare response status code
response.setStatus(HttpServletResponse.SC_OK);
// Write back response
response.getWriter().println("<h1>Hello World</h1>");
// Inform jetty that this request has now been handled
baseRequest.setHandled(true);
return (req, response, callback) ->
{
response.getHeaders().add(HttpHeader.CONTENT_TYPE, "text/html; charset=utf-8");
response.setStatus(HttpServletResponse.SC_OK);
response.write(true, BufferUtil.toBuffer("<h1>Hello World</h1>"), callback);
};
}
public static void main(String[] args) throws Exception

View File

@ -49,11 +49,11 @@ import org.eclipse.jetty.http2.server.HTTP2ServerConnectionFactory;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.util.resource.ResourceFactory;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.slf4j.LoggerFactory;
@ -76,7 +76,8 @@ public class Http2Server
if (!Files.exists(docroot))
throw new FileNotFoundException(docroot.toString());
context.setResourceBase(docroot);
// FIXME why
context.setBaseResource(ResourceFactory.of(server).newResource(docroot));
context.addFilter(PushCacheFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
// context.addFilter(PushSessionCacheFilter.class,"/*",EnumSet.of(DispatcherType.REQUEST));
context.addFilter(PushedTilesFilter.class, "/*", EnumSet.of(DispatcherType.REQUEST));
@ -139,14 +140,15 @@ public class Http2Server
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException
{
Request baseRequest = Request.getBaseRequest(request);
if (baseRequest.isPush() && baseRequest.getRequestURI().contains("tiles"))
{
String uri = baseRequest.getRequestURI().replace("tiles", "pushed").substring(baseRequest.getContextPath().length());
request.getRequestDispatcher(uri).forward(request, response);
return;
}
// TODO
// Request baseRequest = Request.getBaseRequest(request);
//
// if (baseRequest.isPush() && baseRequest.getRequestURI().contains("tiles"))
// {
// String uri = baseRequest.getRequestURI().replace("tiles", "pushed").substring(baseRequest.getContextPath().length());
// request.getRequestDispatcher(uri).forward(request, response);
// return;
// }
chain.doFilter(request, response);
}

View File

@ -14,17 +14,24 @@
package org.eclipse.jetty.ee9.demos;
import java.io.FileNotFoundException;
import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
import org.eclipse.jetty.ee9.servlet.DefaultServlet;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.util.FileID;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* Example of serving content from a JAR file.
@ -41,6 +48,8 @@ public class JarServer
baseUri = URIUtil.toJarFileUri(baseUri);
Server server = new Server(port);
// server.setDumpAfterStart(true);
// server.setDumpBeforeStop(true);
Resource baseResource = ResourceFactory.of(server).newResource(baseUri);
ServletContextHandler context = new ServletContextHandler();
@ -48,7 +57,7 @@ public class JarServer
ServletHolder defaultHolder = new ServletHolder("default", new DefaultServlet());
context.addServlet(defaultHolder, "/");
server.setHandler(new HandlerList(context, new DefaultHandler()));
server.setHandler(new Handler.Collection(context.getCoreContextHandler(), new DefaultHandler()));
return server;
}
@ -64,4 +73,4 @@ public class JarServer
server.start();
server.join();
}
}
}

View File

@ -55,7 +55,7 @@ public class JettyDemos
LOG.debug("JettyDemos(prop(user.dir)) = {}", working);
while (dir == null && working != null)
{
dir = asDirectory(working.resolve("demos").toString());
dir = asDirectory(working.resolve("jetty-ee9-demos").toString());
if (dir != null && Files.exists(dir.resolve("pom.xml")))
{
demosDir = dir;

View File

@ -13,213 +13,177 @@
package org.eclipse.jetty.ee9.demos;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.eclipse.jetty.deploy.DeploymentManager;
import org.eclipse.jetty.deploy.PropertiesConfigurationManager;
import org.eclipse.jetty.deploy.providers.WebAppProvider;
import org.eclipse.jetty.ee9.annotations.AnnotationConfiguration;
import org.eclipse.jetty.ee9.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.ee9.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.ee9.security.HashLoginService;
import org.eclipse.jetty.ee9.webapp.Configurations;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.io.ConnectionStatistics;
import org.eclipse.jetty.jmx.MBeanContainer;
import org.eclipse.jetty.rewrite.handler.InvalidURIRule;
import org.eclipse.jetty.rewrite.handler.RewriteHandler;
import org.eclipse.jetty.server.AsyncRequestLogWriter;
import org.eclipse.jetty.server.CustomRequestLog;
import org.eclipse.jetty.server.DebugListener;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.LowResourceMonitor;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.SslConnectionFactory;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.StatisticsHandler;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.util.thread.ScheduledExecutorScheduler;
/**
* Starts the Jetty Distribution's demo-base directory using entirely
* embedded jetty techniques.
*/
public class LikeJettyXml
{
public static Server createServer(int port, int securePort, boolean addDebugListener) throws Exception
{
Path configDir = Paths.get("src/main/resources/demo").toAbsolutePath();
Path runtimeDir = Paths.get("target/embedded/" + LikeJettyXml.class.getSimpleName()).toAbsolutePath();
mkdir(runtimeDir);
// === jetty.xml ===
// Setup Threadpool
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setMaxThreads(500);
// Server
Server server = new Server(threadPool);
// Scheduler
server.addBean(new ScheduledExecutorScheduler(null, false));
// HTTP Configuration
HttpConfiguration httpConfig = new HttpConfiguration();
httpConfig.setSecureScheme("https");
httpConfig.setSecurePort(securePort);
httpConfig.setOutputBufferSize(32768);
httpConfig.setRequestHeaderSize(8192);
httpConfig.setResponseHeaderSize(8192);
httpConfig.setSendServerVersion(true);
httpConfig.setSendDateHeader(false);
// httpConfig.addCustomizer(new ForwardedRequestCustomizer());
// Handler Structure
ContextHandlerCollection contexts = new ContextHandlerCollection();
server.setHandler(new HandlerList(contexts, new DefaultHandler()));
// === jetty-jmx.xml ===
MBeanContainer mbContainer = new MBeanContainer(
ManagementFactory.getPlatformMBeanServer());
server.addBean(mbContainer);
// === jetty-http.xml ===
ServerConnector http = new ServerConnector(server,
new HttpConnectionFactory(httpConfig));
http.setPort(port);
http.setIdleTimeout(30000);
server.addConnector(http);
// === jetty-https.xml ===
// SSL Context Factory
Path keystorePath = Paths.get("src/main/resources/etc/keystore.p12").toAbsolutePath();
if (!Files.exists(keystorePath))
throw new FileNotFoundException(keystorePath.toString());
SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
sslContextFactory.setKeyStorePath(keystorePath.toString());
sslContextFactory.setKeyStorePassword("storepwd");
sslContextFactory.setTrustStorePath(keystorePath.toString());
sslContextFactory.setTrustStorePassword("storepwd");
// SSL HTTP Configuration
HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
// SSL Connector
ServerConnector sslConnector = new ServerConnector(server,
new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
new HttpConnectionFactory(httpsConfig));
sslConnector.setPort(securePort);
server.addConnector(sslConnector);
// === jetty-deploy.xml ===
DeploymentManager deployer = new DeploymentManager();
if (addDebugListener)
{
DebugListener debug = new DebugListener(System.err, true, true, true);
server.addBean(debug);
deployer.addLifeCycleBinding(new DebugListenerBinding(debug));
}
deployer.setContexts(contexts);
deployer.setContextAttribute(
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
".*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*/jakarta.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");
Path webappsDir = runtimeDir.resolve("webapps");
mkdir(webappsDir);
Path testWebapp = webappsDir.resolve("test.war");
if (!Files.exists(testWebapp))
{
Path testWebappSrc = JettyDemos.find("demo-simple-webapp/target/demo-simple-webapp-@VER@.war");
Files.copy(testWebappSrc, testWebapp);
}
WebAppProvider webAppProvider = new WebAppProvider();
webAppProvider.setMonitoredDirName(webappsDir.toString());
webAppProvider.setDefaultsDescriptor(configDir.resolve("webdefault-ee9.xml").toString());
webAppProvider.setScanInterval(1);
webAppProvider.setExtractWars(true);
webAppProvider.setConfigurationManager(new PropertiesConfigurationManager());
deployer.addAppProvider(webAppProvider);
server.addBean(deployer);
// === setup jetty plus ==
Configurations.setServerDefault(server).add(new EnvConfiguration(), new PlusConfiguration(), new AnnotationConfiguration());
// === jetty-stats.xml ===
StatisticsHandler stats = new StatisticsHandler();
stats.setHandler(server.getHandler());
server.setHandler(stats);
server.addBeanToAllConnectors(new ConnectionStatistics());
// === Rewrite Handler
RewriteHandler rewrite = new RewriteHandler();
rewrite.setHandler(server.getHandler());
server.setHandler(rewrite);
rewrite.addRule(new InvalidURIRule());
// === jetty-requestlog.xml ===
Path logsDir = runtimeDir.resolve("logs");
mkdir(logsDir);
AsyncRequestLogWriter logWriter = new AsyncRequestLogWriter(logsDir.resolve("yyyy_mm_dd.request.log").toString());
logWriter.setFilenameDateFormat("yyyy_MM_dd");
logWriter.setRetainDays(90);
logWriter.setTimeZone("GMT");
CustomRequestLog requestLog = new CustomRequestLog(logWriter, CustomRequestLog.EXTENDED_NCSA_FORMAT + " \"%C\"");
server.setRequestLog(requestLog);
// === jetty-lowresources.xml ===
LowResourceMonitor lowResourcesMonitor = new LowResourceMonitor(server);
lowResourcesMonitor.setPeriod(1000);
lowResourcesMonitor.setLowResourcesIdleTimeout(200);
lowResourcesMonitor.setMonitorThreads(true);
lowResourcesMonitor.setMaxMemory(0);
lowResourcesMonitor.setMaxLowResourcesTime(5000);
server.addBean(lowResourcesMonitor);
// === test-realm.xml ===
HashLoginService login = new HashLoginService();
login.setName("Test Realm");
login.setConfig(configDir.resolve("demo-realm.properties").toString());
login.setHotReload(false);
server.addBean(login);
return server;
}
private static void mkdir(Path path) throws IOException
{
if (Files.exists(path))
return;
Files.createDirectories(path);
}
public static void main(String[] args) throws Exception
{
int port = ExampleUtil.getPort(args, "jetty.http.port", 8080);
int securePort = ExampleUtil.getPort(args, "jetty.https.port", 8443);
Server server = createServer(port, securePort, true);
// Extra options
server.setDumpAfterStart(true);
server.setDumpBeforeStop(false);
server.setStopAtShutdown(true);
// Start the server
server.start();
server.join();
}
// TODO
// FIXME
// public static Server createServer(int port, int securePort, boolean addDebugListener) throws Exception
// {
// Path configDir = Paths.get("src/main/resources/demo").toAbsolutePath();
// Path runtimeDir = Paths.get("target/embedded/" + LikeJettyXml.class.getSimpleName()).toAbsolutePath();
// mkdir(runtimeDir);
//
// // === jetty.xml ===
// // Setup Threadpool
// QueuedThreadPool threadPool = new QueuedThreadPool();
// threadPool.setMaxThreads(500);
//
// // Server
// Server server = new Server(threadPool);
//
// // Scheduler
// server.addBean(new ScheduledExecutorScheduler(null, false));
//
// // HTTP Configuration
// HttpConfiguration httpConfig = new HttpConfiguration();
// httpConfig.setSecureScheme("https");
// httpConfig.setSecurePort(securePort);
// httpConfig.setOutputBufferSize(32768);
// httpConfig.setRequestHeaderSize(8192);
// httpConfig.setResponseHeaderSize(8192);
// httpConfig.setSendServerVersion(true);
// httpConfig.setSendDateHeader(false);
// // httpConfig.addCustomizer(new ForwardedRequestCustomizer());
//
// // Handler Structure
// ContextHandlerCollection contexts = new ContextHandlerCollection();
// server.setHandler(new HandlerList(contexts, new DefaultHandler()));
//
// // === jetty-jmx.xml ===
// MBeanContainer mbContainer = new MBeanContainer(
// ManagementFactory.getPlatformMBeanServer());
// server.addBean(mbContainer);
//
// // === jetty-http.xml ===
// ServerConnector http = new ServerConnector(server,
// new HttpConnectionFactory(httpConfig));
// http.setPort(port);
// http.setIdleTimeout(30000);
// server.addConnector(http);
//
// // === jetty-https.xml ===
// // SSL Context Factory
// Path keystorePath = Paths.get("src/main/resources/etc/keystore.p12").toAbsolutePath();
// if (!Files.exists(keystorePath))
// throw new FileNotFoundException(keystorePath.toString());
// SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
// sslContextFactory.setKeyStorePath(keystorePath.toString());
// sslContextFactory.setKeyStorePassword("storepwd");
// sslContextFactory.setTrustStorePath(keystorePath.toString());
// sslContextFactory.setTrustStorePassword("storepwd");
//
// // SSL HTTP Configuration
// HttpConfiguration httpsConfig = new HttpConfiguration(httpConfig);
// httpsConfig.addCustomizer(new SecureRequestCustomizer());
//
// // SSL Connector
// ServerConnector sslConnector = new ServerConnector(server,
// new SslConnectionFactory(sslContextFactory, HttpVersion.HTTP_1_1.asString()),
// new HttpConnectionFactory(httpsConfig));
// sslConnector.setPort(securePort);
// server.addConnector(sslConnector);
//
// // === jetty-deploy.xml ===
// DeploymentManager deployer = new DeploymentManager();
// if (addDebugListener)
// {
// DebugListener debug = new DebugListener(System.err, true, true, true);
// server.addBean(debug);
// deployer.addLifeCycleBinding(new DebugListenerBinding(debug));
// }
// deployer.setContexts(contexts);
// deployer.setContextAttribute(
// "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
// ".*/jetty-jakarta-servlet-api-[^/]*\\.jar$|.*/jakarta.servlet.jsp.jstl-.*\\.jar$|.*/[^/]*taglibs.*\\.jar$");
//
// Path webappsDir = runtimeDir.resolve("webapps");
// mkdir(webappsDir);
//
// Path testWebapp = webappsDir.resolve("test.war");
// if (!Files.exists(testWebapp))
// {
// Path testWebappSrc = JettyDemos.find("demo-simple-webapp/target/demo-simple-webapp-@VER@.war");
// Files.copy(testWebappSrc, testWebapp);
// }
//
// WebAppProvider webAppProvider = new WebAppProvider();
// webAppProvider.setMonitoredDirName(webappsDir.toString());
// webAppProvider.setDefaultsDescriptor(configDir.resolve("webdefault-ee9.xml").toString());
// webAppProvider.setScanInterval(1);
// webAppProvider.setExtractWars(true);
// webAppProvider.setConfigurationManager(new PropertiesConfigurationManager());
//
// deployer.addAppProvider(webAppProvider);
// server.addBean(deployer);
//
// // === setup jetty plus ==
// Configurations.setServerDefault(server).add(new EnvConfiguration(), new PlusConfiguration(), new AnnotationConfiguration());
//
// // === jetty-stats.xml ===
// StatisticsHandler stats = new StatisticsHandler();
// stats.setHandler(server.getHandler());
// server.setHandler(stats);
// server.addBeanToAllConnectors(new ConnectionStatistics());
//
// // === Rewrite Handler
// RewriteHandler rewrite = new RewriteHandler();
// rewrite.setHandler(server.getHandler());
// server.setHandler(rewrite);
// rewrite.addRule(new InvalidURIRule());
//
// // === jetty-requestlog.xml ===
// Path logsDir = runtimeDir.resolve("logs");
// mkdir(logsDir);
// AsyncRequestLogWriter logWriter = new AsyncRequestLogWriter(logsDir.resolve("yyyy_mm_dd.request.log").toString());
// logWriter.setFilenameDateFormat("yyyy_MM_dd");
// logWriter.setRetainDays(90);
// logWriter.setTimeZone("GMT");
// CustomRequestLog requestLog = new CustomRequestLog(logWriter, CustomRequestLog.EXTENDED_NCSA_FORMAT + " \"%C\"");
// server.setRequestLog(requestLog);
//
// // === jetty-lowresources.xml ===
// LowResourceMonitor lowResourcesMonitor = new LowResourceMonitor(server);
// lowResourcesMonitor.setPeriod(1000);
// lowResourcesMonitor.setLowResourcesIdleTimeout(200);
// lowResourcesMonitor.setMonitorThreads(true);
// lowResourcesMonitor.setMaxMemory(0);
// lowResourcesMonitor.setMaxLowResourcesTime(5000);
// server.addBean(lowResourcesMonitor);
//
// // === test-realm.xml ===
// HashLoginService login = new HashLoginService();
// login.setName("Test Realm");
// login.setConfig(configDir.resolve("demo-realm.properties").toString());
// login.setHotReload(false);
// server.addBean(login);
//
// return server;
// }
//
// private static void mkdir(Path path) throws IOException
// {
// if (Files.exists(path))
// return;
// Files.createDirectories(path);
// }
//
// public static void main(String[] args) throws Exception
// {
// int port = ExampleUtil.getPort(args, "jetty.http.port", 8080);
// int securePort = ExampleUtil.getPort(args, "jetty.https.port", 8443);
// Server server = createServer(port, securePort, true);
//
// // Extra options
// server.setDumpAfterStart(true);
// server.setDumpBeforeStop(false);
// server.setStopAtShutdown(true);
//
// // Start the server
// server.start();
// server.join();
// }
}

View File

@ -13,6 +13,8 @@
package org.eclipse.jetty.ee9.demos;
import java.util.List;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
@ -34,7 +36,7 @@ public class ManyContexts
contextIT.setHandler(new HelloHandler("Buongiorno"));
ContextHandler contextV = new ContextHandler("/");
contextV.setVirtualHosts(new String[]{"127.0.0.2"});
contextV.setVirtualHosts(List.of("127.0.0.2"));
contextV.setHandler(new HelloHandler("Virtual Hello"));
ContextHandlerCollection contexts = new ContextHandlerCollection(

View File

@ -16,23 +16,19 @@ package org.eclipse.jetty.ee9.demos;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Map;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.server.CustomRequestLog;
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.AbstractHandler;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.handler.gzip.GzipHandler;
import org.eclipse.jetty.util.BufferUtil;
import org.eclipse.jetty.util.ajax.JSON;
/**
@ -47,16 +43,16 @@ import org.eclipse.jetty.util.ajax.JSON;
* </ul>
* Multiple handlers may be combined with:
* <ul>
* <li>{@link HandlerWrapper} which will nest one handler inside another. In
* <li>{@link Handler.Wrapper} which will nest one handler inside another. In
* this example, the HelloHandler is nested inside a HandlerWrapper that sets
* the greeting as a request attribute.
* <li>{@link HandlerList} which will call a collection of handlers until the
* <li>{@link Handler.Collection} which will call a collection of handlers until the
* request is marked as handled. In this example, a list is used to combine the
* param handler (which only handles the request if there are parameters) and
* the wrapper handler. Frequently handler lists are terminated with the
* {@link DefaultHandler}, which will generate a suitable 404 response if the
* request has not been handled.
* <li>{@link HandlerCollection} which will call each handler regardless if the
* <li>{@link org.eclipse.jetty.ee9.nested.HandlerCollection} which will call each handler regardless if the
* request has been handled or not. Typically this is used to always pass a
* request to the logging handler.
* </ul>
@ -66,39 +62,34 @@ public class ManyHandlers
/**
* Produce output that lists all of the request parameters
*/
public static class ParamHandler extends AbstractHandler
public static class ParamHandler extends Handler.Abstract
{
@Override
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
public Request.Processor handle(Request request) throws Exception
{
Map<String, String[]> params = request.getParameterMap();
if (!params.isEmpty())
return (req, response, callback) ->
{
response.setContentType("text/plain");
response.getWriter().println(new JSON().toJSON(params));
baseRequest.setHandled(true);
}
response.getHeaders().add(HttpHeader.CONTENT_TYPE, "text/plain");
response.setStatus(HttpServletResponse.SC_OK);
response.write(true, BufferUtil.toBuffer(new JSON().toJSON(req.getAttributeNameSet())), callback);
};
}
}
/**
* Add a request attribute, but produce no output.
*/
public static class WelcomeWrapHandler extends HandlerWrapper
public static class WelcomeWrapHandler extends Handler.Wrapper
{
@Override
public void handle(String target,
Request baseRequest,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException
public Request.Processor handle(Request request) throws Exception
{
response.setHeader("X-Welcome", "Greetings from WelcomeWrapHandler");
super.handle(target, baseRequest, request, response);
Request.Processor processor = super.handle(request);
if (processor == null)
return null;
return (rq, rs, cb) -> rs.getHeaders().add(HttpHeader.CONTENT_TYPE, "text/plain");
}
}
@ -108,7 +99,7 @@ public class ManyHandlers
// create the handlers
Handler param = new ParamHandler();
HandlerWrapper wrapper = new WelcomeWrapHandler();
Handler.Wrapper wrapper = new WelcomeWrapHandler();
Handler hello = new HelloHandler();
GzipHandler gzipHandler = new GzipHandler();
gzipHandler.setMinGzipSize(10);
@ -121,7 +112,7 @@ public class ManyHandlers
server.setRequestLog(ncsaLog);
// create the handlers list
HandlerList handlers = new HandlerList();
Handler.Collection handlers = new Handler.Collection();
// wrap contexts around specific handlers
wrapper.setHandler(hello);
@ -140,6 +131,7 @@ public class ManyHandlers
handlers.addHandler(gzipHandler);
handlers.addHandler(new DefaultHandler());
server.setHandler(handlers);
server.setDumpAfterStart(true);
/* At this point you have the following handler hierarchy.
*

View File

@ -18,7 +18,7 @@ import java.io.IOException;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.eclipse.jetty.ee9.servlet.ServletHandler;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.server.Server;
public class MinimalServlets
@ -34,7 +34,7 @@ public class MinimalServlets
// The ServletHandler is a dead simple way to create a context handler
// that is backed by an instance of a Servlet.
// This handler then needs to be registered with the Server object.
ServletHandler handler = new ServletHandler();
ServletContextHandler handler = new ServletContextHandler();
server.setHandler(handler);
// Passing in the class for the Servlet allows jetty to instantiate an
@ -43,7 +43,7 @@ public class MinimalServlets
// IMPORTANT:
// This is a raw Servlet, not a Servlet that has been configured
// through a web.xml @WebServlet annotation, or anything similar.
handler.addServletWithMapping(HelloServlet.class, "/*");
handler.getServletHandler().addServletWithMapping(HelloServlet.class, "/*");
return server;
}
@ -62,7 +62,6 @@ public class MinimalServlets
server.join();
}
@SuppressWarnings("serial")
public static class HelloServlet extends HttpServlet
{
@Override

View File

@ -34,8 +34,8 @@ import org.eclipse.jetty.ee9.servlet.ListenerHolder;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
import static jakarta.servlet.DispatcherType.ASYNC;
import static jakarta.servlet.DispatcherType.REQUEST;
@ -78,7 +78,7 @@ public class OneServletContext
int port = ExampleUtil.getPort(args, "jetty.http.port", 8080);
Path tempDir = Paths.get(System.getProperty("java.io.tmpdir"));
Server server = createServer(port, new PathResource(tempDir));
Server server = createServer(port, ResourceFactory.root().newResource(tempDir));
server.start();
server.dumpStdErr();

View File

@ -16,14 +16,15 @@ package org.eclipse.jetty.ee9.demos;
import java.nio.file.Path;
import java.nio.file.Paths;
import org.eclipse.jetty.ee9.nested.SessionHandler;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.session.DefaultSessionCache;
import org.eclipse.jetty.session.NullSessionDataStore;
import org.eclipse.jetty.session.SessionCache;
import org.eclipse.jetty.session.SessionHandler;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
public class OneServletContextWithSession
{
@ -48,7 +49,7 @@ public class OneServletContextWithSession
// simpler to use SessionCacheFactory and/or
// SessionDataStoreFactory instances set as beans on
// the server.
SessionCache cache = new DefaultSessionCache(sessions);
SessionCache cache = new DefaultSessionCache(sessions.getSessionManager());
cache.setSessionDataStore(new NullSessionDataStore());
sessions.setSessionCache(cache);
@ -62,7 +63,7 @@ public class OneServletContextWithSession
{
int port = ExampleUtil.getPort(args, "jetty.http.port", 8080);
Path dir = Paths.get(System.getProperty("user.dir"));
PathResource baseResource = new PathResource(dir);
Resource baseResource = ResourceFactory.root().newResource(dir);
Server server = createServer(port, baseResource);
server.start();

View File

@ -21,7 +21,6 @@ import org.eclipse.jetty.ee9.security.HashLoginService;
import org.eclipse.jetty.ee9.webapp.WebAppContext;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
public class OneWebAppWithJsp
{
@ -45,7 +44,7 @@ public class OneWebAppWithJsp
// the webapp will unpack itself.
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
Path warFile = JettyDemos.find("demo-jsp-webapp/target/demo-jsp-webapp-@VER@.war");
Path warFile = JettyDemos.find("jetty-ee9-demo-jsp-webapp/target/jetty-ee9-demo-jsp-webapp-@VER@.war");
webapp.setWarResource(webapp.getResourceFactory().newResource(warFile));
webapp.setExtractWAR(true);

View File

@ -13,10 +13,10 @@
package org.eclipse.jetty.ee9.demos;
import org.eclipse.jetty.ee9.proxy.ConnectHandler;
import org.eclipse.jetty.ee9.proxy.ProxyServlet;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;
import org.eclipse.jetty.server.ConnectHandler;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;

View File

@ -22,6 +22,8 @@ import org.eclipse.jetty.ee9.security.ConstraintSecurityHandler;
import org.eclipse.jetty.ee9.security.HashLoginService;
import org.eclipse.jetty.ee9.security.LoginService;
import org.eclipse.jetty.ee9.security.authentication.BasicAuthenticator;
import org.eclipse.jetty.ee9.servlet.ServletContextHandler;
import org.eclipse.jetty.ee9.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
@ -53,6 +55,9 @@ public class SecuredHelloHandler
LoginService loginService = new HashLoginService("MyRealm", realmResource);
server.addBean(loginService);
ServletContextHandler context = new ServletContextHandler();
server.setHandler(context);
// A security handler is a jetty handler that secures content behind a
// particular portion of a url space. The ConstraintSecurityHandler is a
// more specialized handler that allows matching of urls to different
@ -60,7 +65,7 @@ public class SecuredHelloHandler
// effectively applying these constraints to all subsequent handlers in
// the chain.
ConstraintSecurityHandler security = new ConstraintSecurityHandler();
server.setHandler(security);
context.setSecurityHandler(security);
// This constraint requires authentication and in addition that an
// authenticated user be a member of a given set of roles for
@ -87,13 +92,9 @@ public class SecuredHelloHandler
security.setAuthenticator(new BasicAuthenticator());
security.setLoginService(loginService);
// The Hello Handler is the handler we are securing so we create one,
// and then set it as the handler on the
// security handler to complain the simple handler chain.
HelloHandler hh = new HelloHandler();
// chain the hello handler into the security handler
security.setHandler(hh);
ServletHolder holder = new ServletHolder();
holder.setServlet(new HelloServlet("Hello World"));
context.getServletHandler().addServletWithMapping(holder, "/");
return server;
}

View File

@ -47,7 +47,8 @@ public class ServerWithAnnotations
webapp.addConfiguration(new EnvConfiguration(), new PlusConfiguration(), new AnnotationConfiguration());
webapp.setContextPath("/");
Path warFile = JettyDemos.find("ee9-demo-spec/ee9-demo-spec-webapp/target/ee9-demo-spec-webapp-@VER@.war");
Path warFile = JettyDemos.find("jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/target/jetty-ee9-demo-spec-webapp-@VER@.war");
webapp.setWar(warFile.toString());
webapp.setAttribute(
"org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern",
@ -56,7 +57,7 @@ public class ServerWithAnnotations
// Register new transaction manager in JNDI
// At runtime, the webapp accesses this as java:comp/UserTransaction
new Transaction(new org.example.MockUserTransaction());
new Transaction("ee9", new org.example.MockUserTransaction());
// Define an env entry with webapp scope.
// THIS ENTRY IS OVERRIDDEN BY THE ENTRY IN jetty-env.xml

View File

@ -21,7 +21,7 @@ import org.eclipse.jetty.ee9.plus.webapp.EnvConfiguration;
import org.eclipse.jetty.ee9.plus.webapp.PlusConfiguration;
import org.eclipse.jetty.ee9.webapp.WebAppContext;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* ServerWithJNDI
@ -36,8 +36,8 @@ public class ServerWithJNDI
// Create a WebApp
WebAppContext webapp = new WebAppContext();
webapp.setContextPath("/");
Path testJndiWar = JettyDemos.find("demo-jndi-webapp/target/demo-jndi-webapp-@VER@.war");
webapp.setWarResource(new PathResource(testJndiWar));
Path testJndiWar = JettyDemos.find("jetty-ee9-demo-jndi-webapp/target/jetty-ee9-demo-jndi-webapp-@VER@.war");
webapp.setWarResource(ResourceFactory.of(webapp).newResource(testJndiWar));
server.setHandler(webapp);
// Enable parsing of jndi-related parts of web.xml and jetty-env.xml

View File

@ -20,8 +20,8 @@ import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.resource.PathResource;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.resource.ResourceFactory;
/**
* A {@link ContextHandlerCollection} handler may be used to direct a request to
@ -49,7 +49,7 @@ public class SplitFileServer
// directory, you needn't use these, you simply need to supply the paths
// you are looking to serve content from.
ResourceHandler rh0 = new ResourceHandler();
rh0.setDirectoriesListed(false);
rh0.setDirAllowed(false);
ContextHandler context0 = new ContextHandler();
context0.setContextPath("/");
@ -59,7 +59,7 @@ public class SplitFileServer
// Rinse and repeat the previous item, only specifying a different
// resource base.
ResourceHandler rh1 = new ResourceHandler();
rh1.setDirectoriesListed(false);
rh1.setDirAllowed(false);
ContextHandler context1 = new ContextHandler();
context1.setContextPath("/");
@ -79,8 +79,8 @@ public class SplitFileServer
public static void main(String[] args) throws Exception
{
int port = ExampleUtil.getPort(args, "jetty.http.port", 8080);
Resource resource0 = new PathResource(Paths.get("src/test/resources/dir0"));
Resource resource1 = new PathResource(Paths.get("src/test/resources/dir1"));
Resource resource0 = ResourceFactory.root().newResource(Paths.get("src/test/resources/dir0"));
Resource resource1 = ResourceFactory.root().newResource(Paths.get("src/test/resources/dir1"));
Server server = createServer(port, resource0, resource1);

Some files were not shown because too many files have changed in this diff Show More