|
|
|
@ -240,7 +240,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto |
|
|
|
TomcatEmbeddedContext context = new TomcatEmbeddedContext(); |
|
|
|
TomcatEmbeddedContext context = new TomcatEmbeddedContext(); |
|
|
|
WebResourceRoot resourceRoot = (documentRoot != null) ? new LoaderHidingResourceRoot(context) |
|
|
|
WebResourceRoot resourceRoot = (documentRoot != null) ? new LoaderHidingResourceRoot(context) |
|
|
|
: new StandardRoot(context); |
|
|
|
: new StandardRoot(context); |
|
|
|
resourceRoot.setReadOnly(true); |
|
|
|
ignoringNoSuchMethodError(() -> resourceRoot.setReadOnly(true)); |
|
|
|
context.setResources(resourceRoot); |
|
|
|
context.setResources(resourceRoot); |
|
|
|
context.setName(getContextPath()); |
|
|
|
context.setName(getContextPath()); |
|
|
|
context.setDisplayName(getDisplayName()); |
|
|
|
context.setDisplayName(getDisplayName()); |
|
|
|
@ -253,12 +253,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto |
|
|
|
context.setParentClassLoader(parentClassLoader); |
|
|
|
context.setParentClassLoader(parentClassLoader); |
|
|
|
resetDefaultLocaleMapping(context); |
|
|
|
resetDefaultLocaleMapping(context); |
|
|
|
addLocaleMappings(context); |
|
|
|
addLocaleMappings(context); |
|
|
|
try { |
|
|
|
ignoringNoSuchMethodError(() -> context.setCreateUploadTargets(true)); |
|
|
|
context.setCreateUploadTargets(true); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (NoSuchMethodError ex) { |
|
|
|
|
|
|
|
// Tomcat is < 8.5.39. Continue.
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
configureTldPatterns(context); |
|
|
|
configureTldPatterns(context); |
|
|
|
WebappLoader loader = new WebappLoader(); |
|
|
|
WebappLoader loader = new WebappLoader(); |
|
|
|
loader.setLoaderInstance(new TomcatEmbeddedWebappClassLoader(parentClassLoader)); |
|
|
|
loader.setLoaderInstance(new TomcatEmbeddedWebappClassLoader(parentClassLoader)); |
|
|
|
@ -278,6 +273,14 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto |
|
|
|
postProcessContext(context); |
|
|
|
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 |
|
|
|
* Override Tomcat's default locale mappings to align with other servers. See |
|
|
|
* {@code org.apache.catalina.util.CharsetMapperDefault.properties}. |
|
|
|
* {@code org.apache.catalina.util.CharsetMapperDefault.properties}. |
|
|
|
|