Merge branch '3.4.x'
This commit is contained in:
@@ -240,7 +240,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
||||
TomcatEmbeddedContext context = new TomcatEmbeddedContext();
|
||||
WebResourceRoot resourceRoot = (documentRoot != null) ? new LoaderHidingResourceRoot(context)
|
||||
: new StandardRoot(context);
|
||||
resourceRoot.setReadOnly(true);
|
||||
ignoringNoSuchMethodError(() -> resourceRoot.setReadOnly(true));
|
||||
context.setResources(resourceRoot);
|
||||
context.setName(getContextPath());
|
||||
context.setDisplayName(getDisplayName());
|
||||
@@ -253,12 +253,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
||||
context.setParentClassLoader(parentClassLoader);
|
||||
resetDefaultLocaleMapping(context);
|
||||
addLocaleMappings(context);
|
||||
try {
|
||||
context.setCreateUploadTargets(true);
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
// Tomcat is < 8.5.39. Continue.
|
||||
}
|
||||
ignoringNoSuchMethodError(() -> context.setCreateUploadTargets(true));
|
||||
configureTldPatterns(context);
|
||||
WebappLoader loader = new WebappLoader();
|
||||
loader.setLoaderInstance(new TomcatEmbeddedWebappClassLoader(parentClassLoader));
|
||||
@@ -278,6 +273,14 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
||||
postProcessContext(context);
|
||||
}
|
||||
|
||||
private void ignoringNoSuchMethodError(Runnable method) {
|
||||
try {
|
||||
method.run();
|
||||
}
|
||||
catch (NoSuchMethodError ex) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override Tomcat's default locale mappings to align with other servers. See
|
||||
* {@code org.apache.catalina.util.CharsetMapperDefault.properties}.
|
||||
|
||||
Reference in New Issue
Block a user