Skip to content

Commit

Permalink
Upgrade Jetty from 10.0.20 to 12.0.9 (EE 8)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil committed May 14, 2024
1 parent 7b8a625 commit 559acae
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 27 deletions.
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* allowing one to test against multiple Jenkins versions.
*/
buildPlugin(useContainerAgent: true, configurations: [
[ platform: 'linux', jdk: '11' ],
[ platform: 'windows', jdk: '11' ],
[ platform: 'linux', jdk: '17', jenkins: '2.458' ],
[platform: 'linux', jdk: 17],
[platform: 'windows', jdk: 17],
[platform: 'linux', jdk: 21, jenkins: '2.458'],
])
26 changes: 20 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,24 @@ THE SOFTWARE.
<gitHubRepo>jenkinsci/${project.artifactId}</gitHubRepo>
<!-- Normally filled in by "maven-hpi-plugin" with the path to "org-netbeans-insane-hook.jar" extracted from this repository -->
<jenkins.insaneHook>--patch-module=java.base=${project.build.outputDirectory}/netbeans/harness/modules/ext/org-netbeans-insane-hook.jar --add-exports=java.base/org.netbeans.insane.hook=ALL-UNNAMED</jenkins.insaneHook>
<jetty.version>12.0.9</jetty.version>
<!-- TODO until in parent POM -->
<maven.compiler.release>17</maven.compiler.release>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>10.0.20</version>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-bom</artifactId>
<version>${jetty.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down Expand Up @@ -118,8 +128,8 @@ THE SOFTWARE.
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<groupId>org.eclipse.jetty.ee8</groupId>
<artifactId>jetty-ee8-webapp</artifactId>
<exclusions>
<!-- Provided by Jenkins core -->
<exclusion>
Expand All @@ -129,11 +139,15 @@ THE SOFTWARE.
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<!-- or websocket-javax-server -->
<artifactId>websocket-jetty-server</artifactId>
<groupId>org.eclipse.jetty.ee8.websocket</groupId>
<artifactId>jetty-ee8-websocket-jetty-server</artifactId>
<!-- or jetty-ee8-websocket-javax-server -->
<exclusions>
<!-- Provided by Jenkins core -->
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jenkins/benchmark/jmh/JmhBenchmarkState.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import javax.servlet.ServletContext;
import jenkins.model.Jenkins;
import jenkins.model.JenkinsLocationConfiguration;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
import org.jvnet.hudson.test.JavaNetReverseProxy;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.TemporaryDirectoryAllocator;
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
import org.acegisecurity.userdetails.UserDetails;
import org.acegisecurity.userdetails.UsernameNotFoundException;
import org.apache.commons.beanutils.PropertyUtils;
import org.eclipse.jetty.ee8.webapp.Configuration;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.ee8.webapp.WebXmlConfiguration;
import org.eclipse.jetty.ee8.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.http.HttpCompliance;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.http.UriCompliance;
Expand All @@ -149,10 +153,6 @@
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.security.Password;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.htmlunit.AjaxController;
import org.htmlunit.AlertHandler;
import org.htmlunit.BrowserVersion;
Expand Down Expand Up @@ -548,7 +548,13 @@ protected ServletContext createWebServer() throws Exception {
server = new Server(qtp);

explodedWarDir = WarExploder.getExplodedDir();
WebAppContext context = new WebAppContext(explodedWarDir.getPath(), contextPath);
WebAppContext context = new WebAppContext(explodedWarDir.getPath(), contextPath) {
@Override
protected ClassLoader configureClassLoader(ClassLoader loader) {
// Use flat classpath in tests
return loader;
}
};
context.setResourceBase(explodedWarDir.getPath());
context.setClassLoader(getClass().getClassLoader());
context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
Expand Down Expand Up @@ -1815,9 +1821,10 @@ public boolean isLoggable(LogRecord record) {
* @deprecated removed without replacement
*/
@Deprecated
public static final MimeTypes MIME_TYPES = new MimeTypes();
public static final MimeTypes MIME_TYPES = new MimeTypes.Mutable();
static {
MIME_TYPES.addMimeMapping("js","text/javascript");
// TODO delete this field

Check warning on line 1826 in src/main/java/org/jvnet/hudson/test/HudsonTestCase.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: delete this field
((MimeTypes.Mutable) MIME_TYPES).addMimeMapping("js","text/javascript");
Functions.DEBUG_YUI = true;

if (Functions.isGlibcSupported()) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jvnet/hudson/test/JavaNetReverseProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
import org.eclipse.jetty.ee8.servlet.ServletContextHandler;
import org.eclipse.jetty.ee8.servlet.ServletHolder;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.util.thread.QueuedThreadPool;

/**
Expand Down
21 changes: 14 additions & 7 deletions src/main/java/org/jvnet/hudson/test/JenkinsRule.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@
import org.acegisecurity.GrantedAuthorityImpl;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.io.FileUtils;
import org.eclipse.jetty.ee8.webapp.Configuration;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.ee8.webapp.WebXmlConfiguration;
import org.eclipse.jetty.ee8.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.eclipse.jetty.http.HttpCompliance;
import org.eclipse.jetty.http.MimeTypes;
import org.eclipse.jetty.http.UriCompliance;
Expand All @@ -185,10 +189,6 @@
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.util.security.Password;
import org.eclipse.jetty.util.thread.QueuedThreadPool;
import org.eclipse.jetty.webapp.Configuration;
import org.eclipse.jetty.webapp.WebAppContext;
import org.eclipse.jetty.webapp.WebXmlConfiguration;
import org.eclipse.jetty.websocket.server.config.JettyWebSocketServletContainerInitializer;
import org.htmlunit.AjaxController;
import org.htmlunit.BrowserVersion;
import org.htmlunit.DefaultCssErrorHandler;
Expand Down Expand Up @@ -855,7 +855,13 @@ public static WebAppContext _createWebAppContext(
qtp.setName("Jetty (JenkinsRule)");
Server server = new Server(qtp);

WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath);
WebAppContext context = new WebAppContext(WarExploder.getExplodedDir().getPath(), contextPath) {
@Override
protected ClassLoader configureClassLoader(ClassLoader loader) {
// Use flat classpath in tests
return loader;
}
};
context.setClassLoader(classLoader);
context.setConfigurations(new Configuration[]{new WebXmlConfiguration()});
context.addBean(new NoListenerConfiguration(context));
Expand Down Expand Up @@ -2989,11 +2995,12 @@ public boolean isLoggable(LogRecord record) {
static {
jettyLevel(Level.WARNING); // suppress Log.initialize message
try {
MIME_TYPES = new MimeTypes();
MIME_TYPES = new MimeTypes.Mutable();
} finally {
jettyLevel(Level.INFO);
}
MIME_TYPES.addMimeMapping("js","text/javascript");
// TODO delete this field

Check warning on line 3002 in src/main/java/org/jvnet/hudson/test/JenkinsRule.java

View check run for this annotation

ci.jenkins.io / Open Tasks Scanner

TODO

NORMAL: delete this field
((MimeTypes.Mutable) MIME_TYPES).addMimeMapping("js","text/javascript");
Functions.DEBUG_YUI = true;

if (Functions.isGlibcSupported()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
import hudson.WebAppMain;
import java.util.EventListener;
import javax.servlet.ServletContextListener;
import org.eclipse.jetty.ee8.webapp.WebAppContext;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.webapp.WebAppContext;

/**
* Kills off the {@link WebAppMain} {@link ServletContextListener}.
Expand Down

0 comments on commit 559acae

Please sign in to comment.