From 3f159fcf32860344b328bb00cf6869108a92df72 Mon Sep 17 00:00:00 2001 From: Jan Bartel Date: Thu, 22 Jun 2023 10:25:12 +0200 Subject: [PATCH] Issue #9925 Also use current context for alternate getServletContextHandler method (#9941) --- .../org/eclipse/jetty/ee10/servlet/ServletContextHandler.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java index cf2fba2d306a..7bbc574a25ff 100644 --- a/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java +++ b/jetty-ee10/jetty-ee10-servlet/src/main/java/org/eclipse/jetty/ee10/servlet/ServletContextHandler.java @@ -157,6 +157,9 @@ public static ServletContextHandler getServletContextHandler(ServletContext serv { if (servletContext instanceof ServletContextApi servletContextApi) return servletContextApi.getContext().getServletContextHandler(); + ServletContextHandler sch = getCurrentServletContextHandler(); + if (sch != null) + return sch; throw new IllegalStateException("No Jetty ServletContextHandler, " + purpose + " unavailable"); }