diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index abbc5475cde8..bdac30158ae8 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -687,7 +687,7 @@ bom { ] } } - library("Jetty", "12.0.11") { + library("Jetty", "12.0.12") { group("org.eclipse.jetty.ee10") { imports = [ "jetty-ee10-bom" diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyEmbeddedWebAppContext.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyEmbeddedWebAppContext.java index baf8e758660e..625e7b822fd5 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyEmbeddedWebAppContext.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyEmbeddedWebAppContext.java @@ -42,6 +42,11 @@ void deferredInitialize() throws Exception { getContext().call(handler::deferredInitialize, null); } + @Override + public String getCanonicalNameForTmpDir() { + return super.getCanonicalNameForTmpDir(); + } + private static final class JettyEmbeddedServletHandler extends ServletHandler { @Override diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java index 194fa32ba267..6ae7040d0cc4 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/jetty/JettyServletWebServerFactory.java @@ -308,9 +308,17 @@ private void addLocaleMappings(WebAppContext context) { private File getTempDirectory(WebAppContext context) { String temp = System.getProperty("java.io.tmpdir"); - return (temp != null) - ? new File(temp, WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context) + UUID.randomUUID()) - : null; + return (temp != null) ? new File(temp, getTempDirectoryPrefix(context) + UUID.randomUUID()) : null; + } + + @SuppressWarnings("removal") + private String getTempDirectoryPrefix(WebAppContext context) { + try { + return ((JettyEmbeddedWebAppContext) context).getCanonicalNameForTmpDir(); + } + catch (Exception ex) { + return WebInfConfiguration.getCanonicalNameForWebAppTmpDir(context); + } } private void configureDocumentRoot(WebAppContext handler) {