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
This commit is contained in:
parent
917723a883
commit
a724d4581f
|
@ -221,6 +221,7 @@ public class JettyEmbeddedServletContainerFactory extends
|
||||||
protected final void configureWebAppContext(WebAppContext context,
|
protected final void configureWebAppContext(WebAppContext context,
|
||||||
ServletContextInitializer... initializers) {
|
ServletContextInitializer... initializers) {
|
||||||
Assert.notNull(context, "Context must not be null");
|
Assert.notNull(context, "Context must not be null");
|
||||||
|
context.setTempDirectory(getTempDirectory());
|
||||||
setExtendedListenerTypes(context);
|
setExtendedListenerTypes(context);
|
||||||
if (this.resourceLoader != null) {
|
if (this.resourceLoader != null) {
|
||||||
context.setClassLoader(this.resourceLoader.getClassLoader());
|
context.setClassLoader(this.resourceLoader.getClassLoader());
|
||||||
|
@ -246,6 +247,11 @@ public class JettyEmbeddedServletContainerFactory extends
|
||||||
postProcessWebAppContext(context);
|
postProcessWebAppContext(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private File getTempDirectory() {
|
||||||
|
String temp = System.getProperty("java.io.tmpdir");
|
||||||
|
return (temp == null ? null : new File(temp));
|
||||||
|
}
|
||||||
|
|
||||||
private void setExtendedListenerTypes(WebAppContext context) {
|
private void setExtendedListenerTypes(WebAppContext context) {
|
||||||
try {
|
try {
|
||||||
context.getServletContext().setExtendedListenerTypes(true);
|
context.getServletContext().setExtendedListenerTypes(true);
|
||||||
|
|
Loading…
Reference in New Issue