Skip to content

Commit 521015e

Browse files
authored
Upgrade to Jetty 12
Signed-off-by: Steffen Nießing <zuniquex@protonmail.com>
1 parent 7aa69fa commit 521015e

File tree

157 files changed

+5995
-545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+5995
-545
lines changed

archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/pom.xml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@
3838
</dependency> -->
3939

4040
<dependency>
41-
<groupId>org.eclipse.jetty</groupId>
42-
<artifactId>jetty-servlet</artifactId>
41+
<groupId>org.eclipse.jetty.ee10</groupId>
42+
<artifactId>jetty-ee10-servlet</artifactId>
4343
<version>\${jetty.version}</version>
4444
<scope>provided</scope>
4545
</dependency>
4646
<dependency>
47-
<groupId>org.eclipse.jetty</groupId>
48-
<artifactId>jetty-webapp</artifactId>
47+
<groupId>org.eclipse.jetty.ee10</groupId>
48+
<artifactId>jetty-ee10-webapp</artifactId>
4949
<version>\${jetty.version}</version>
5050
<scope>provided</scope>
5151
</dependency>
@@ -89,8 +89,8 @@
8989
</executions>
9090
</plugin>
9191
<plugin>
92-
<groupId>org.eclipse.jetty</groupId>
93-
<artifactId>jetty-maven-plugin</artifactId>
92+
<groupId>org.eclipse.jetty.ee10</groupId>
93+
<artifactId>jetty-ee10-maven-plugin</artifactId>
9494
<version>\${jetty.version}</version>
9595
<configuration>
9696
<contextPath>/</contextPath>
@@ -117,7 +117,7 @@
117117

118118
<properties>
119119
<jersey.version>${project.version}</jersey.version>
120-
<jetty.version>11.0.15</jetty.version>
120+
<jetty.version>12.0.0</jetty.version>
121121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
122122
<surefire.mvn.plugin.version>3.1.2</surefire.mvn.plugin.version>
123123
<war.mvn.plugin.version>3.4.0</war.mvn.plugin.version>

archetypes/jersey-heroku-webapp/src/main/resources/archetype-resources/src/main/java/heroku/Main.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package ${package}.heroku;
22

33
import org.eclipse.jetty.server.Server;
4-
import org.eclipse.jetty.webapp.WebAppContext;
4+
import org.eclipse.jetty.ee10.webapp.WebAppContext;
55

66
/**
77
* This class launches the web application in an embedded Jetty container. This is the entry point to your application. The Java
@@ -30,7 +30,7 @@ public static void main(String[] args) throws Exception{
3030

3131
final String webappDirLocation = "src/main/webapp/";
3232
root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
33-
root.setResourceBase(webappDirLocation);
33+
root.setBaseResourceAsString(webappDirLocation);
3434

3535
server.setHandler(root);
3636

bom/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@
8888
<artifactId>jersey-jetty-connector</artifactId>
8989
<version>${project.version}</version>
9090
</dependency>
91+
<dependency>
92+
<groupId>org.glassfish.jersey.connectors</groupId>
93+
<artifactId>jersey-jetty11-connector</artifactId>
94+
<version>${project.version}</version>
95+
</dependency>
9196
<dependency>
9297
<groupId>org.glassfish.jersey.connectors</groupId>
9398
<artifactId>jersey-jdk-connector</artifactId>

connectors/jetty-connector/pom.xml

Lines changed: 144 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434

3535
<properties>
3636
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
37+
<java11.build.outputDirectory>${project.basedir}/target</java11.build.outputDirectory>
38+
<java11.sourceDirectory>${project.basedir}/src/main/java11</java11.sourceDirectory>
39+
<java17.build.outputDirectory>${project.basedir}/target17</java17.build.outputDirectory>
40+
<java17.sourceDirectory>${project.basedir}/src/main/java17</java17.sourceDirectory>
3741
</properties>
3842

3943
<dependencies>
@@ -47,16 +51,6 @@
4751
</exclusion>
4852
</exclusions>
4953
</dependency>
50-
<dependency>
51-
<groupId>org.eclipse.jetty</groupId>
52-
<artifactId>jetty-util</artifactId>
53-
<exclusions>
54-
<exclusion>
55-
<groupId>org.slf4j</groupId>
56-
<artifactId>slf4j-api</artifactId>
57-
</exclusion>
58-
</exclusions>
59-
</dependency>
6054

6155
<dependency>
6256
<groupId>org.glassfish.jersey.media</groupId>
@@ -125,4 +119,144 @@
125119
</plugin>
126120
</plugins>
127121
</build>
122+
123+
<profiles>
124+
<profile>
125+
<id>JettyExclude</id>
126+
<activation>
127+
<jdk>[11,17)</jdk>
128+
</activation>
129+
<properties>
130+
<jetty.version>${jetty11.version}</jetty.version>
131+
</properties>
132+
<build>
133+
<directory>${java11.build.outputDirectory}</directory>
134+
<plugins>
135+
<plugin>
136+
<groupId>org.codehaus.mojo</groupId>
137+
<artifactId>build-helper-maven-plugin</artifactId>
138+
<executions>
139+
<execution>
140+
<phase>generate-sources</phase>
141+
<goals>
142+
<goal>add-source</goal>
143+
</goals>
144+
<configuration>
145+
<sources>
146+
<source>${java11.sourceDirectory}</source>
147+
</sources>
148+
</configuration>
149+
</execution>
150+
</executions>
151+
</plugin>
152+
<plugin>
153+
<groupId>org.apache.maven.plugins</groupId>
154+
<artifactId>maven-compiler-plugin</artifactId>
155+
<configuration>
156+
<testExcludes>
157+
<testExclude>org/glassfish/jersey/jetty/connector/*.java</testExclude>
158+
</testExcludes>
159+
</configuration>
160+
</plugin>
161+
</plugins>
162+
</build>
163+
</profile>
164+
<profile>
165+
<id>JettyInclude</id>
166+
<activation>
167+
<jdk>[17,)</jdk>
168+
</activation>
169+
<build>
170+
<directory>${java17.build.outputDirectory}</directory>
171+
<plugins>
172+
<plugin>
173+
<groupId>org.codehaus.mojo</groupId>
174+
<artifactId>build-helper-maven-plugin</artifactId>
175+
<executions>
176+
<execution>
177+
<phase>generate-sources</phase>
178+
<goals>
179+
<goal>add-source</goal>
180+
</goals>
181+
<configuration>
182+
<sources>
183+
<source>${java17.sourceDirectory}</source>
184+
</sources>
185+
</configuration>
186+
</execution>
187+
</executions>
188+
</plugin>
189+
</plugins>
190+
</build>
191+
</profile>
192+
<profile>
193+
<id>copyJDK17FilesToMultiReleaseJar</id>
194+
<activation>
195+
<file>
196+
<!-- ${java17.build.outputDirectory} does not work here -->
197+
<exists>target17/classes/org/glassfish/jersey/jetty/connector/JettyConnector.class</exists>
198+
</file>
199+
<jdk>[11,17)</jdk>
200+
</activation>
201+
<build>
202+
<plugins>
203+
<plugin>
204+
<groupId>org.apache.felix</groupId>
205+
<artifactId>maven-bundle-plugin</artifactId>
206+
<inherited>true</inherited>
207+
<extensions>true</extensions>
208+
<configuration>
209+
<instructions>
210+
<Multi-Release>true</Multi-Release>
211+
</instructions>
212+
</configuration>
213+
</plugin>
214+
<plugin>
215+
<groupId>org.apache.maven.plugins</groupId>
216+
<artifactId>maven-resources-plugin</artifactId>
217+
<inherited>true</inherited>
218+
<executions>
219+
<execution>
220+
<id>copy-jdk17-classes</id>
221+
<phase>prepare-package</phase>
222+
<goals>
223+
<goal>copy-resources</goal>
224+
</goals>
225+
<configuration>
226+
<outputDirectory>${java11.build.outputDirectory}/classes/META-INF/versions/17</outputDirectory>
227+
<resources>
228+
<resource>
229+
<directory>${java17.build.outputDirectory}/classes</directory>
230+
</resource>
231+
</resources>
232+
</configuration>
233+
</execution>
234+
</executions>
235+
</plugin>
236+
<plugin>
237+
<groupId>org.apache.maven.plugins</groupId>
238+
<artifactId>maven-antrun-plugin</artifactId>
239+
<executions>
240+
<execution>
241+
<id>copy-jdk17-sources</id>
242+
<phase>package</phase>
243+
<configuration>
244+
<target>
245+
<property name="sources-jar" value="${java11.build.outputDirectory}/${project.artifactId}-${project.version}-sources.jar"/>
246+
<echo>sources-jar: ${sources-jar}</echo>
247+
<zip destfile="${sources-jar}" update="true">
248+
<zipfileset dir="${java17.sourceDirectory}" prefix="META-INF/versions/17"/>
249+
</zip>
250+
</target>
251+
</configuration>
252+
<goals>
253+
<goal>run</goal>
254+
</goals>
255+
</execution>
256+
</executions>
257+
</plugin>
258+
</plugins>
259+
</build>
260+
</profile>
261+
</profiles>
128262
</project>
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright (c) 2013, 2023 Oracle and/or its affiliates. All rights reserved.
3+
*
4+
* This program and the accompanying materials are made available under the
5+
* terms of the Eclipse Public License v. 2.0, which is available at
6+
* http://www.eclipse.org/legal/epl-2.0.
7+
*
8+
* This Source Code may also be made available under the following Secondary
9+
* Licenses when the conditions for such availability set forth in the
10+
* Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
11+
* version 2 with the GNU Classpath Exception, which is available at
12+
* https://www.gnu.org/software/classpath/license.html.
13+
*
14+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15+
*/
16+
17+
package org.glassfish.jersey.jetty.connector;
18+
19+
import jakarta.ws.rs.ProcessingException;
20+
import jakarta.ws.rs.client.Client;
21+
import jakarta.ws.rs.core.Configuration;
22+
import org.glassfish.jersey.client.spi.Connector;
23+
import org.glassfish.jersey.client.spi.ConnectorProvider;
24+
25+
/**
26+
* A {@link ConnectorProvider} for Jersey {@link Connector connector}
27+
* instances that utilize the Jetty HTTP Client to send and receive
28+
* HTTP request and responses.
29+
* <p>
30+
* The following connector configuration properties are supported:
31+
* <ul>
32+
* <li>{@link org.glassfish.jersey.client.ClientProperties#ASYNC_THREADPOOL_SIZE}</li>
33+
* <li>{@link org.glassfish.jersey.client.ClientProperties#CONNECT_TIMEOUT}</li>
34+
* <li>{@link org.glassfish.jersey.client.ClientProperties#FOLLOW_REDIRECTS}</li>
35+
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_URI}</li>
36+
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_USERNAME}</li>
37+
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_PASSWORD}</li>
38+
* <li>{@link org.glassfish.jersey.client.ClientProperties#PROXY_PASSWORD}</li>
39+
* <li>{@link JettyClientProperties#DISABLE_COOKIES}</li>*
40+
* <li>{@link JettyClientProperties#ENABLE_SSL_HOSTNAME_VERIFICATION}</li>
41+
* <li>{@link JettyClientProperties#PREEMPTIVE_BASIC_AUTHENTICATION}</li>
42+
* <li>{@link JettyClientProperties#SYNC_LISTENER_RESPONSE_MAX_SIZE}</li>
43+
* </ul>
44+
* </p>
45+
* <p>
46+
* This transport supports both synchronous and asynchronous processing of client requests.
47+
* The following methods are supported: GET, POST, PUT, DELETE, HEAD, OPTIONS, TRACE, CONNECT and MOVE.
48+
* </p>
49+
* <p>
50+
* Typical usage:
51+
* </p>
52+
* <pre>
53+
* {@code
54+
* ClientConfig config = new ClientConfig();
55+
* config.connectorProvider(new JettyConnectorProvider());
56+
* Client client = ClientBuilder.newClient(config);
57+
*
58+
* // async request
59+
* WebTarget target = client.target("http://localhost:8080");
60+
* Future<Response> future = target.path("resource").request().async().get();
61+
*
62+
* // wait for 3 seconds
63+
* Response response = future.get(3, TimeUnit.SECONDS);
64+
* String entity = response.readEntity(String.class);
65+
* client.close();
66+
* }
67+
* </pre>
68+
* <p>
69+
* Connector instances created via Jetty HTTP Client-based connector provider support only
70+
* {@link org.glassfish.jersey.client.RequestEntityProcessing#BUFFERED entity buffering}.
71+
* Defining the property {@link org.glassfish.jersey.client.ClientProperties#REQUEST_ENTITY_PROCESSING} has no
72+
* effect on Jetty HTTP Client-based connectors.
73+
* </p>
74+
*
75+
* @author Arul Dhesiaseelan (aruld at acm.org)
76+
* @author Marek Potociar
77+
* @since 2.5
78+
*/
79+
public class JettyConnectorProvider implements ConnectorProvider {
80+
81+
@Override
82+
public Connector getConnector(Client client, Configuration runtimeConfig) {
83+
throw new ProcessingException(LocalizationMessages.NOT_SUPPORTED());
84+
}
85+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2023 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2019, 2021 Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2019, 2023 Oracle and/or its affiliates. All rights reserved.
33
*
44
* This program and the accompanying materials are made available under the
55
* terms of the Eclipse Public License v. 2.0, which is available at

0 commit comments

Comments
 (0)