Skip to content

Commit 9704afb

Browse files
wilkinsonaphilwebb
authored andcommitted
Upgrade to Tomcat 10.1.36
Closes gh-44331
1 parent 0e55165 commit 9704afb

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ nativeBuildToolsVersion=0.10.5
2121
snakeYamlVersion=2.2
2222
springFrameworkVersion=6.1.17
2323
springFramework60xVersion=6.0.23
24-
tomcatVersion=10.1.34
24+
tomcatVersion=10.1.36
2525

2626
kotlin.stdlib.default.dependency=false

spring-boot-project/spring-boot-dependencies/build.gradle

-4
Original file line numberDiff line numberDiff line change
@@ -2433,10 +2433,6 @@ bom {
24332433
}
24342434
}
24352435
library("Tomcat", "${tomcatVersion}") {
2436-
prohibit {
2437-
versionRange "[10.1.35,10.1.36]"
2438-
because "https://bz.apache.org/bugzilla/show_bug.cgi?id=69576 and related problems in 10.1.36"
2439-
}
24402436
group("org.apache.tomcat") {
24412437
modules = [
24422438
"tomcat-annotations-api",

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatReactiveWebServerFactory.java

+4
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
import org.apache.catalina.core.AprLifecycleListener;
3737
import org.apache.catalina.loader.WebappLoader;
3838
import org.apache.catalina.startup.Tomcat;
39+
import org.apache.catalina.webresources.StandardRoot;
3940
import org.apache.commons.logging.Log;
4041
import org.apache.commons.logging.LogFactory;
4142
import org.apache.coyote.AbstractProtocol;
@@ -165,6 +166,9 @@ private void configureEngine(Engine engine) {
165166
protected void prepareContext(Host host, TomcatHttpHandlerAdapter servlet) {
166167
File docBase = createTempDir("tomcat-docbase");
167168
TomcatEmbeddedContext context = new TomcatEmbeddedContext();
169+
StandardRoot resourcesRoot = new StandardRoot();
170+
resourcesRoot.setReadOnly(true);
171+
context.setResources(resourcesRoot);
168172
context.setPath("");
169173
context.setDocBase(docBase.getAbsolutePath());
170174
context.addLifecycleListener(new Tomcat.FixContextListener());

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/embedded/tomcat/TomcatServletWebServerFactory.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,10 @@ private void configureEngine(Engine engine) {
238238
protected void prepareContext(Host host, ServletContextInitializer[] initializers) {
239239
File documentRoot = getValidDocumentRoot();
240240
TomcatEmbeddedContext context = new TomcatEmbeddedContext();
241-
if (documentRoot != null) {
242-
context.setResources(new LoaderHidingResourceRoot(context));
243-
}
241+
WebResourceRoot resourceRoot = (documentRoot != null) ? new LoaderHidingResourceRoot(context)
242+
: new StandardRoot(context);
243+
resourceRoot.setReadOnly(true);
244+
context.setResources(resourceRoot);
244245
context.setName(getContextPath());
245246
context.setDisplayName(getDisplayName());
246247
context.setPath(getContextPath());
@@ -814,7 +815,7 @@ private StaticResourceConfigurer(Context context) {
814815

815816
@Override
816817
public void lifecycleEvent(LifecycleEvent event) {
817-
if (event.getType().equals(Lifecycle.CONFIGURE_START_EVENT)) {
818+
if (event.getType().equals(Lifecycle.BEFORE_INIT_EVENT)) {
818819
addResourceJars(getUrlsOfJarsWithMetaInfResources());
819820
}
820821
}
@@ -834,6 +835,9 @@ private void addResourceJars(List<URL> resourceJarUrls) {
834835
addResourceSet(url.toString());
835836
}
836837
}
838+
for (WebResourceSet resources : this.context.getResources().getJarResources()) {
839+
resources.setReadOnly(true);
840+
}
837841
}
838842

839843
private void addResourceSet(String resource) {

0 commit comments

Comments
 (0)