From 4c06633ec624169bdfacafe36511c7ed4d8ff011 Mon Sep 17 00:00:00 2001 From: Basil Crow Date: Thu, 9 May 2024 09:53:10 -0700 Subject: [PATCH] Set server on `WebApplicationContext` (#766) --- src/main/java/org/jvnet/hudson/test/HudsonTestCase.java | 1 + src/main/java/org/jvnet/hudson/test/JenkinsRule.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java b/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java index 96cf5e2ff..935045a84 100644 --- a/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java +++ b/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java @@ -553,6 +553,7 @@ protected ServletContext createWebServer() throws Exception { context.setClassLoader(getClass().getClassLoader()); context.setConfigurations(new Configuration[]{new WebXmlConfiguration()}); context.addBean(new NoListenerConfiguration(context)); + context.setServer(server); server.setHandler(context); JettyWebSocketServletContainerInitializer.configure(context, null); context.getSecurityHandler().setLoginService(configureUserRealm()); diff --git a/src/main/java/org/jvnet/hudson/test/JenkinsRule.java b/src/main/java/org/jvnet/hudson/test/JenkinsRule.java index f705a4d33..40d318630 100644 --- a/src/main/java/org/jvnet/hudson/test/JenkinsRule.java +++ b/src/main/java/org/jvnet/hudson/test/JenkinsRule.java @@ -859,6 +859,7 @@ public static Server _createWebServer( context.setClassLoader(classLoader); context.setConfigurations(new Configuration[]{new WebXmlConfiguration()}); context.addBean(new NoListenerConfiguration(context)); + context.setServer(server); server.setHandler(context); JettyWebSocketServletContainerInitializer.configure(context, null); context.getSecurityHandler().setLoginService(loginServiceSupplier.get());