Commit a724d458 authored by Phillip Webb's avatar Phillip Webb

Set Jetty temp dir

Ensure that the system temp directory is passed to the Jetty
WebAppContext. This prevents `jsp` folders from appearing in the current
directory.

Fixes gh-2169
parent 917723a8
......@@ -221,6 +221,7 @@ public class JettyEmbeddedServletContainerFactory extends
protected final void configureWebAppContext(WebAppContext context,
ServletContextInitializer... initializers) {
Assert.notNull(context, "Context must not be null");
context.setTempDirectory(getTempDirectory());
setExtendedListenerTypes(context);
if (this.resourceLoader != null) {
context.setClassLoader(this.resourceLoader.getClassLoader());
......@@ -246,6 +247,11 @@ public class JettyEmbeddedServletContainerFactory extends
postProcessWebAppContext(context);
}
private File getTempDirectory() {
String temp = System.getProperty("java.io.tmpdir");
return (temp == null ? null : new File(temp));
}
private void setExtendedListenerTypes(WebAppContext context) {
try {
context.getServletContext().setExtendedListenerTypes(true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment