diff options
author | Greg Wilkins | 2016-01-15 02:44:38 +0000 |
---|---|---|
committer | Greg Wilkins | 2016-01-15 02:44:38 +0000 |
commit | fa374cd8994e288dce23089f1890edc5c1ca5f34 (patch) | |
tree | 39e77bc550d6169f425de0b01c54e0e6f754cd2a | |
parent | dcc642c3da55b3586c6c4104a2f94f6dfc91ce7b (diff) | |
download | org.eclipse.jetty.project-fa374cd8994e288dce23089f1890edc5c1ca5f34.tar.gz org.eclipse.jetty.project-fa374cd8994e288dce23089f1890edc5c1ca5f34.tar.xz org.eclipse.jetty.project-fa374cd8994e288dce23089f1890edc5c1ca5f34.zip |
485884 - WebAppContext defaults should be same for xml or war deployment
-rw-r--r-- | jetty-deploy/src/main/java/org/eclipse/jetty/deploy/providers/WebAppProvider.java | 49 |
1 files 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 @@ -245,6 +245,28 @@ public class WebAppProvider extends ScanningAppProvider } /* ------------------------------------------------------------ */ + 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; } |