From fa374cd8994e288dce23089f1890edc5c1ca5f34 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Fri, 15 Jan 2016 13:44:38 +1100 Subject: 485884 - WebAppContext defaults should be same for xml or war deployment --- .../jetty/deploy/providers/WebAppProvider.java | 49 +++++++++++----------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java index 7b7303d317..fdebfd668c 100644 --- a/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java +++ b/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java @@ -244,6 +244,28 @@ public class WebAppProvider extends ScanningAppProvider return _tempDirectory; } + /* ------------------------------------------------------------ */ + protected void initializeWebAppContextDefaults(WebAppContext webapp) + { + if (_defaultsDescriptor != null) + webapp.setDefaultsDescriptor(_defaultsDescriptor); + webapp.setExtractWAR(_extractWars); + webapp.setParentLoaderPriority(_parentLoaderPriority); + if (_configurationClasses != null) + webapp.setConfigurationClasses(_configurationClasses); + + if (_tempDirectory != null) + { + /* Since the Temp Dir is really a context base temp directory, + * Lets set the Temp Directory in a way similar to how WebInfConfiguration does it, + * instead of setting the WebAppContext.setTempDirectory(File). + * If we used .setTempDirectory(File) all webapps will wind up in the + * same temp / work directory, overwriting each others work. + */ + webapp.setAttribute(WebAppContext.BASETEMPDIR, _tempDirectory); + } + } + /* ------------------------------------------------------------ */ @Override public ContextHandler createContextHandler(final App app) throws Exception @@ -267,9 +289,7 @@ public class WebAppProvider extends ScanningAppProvider if (context instanceof WebAppContext) { WebAppContext webapp = (WebAppContext)context; - webapp.setParentLoaderPriority(_parentLoaderPriority); - if (_defaultsDescriptor != null) - webapp.setDefaultsDescriptor(_defaultsDescriptor); + initializeWebAppContextDefaults(webapp); } } }; @@ -327,31 +347,10 @@ public class WebAppProvider extends ScanningAppProvider context = "/" + context; } - webAppContext.setContextPath(context); webAppContext.setWar(file.getAbsolutePath()); - if (_defaultsDescriptor != null) - { - webAppContext.setDefaultsDescriptor(_defaultsDescriptor); - } - webAppContext.setExtractWAR(_extractWars); - webAppContext.setParentLoaderPriority(_parentLoaderPriority); - if (_configurationClasses != null) - { - webAppContext.setConfigurationClasses(_configurationClasses); - } + initializeWebAppContextDefaults(webAppContext); - if (_tempDirectory != null) - { - /* Since the Temp Dir is really a context base temp directory, - * Lets set the Temp Directory in a way similar to how WebInfConfiguration does it, - * instead of setting the - * WebAppContext.setTempDirectory(File). - * If we used .setTempDirectory(File) all webapps will wind up in the - * same temp / work directory, overwriting each others work. - */ - webAppContext.setAttribute(WebAppContext.BASETEMPDIR, _tempDirectory); - } return webAppContext; } -- cgit v1.2.3