From ea5bedf072096a9381452f3b53313c51a38fded9 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 30 Jun 2022 09:51:19 +1000 Subject: [PATCH] Jetty 12.0.x deployment (#8208) Deploy webapps for different environments from the same webapps directory. The maximal environment known to the AppProviders is used as the default environment. An explicit environment can be set in a properties file for an application, which is also used for property substitution in any context xml file. --- jetty-core/jetty-bom/pom.xml | 5 + jetty-core/jetty-deploy/pom.xml | 4 + .../src/main/config/etc/jetty-deploy.xml | 5 - .../src/main/config/modules/deploy.mod | 15 - .../src/main/java/module-info.java | 1 + .../java/org/eclipse/jetty/deploy/App.java | 67 ++- .../org/eclipse/jetty/deploy/AppProvider.java | 6 + .../jetty/deploy/DeploymentManager.java | 76 +--- .../PropertiesConfigurationManager.java | 114 ------ .../deploy/providers/ContextProvider.java | 384 +++++++----------- .../deploy/providers/ScanningAppProvider.java | 59 ++- .../org/eclipse/jetty/deploy/util/FileID.java | 43 +- .../jetty/deploy/DeploymentManagerTest.java | 55 +++ .../eclipse/jetty/deploy/MockAppProvider.java | 9 +- jetty-core/jetty-ee/pom.xml | 52 +++ .../src/main/java/module-info.java} | 20 +- .../java/org/eclipse/jetty/ee/Deployable.java | 56 +++ .../src/main/config/modules/server.mod | 1 + .../eclipse/jetty/xml/XmlConfiguration.java | 30 +- .../jetty/xml/XmlConfigurationTest.java | 4 +- jetty-core/pom.xml | 1 + .../config/modules/ee10-demo-async-rest.mod | 2 +- .../main/config/modules/ee10-demo-jaas.mod | 4 +- .../main/config/modules/ee10-demo-jetty.mod | 6 +- .../modules/ee10-demo-moved-context.mod | 2 +- .../main/config/modules/ee10-demo-jndi.mod | 4 +- .../src/main/config/modules/ee10-demo-jsp.mod | 2 +- .../jetty-ee10-demo-mock-resources/pom.xml | 2 +- .../modules/ee10-demo-mock-resources.mod | 2 +- .../main/config/modules/ee10-demo-proxy.mod | 2 +- .../main/config/modules/ee10-demo-simple.mod | 2 +- .../pom.xml | 2 +- .../main/config/modules/ee10-demo-spec.mod | 4 +- .../ee10/maven/plugin/JettyHomeForker.java | 2 +- .../test-jetty-ee10-osgi-fragment/pom.xml | 2 +- .../ee10/servlet/ServletContextHandler.java | 23 -- jetty-ee10/jetty-ee10-webapp/pom.xml | 4 + .../src/main/config/etc/jetty-ee10-deploy.xml | 42 +- .../src/main/config/modules/ee10-deploy.mod | 41 +- .../src/main/java/module-info.java | 1 + .../ee10/webapp/MetaInfConfiguration.java | 37 +- .../jetty/ee10/webapp/WebAppContext.java | 56 ++- .../ee10/webapp/MetaInfConfigurationTest.java | 5 +- jetty-ee8/jetty-ee8-nested/pom.xml | 2 +- .../src/main/config/etc/jetty-ee8-deploy.xml | 50 ++- .../src/main/config/modules/ee8-deploy.mod | 41 +- .../main/resources/META-INF/web-fragment.xml | 4 +- .../demo.d/ee9-demo-async-rest.properties | 1 + .../config/modules/ee9-demo-async-rest.mod | 4 +- .../src/main/resources/exampleserver.xml | 2 +- .../modules/demo.d/ee9-demo-jaas.properties | 1 + .../src/main/config/modules/ee9-demo-jaas.mod | 5 +- .../modules/demo.d/ee9-demo-jetty.properties | 1 + .../main/config/modules/ee9-demo-jetty.mod | 7 +- .../config/modules/ee9-demo-moved-context.mod | 2 +- .../modules/demo.d/ee9-demo-jndi.properties | 1 + .../src/main/config/modules/ee9-demo-jndi.mod | 5 +- .../modules/demo.d/ee9-demo-jsp.properties | 1 + .../src/main/config/modules/ee9-demo-jsp.mod | 3 +- .../jetty-ee9-demo-mock-resources/pom.xml | 2 +- .../modules/ee9-demo-mock-resources.mod | 2 +- .../modules/demo.d/ee9-demo-proxy.properties | 1 + .../main/config/modules/ee9-demo-proxy.mod | 3 +- .../modules/demo.d/ee9-demo-simple.properties | 1 + .../main/config/modules/ee9-demo-simple.mod | 3 +- .../pom.xml | 2 +- .../modules/demo.d/ee9-demo-spec.properties | 1 + .../src/main/config/modules/ee9-demo-spec.mod | 5 +- .../ee9/maven/plugin/JettyHomeForker.java | 2 +- jetty-ee9/jetty-ee9-nested/pom.xml | 2 +- .../src/main/java/module-info.java | 1 + .../jetty/ee9/nested/ContextHandler.java | 23 -- .../test-jetty-ee9-osgi-fragment/pom.xml | 2 +- .../src/main/config/etc/jetty-ee9-deploy.xml | 50 ++- .../src/main/config/modules/ee9-deploy.mod | 41 +- .../ee9/webapp/MetaInfConfiguration.java | 27 +- .../jetty/ee9/webapp/WebAppContext.java | 128 +++--- .../ee9/webapp/MetaInfConfigurationTest.java | 6 +- .../main/resources/modules/ee10-demo-root.mod | 8 +- pom.xml | 7 +- 80 files changed, 879 insertions(+), 822 deletions(-) delete mode 100644 jetty-core/jetty-deploy/src/main/java/org/eclipse/jetty/deploy/PropertiesConfigurationManager.java create mode 100644 jetty-core/jetty-ee/pom.xml rename jetty-core/{jetty-deploy/src/main/java/org/eclipse/jetty/deploy/ConfigurationManager.java => jetty-ee/src/main/java/module-info.java} (67%) create mode 100644 jetty-core/jetty-ee/src/main/java/org/eclipse/jetty/ee/Deployable.java create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/demo.d/ee9-demo-async-rest.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/demo.d/ee9-demo-jetty.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/demo.d/ee9-demo-jndi.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/demo.d/ee9-demo-jsp.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/demo.d/ee9-demo-proxy.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/demo.d/ee9-demo-simple.properties create mode 100644 jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/demo.d/ee9-demo-spec.properties diff --git a/jetty-core/jetty-bom/pom.xml b/jetty-core/jetty-bom/pom.xml index a95ab3349ab..e3bcd3847e1 100644 --- a/jetty-core/jetty-bom/pom.xml +++ b/jetty-core/jetty-bom/pom.xml @@ -90,6 +90,11 @@ jetty-deploy 12.0.0-SNAPSHOT + + org.eclipse.jetty + jetty-ee + 12.0.0-SNAPSHOT + org.eclipse.jetty.fcgi fcgi-client diff --git a/jetty-core/jetty-deploy/pom.xml b/jetty-core/jetty-deploy/pom.xml index c672ea39940..e3ce3db8c01 100644 --- a/jetty-core/jetty-deploy/pom.xml +++ b/jetty-core/jetty-deploy/pom.xml @@ -56,5 +56,9 @@ jetty-test-helper test + + org.eclipse.jetty + jetty-ee + diff --git a/jetty-core/jetty-deploy/src/main/config/etc/jetty-deploy.xml b/jetty-core/jetty-deploy/src/main/config/etc/jetty-deploy.xml index a42dc2e52df..bf042bf2179 100644 --- a/jetty-core/jetty-deploy/src/main/config/etc/jetty-deploy.xml +++ b/jetty-core/jetty-deploy/src/main/config/etc/jetty-deploy.xml @@ -15,11 +15,6 @@ - - - org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern - .*/jetty-jakarta-servlet-api-[^/]*\.jar$|.*/.*jakarta.servlet.jsp.jstl-.*\.jar$ - - - - + + + + + + + + + + .*jakarta.servlet.jsp.jstl-.*\.jar$ + + + + + + + + + + + + diff --git a/jetty-ee10/jetty-ee10-webapp/src/main/config/modules/ee10-deploy.mod b/jetty-ee10/jetty-ee10-webapp/src/main/config/modules/ee10-deploy.mod index b97198291ea..1483982c9a9 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/main/config/modules/ee10-deploy.mod +++ b/jetty-ee10/jetty-ee10-webapp/src/main/config/modules/ee10-deploy.mod @@ -11,23 +11,44 @@ ee10-webapp [lib] [files] -webapps-ee10/ +webapps/ [xml] etc/jetty-ee10-deploy.xml [ini-template] -# Monitored directory name (relative to $jetty.base) -# jetty.deploy.monitoredDir=webapps-ee10 -# - OR - -# Monitored directory path (fully qualified) -# jetty.deploy.monitoredPath=/var/www/webapps-ee10 +## Monitored directory name (relative to $jetty.base) +# jetty.deploy.monitoredDir=webapps +## - OR - +## Monitored directory path (fully qualified) +# jetty.deploy.monitoredPath=/var/www/webapps -# Defaults Descriptor for all deployed webapps -# jetty.deploy.defaultsDescriptorPath=${jetty.base}/etc/webdefault-ee10.xml +## Defaults Descriptor for all deployed webapps +# jetty.deploy.defaultsDescriptor=${jetty.base}/etc/webdefault-ee10.xml -# Monitored directory scan period (seconds) +## Monitored directory scan period (seconds) # jetty.deploy.scanInterval=1 -# Whether to extract *.war files +## Whether to extract *.war files # jetty.deploy.extractWars=true + +## Whether to give the parent classloader priority +# jetty.deploy.parentLoaderPriority=true + +## Comma separated list of configuration classes to set. +# jetty.deploy.configurationClasses= + +## Base temporary directory for deployed web applications. +# jetty.deploy.tempDir= + +## Pattern to select jars from the container classloader to be scanned (or null to scan no jars) +# jetty.deploy.containerScanJarPattern=.*jakarta.servlet.jsp.jstl-.*\.jar$ + +## Pattern to select jars from the container classloader to be scanned (or null to scan all jars). +# jetty.deploy.webInfScanJarPattern= + +## Pattern to exclude discovered ServletContainerInitializers +# jetty.deploy.servletContainerInitializerExclusionPattern= + +## Order of discovered ServletContainerInitializers +# jetty.deploy.servletContainerInitializerOrder= diff --git a/jetty-ee10/jetty-ee10-webapp/src/main/java/module-info.java b/jetty-ee10/jetty-ee10-webapp/src/main/java/module-info.java index fd841c97380..27a4a6e9a0b 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/main/java/module-info.java +++ b/jetty-ee10/jetty-ee10-webapp/src/main/java/module-info.java @@ -30,6 +30,7 @@ module org.eclipse.jetty.ee10.webapp requires org.slf4j; requires transitive java.instrument; + requires transitive org.eclipse.jetty.ee; requires transitive org.eclipse.jetty.session; requires transitive org.eclipse.jetty.ee10.servlet; requires transitive org.eclipse.jetty.xml; diff --git a/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java b/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java index 2a5d48e1f4d..53eb61ccdfa 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java +++ b/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/MetaInfConfiguration.java @@ -36,7 +36,9 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.stream.Collectors; +import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.PatternMatcher; +import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.resource.EmptyResource; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceCollection; @@ -186,13 +188,19 @@ public class MetaInfConfiguration extends AbstractConfiguration */ public void findAndFilterContainerPaths(final WebAppContext context) throws Exception { + String pattern = (String)context.getAttribute(CONTAINER_JAR_PATTERN); + if (LOG.isDebugEnabled()) + LOG.debug("{}={}", CONTAINER_JAR_PATTERN, pattern); + if (StringUtil.isBlank(pattern)) + return; // TODO review if this short cut will allow later code simplifications + // Apply an initial name filter to the jars to select which will be eventually // scanned for META-INF info and annotations. The filter is based on inclusion patterns. - ContainerPathNameMatcher containerPathNameMatcher = new ContainerPathNameMatcher(context, (String)context.getAttribute(CONTAINER_JAR_PATTERN)); + ContainerPathNameMatcher containerPathNameMatcher = new ContainerPathNameMatcher(context, pattern); List containerUris = getAllContainerJars(context); if (LOG.isDebugEnabled()) - LOG.debug("Matching container urls {}", containerUris); + LOG.debug("All container urls {}", containerUris); containerPathNameMatcher.match(containerUris); // When running on jvm 9 or above, we we won't be able to look at the application @@ -264,9 +272,12 @@ public class MetaInfConfiguration extends AbstractConfiguration throws Exception { //Apply filter to WEB-INF/lib jars - WebAppPathNameMatcher matcher = new WebAppPathNameMatcher(context, (String)context.getAttribute(WEBINF_JAR_PATTERN)); + String pattern = (String)context.getAttribute(WEBINF_JAR_PATTERN); + WebAppPathNameMatcher matcher = new WebAppPathNameMatcher(context, pattern); List jars = findJars(context); + if (LOG.isDebugEnabled()) + LOG.debug("webapp {}={} jars {}", WEBINF_JAR_PATTERN, pattern, jars); //Convert to uris for matching if (jars != null) @@ -284,23 +295,21 @@ public class MetaInfConfiguration extends AbstractConfiguration protected List getAllContainerJars(final WebAppContext context) throws URISyntaxException { List uris = new ArrayList<>(); - if (context.getClassLoader() != null) + ClassLoader loader = MetaInfConfiguration.class.getClassLoader(); + while (loader != null) { - ClassLoader loader = context.getClassLoader().getParent(); - while (loader != null) + if (loader instanceof URLClassLoader) { - if (loader instanceof URLClassLoader) + URL[] urls = ((URLClassLoader)loader).getURLs(); + if (urls != null) { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - for (URL url : urls) - { - uris.add(new URI(url.toString().replaceAll(" ", "%20"))); - } + for (URL url : urls) + uris.add(new URI(url.toString().replaceAll(" ", "%20"))); } - loader = loader.getParent(); } + loader = loader.getParent(); } + return uris; } diff --git a/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/WebAppContext.java b/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/WebAppContext.java index 3c75a02385b..17cd06ca2a8 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/WebAppContext.java +++ b/jetty-ee10/jetty-ee10-webapp/src/main/java/org/eclipse/jetty/ee10/webapp/WebAppContext.java @@ -38,10 +38,10 @@ import jakarta.servlet.http.HttpSessionAttributeListener; import jakarta.servlet.http.HttpSessionBindingListener; import jakarta.servlet.http.HttpSessionIdListener; import jakarta.servlet.http.HttpSessionListener; +import org.eclipse.jetty.ee.Deployable; import org.eclipse.jetty.ee10.servlet.ErrorHandler; import org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.ee10.servlet.ServletContextHandler; -import org.eclipse.jetty.ee10.servlet.ServletContextHandler.ServletContextApi; import org.eclipse.jetty.ee10.servlet.ServletHandler; import org.eclipse.jetty.ee10.servlet.SessionHandler; import org.eclipse.jetty.ee10.servlet.security.ConstraintAware; @@ -50,8 +50,8 @@ import org.eclipse.jetty.ee10.servlet.security.ConstraintSecurityHandler; import org.eclipse.jetty.ee10.servlet.security.SecurityHandler; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.util.MultiException; +import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @@ -75,7 +75,7 @@ import org.slf4j.LoggerFactory; * */ @ManagedObject("Web Application ContextHandler") -public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context +public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context, Deployable { static final Logger LOG = LoggerFactory.getLogger(WebAppContext.class); @@ -121,6 +121,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL private boolean _logUrlOnStart = false; private boolean _parentLoaderPriority = Boolean.getBoolean("org.eclipse.jetty.server.webapp.parentLoaderPriority"); private PermissionCollection _permissions; + private boolean _defaultContextPath = true; private String[] _contextWhiteList = null; @@ -228,6 +229,55 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL setParent(parent); } + @Override + public void initializeDefaults(Map properties) + { + for (String property : properties.keySet()) + { + String value = properties.get(property); + if (LOG.isDebugEnabled()) + LOG.debug("init {}: {}", property, value); + + switch (property) + { + case Deployable.WAR -> setWar(value); + case Deployable.BASE_TEMP_DIR -> setAttribute(BASETEMPDIR, value); + case Deployable.CONFIGURATION_CLASSES -> setConfigurationClasses(value == null ? null : value.split(",")); + case Deployable.CONTAINER_SCAN_JARS -> setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, value); + case Deployable.EXTRACT_WARS -> setExtractWAR(Boolean.parseBoolean(value)); + case Deployable.PARENT_LOADER_PRIORITY -> setParentLoaderPriority(Boolean.parseBoolean(value)); + case Deployable.WEBINF_SCAN_JARS -> setAttribute(MetaInfConfiguration.WEBINF_JAR_PATTERN, value); + case Deployable.DEFAULTS_DESCRIPTOR -> setDefaultsDescriptor(value); + case Deployable.SCI_EXCLUSION_PATTERN -> setAttribute("org.eclipse.jetty.containerInitializerExclusionPattern", value); + case Deployable.SCI_ORDER -> setAttribute("org.eclipse.jetty.containerInitializerOrder", value); + default -> + { + if (LOG.isDebugEnabled() && StringUtil.isNotBlank(value)) + LOG.debug("unknown property {}={}", property, value); + } + } + } + _defaultContextPath = true; + } + + public boolean isContextPathDefault() + { + return _defaultContextPath; + } + + @Override + public void setContextPath(String contextPath) + { + super.setContextPath(contextPath); + _defaultContextPath = false; + } + + public void setDefaultContextPath(String contextPath) + { + super.setContextPath(contextPath); + _defaultContextPath = true; + } + /** * @param servletContextName The servletContextName to set. */ diff --git a/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/MetaInfConfigurationTest.java b/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/MetaInfConfigurationTest.java index a6a5dfbb487..ab4e4b8b537 100644 --- a/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/MetaInfConfigurationTest.java +++ b/jetty-ee10/jetty-ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/MetaInfConfigurationTest.java @@ -134,16 +134,17 @@ public class MetaInfConfigurationTest { MetaInfConfiguration config = new MetaInfConfiguration(); WebAppContext context = new WebAppContext(); - context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*/jetty-util-[^/]*\\.jar$|.*/jetty-util/target/classes/$|.*/foo-bar-janb.jar"); + context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*servlet-api-[^/]*\\.jar$|.*/foo-bar-janb.jar"); WebAppClassLoader loader = new WebAppClassLoader(context); context.setClassLoader(loader); config.findAndFilterContainerPaths(context); List containerResources = context.getMetaData().getContainerResources(); + assertEquals(2, containerResources.size()); for (Resource r : containerResources) { String s = r.toString(); - assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("jetty-util")); + assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("servlet-api")); } } } diff --git a/jetty-ee8/jetty-ee8-nested/pom.xml b/jetty-ee8/jetty-ee8-nested/pom.xml index 43e213ff98f..00b7a817695 100644 --- a/jetty-ee8/jetty-ee8-nested/pom.xml +++ b/jetty-ee8/jetty-ee8-nested/pom.xml @@ -41,7 +41,7 @@ org.eclipse.jetty - jetty-io + jetty-ee org.eclipse.jetty diff --git a/jetty-ee8/jetty-ee8-webapp/src/main/config/etc/jetty-ee8-deploy.xml b/jetty-ee8/jetty-ee8-webapp/src/main/config/etc/jetty-ee8-deploy.xml index 17302e00b0e..cb17db83f91 100644 --- a/jetty-ee8/jetty-ee8-webapp/src/main/config/etc/jetty-ee8-deploy.xml +++ b/jetty-ee8/jetty-ee8-webapp/src/main/config/etc/jetty-ee8-deploy.xml @@ -21,41 +21,39 @@ - ee8 + ee8 - + - - - jetty.deploy.defaultsDescriptorPath - - /etc/webdefault-ee8.xml - - - - - - - - - - - - - - - + + + + + + + + + + .*jakarta.servlet.jsp.jstl-.*\.jar$ + + + + + + + + + + + + diff --git a/jetty-ee8/jetty-ee8-webapp/src/main/config/modules/ee8-deploy.mod b/jetty-ee8/jetty-ee8-webapp/src/main/config/modules/ee8-deploy.mod index 35387c15f13..a189fc5e4f8 100644 --- a/jetty-ee8/jetty-ee8-webapp/src/main/config/modules/ee8-deploy.mod +++ b/jetty-ee8/jetty-ee8-webapp/src/main/config/modules/ee8-deploy.mod @@ -11,23 +11,44 @@ ee8-webapp [lib] [files] -webapps-ee8/ +webapps/ [xml] etc/jetty-ee8-deploy.xml [ini-template] -# Monitored directory name (relative to $jetty.base) -# jetty.deploy.monitoredDir=webapps-ee8 -# - OR - -# Monitored directory path (fully qualified) -# jetty.deploy.monitoredPath=/var/www/webapps-ee8 +## Monitored directory name (relative to $jetty.base) +# jetty.deploy.monitoredDir=webapps +## - OR - +## Monitored directory path (fully qualified) +# jetty.deploy.monitoredPath=/var/www/webapps -# Defaults Descriptor for all deployed webapps -# jetty.deploy.defaultsDescriptorPath=${jetty.base}/etc/webdefault-ee8.xml +## Defaults Descriptor for all deployed webapps +# jetty.deploy.defaultsDescriptor=${jetty.base}/etc/webdefault-ee8.xml -# Monitored directory scan period (seconds) +## Monitored directory scan period (seconds) # jetty.deploy.scanInterval=1 -# Whether to extract *.war files +## Whether to extract *.war files # jetty.deploy.extractWars=true + +## Whether to give the parent classloader priority +# jetty.deploy.parentLoaderPriority=true + +## Comma separated list of configuration classes to set. +# jetty.deploy.configurationClasses= + +## Base temporary directory for deployed web applications. +# jetty.deploy.tempDir= + +## Pattern to select jars from the container classloader to be scanned (or null to scan no jars) +# jetty.deploy.containerScanJarPattern=.*jakarta.servlet.jsp.jstl-.*\.jar$ + +## Pattern to select jars from the container classloader to be scanned (or null to scan all jars). +# jetty.deploy.webInfScanJarPattern= + +## Pattern to exclude discovered ServletContainerInitializers +# jetty.deploy.servletContainerInitializerExclusionPattern= + +## Order of discovered ServletContainerInitializers +# jetty.deploy.servletContainerInitializerOrder= diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-jar/src/main/resources/META-INF/web-fragment.xml b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-jar/src/main/resources/META-INF/web-fragment.xml index d8b4682b92e..0c6ef494c22 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-jar/src/main/resources/META-INF/web-fragment.xml +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-jar/src/main/resources/META-INF/web-fragment.xml @@ -8,7 +8,7 @@ SerialRestServlet SerialRestServlet - org.eclipse.jetty.demos.SerialRestServlet + org.eclipse.jetty.ee9.demosSerialRestServlet SerialRestServlet @@ -18,7 +18,7 @@ AsyncRestServlet AsyncRestServlet - org.eclipse.jetty.demos.AsyncRestServlet + org.eclipse.jetty.ee9.demosAsyncRestServlet true diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/demo.d/ee9-demo-async-rest.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/demo.d/ee9-demo-async-rest.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/demo.d/ee9-demo-async-rest.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/ee9-demo-async-rest.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/ee9-demo-async-rest.mod index 574ef45e0d6..be791dfde0d 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/ee9-demo-async-rest.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-async-rest/jetty-ee9-demo-async-rest-webapp/src/main/config/modules/ee9-demo-async-rest.mod @@ -14,5 +14,5 @@ webapp ee9-deploy [files] -maven://org.eclipse.jetty.ee9.demos/ee9-demo-async-rest-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-async-rest.war - +basehome:modules/demo.d/ee9-demo-async-rest.properties|webapps/ee9-demo-async-rest.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-async-rest-webapp/${jetty.version}/war|webapps/ee9-demo-async-rest.war diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-embedded/src/main/resources/exampleserver.xml b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-embedded/src/main/resources/exampleserver.xml index 48b43f22169..2b1ef1d851d 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-embedded/src/main/resources/exampleserver.xml +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-embedded/src/main/resources/exampleserver.xml @@ -19,7 +19,7 @@ /hello - org.eclipse.jetty.demos.HelloServlet + org.eclipse.jetty.ee9.demos.HelloServlet / diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/demo.d/ee9-demo-jaas.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod index 816ac38071d..a01cf51f30e 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jaas-webapp/src/main/config/modules/ee9-demo-jaas.mod @@ -19,10 +19,11 @@ ee9-annotations ext [files] -basehome:modules/demo.d/ee9-demo-jaas.xml|webapps-ee9/ee9-demo-jaas.xml +basehome:modules/demo.d/ee9-demo-jaas.xml|webapps/ee9-demo-jaas.xml +basehome:modules/demo.d/ee9-demo-jaas.properties|webapps/ee9-demo-jaas.properties basehome:modules/demo.d/ee9-demo-login.conf|etc/ee9-demo-login.conf basehome:modules/demo.d/ee9-demo-login.properties|etc/ee9-demo-login.properties -maven://org.eclipse.jetty.ee9.demos/ee9-demo-jaas-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-jaas.war +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-jaas-webapp/${jetty.version}/war|webapps/ee9-demo-jaas.war [ini] # Enable security via jaas, and configure it diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/demo.d/ee9-demo-jetty.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/demo.d/ee9-demo-jetty.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/demo.d/ee9-demo-jetty.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-jetty.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-jetty.mod index 5b5d1f1af90..a4b31b7498f 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-jetty.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-jetty.mod @@ -24,6 +24,7 @@ ee9-demo-realm [files] webapps-ee9/demo-jetty.d/ -basehome:modules/demo.d/ee9-demo-jetty.xml|webapps-ee9/ee9-demo-jetty.xml -basehome:modules/demo.d/ee9-demo-jetty-override-web.xml|webapps-ee9/ee9-demo-jetty.d/ee9-demo-jetty-override-web.xml -maven://org.eclipse.jetty.ee9.demos/ee9-demo-jetty-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-jetty.war +basehome:modules/demo.d/ee9-demo-jetty.xml|webapps/ee9-demo-jetty.xml +basehome:modules/demo.d/ee9-demo-jetty-override-web.xml|webapps/ee9-demo-jetty.d/ee9-demo-jetty-override-web.xml +basehome:modules/demo.d/ee9-demo-jetty.properties|webapps/ee9-demo-jetty.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-jetty-webapp/${jetty.version}/war|webapps/ee9-demo-jetty.war diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-moved-context.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-moved-context.mod index 96583842d9e..57f1c42b0ad 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-moved-context.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jetty-webapp/src/main/config/modules/ee9-demo-moved-context.mod @@ -13,5 +13,5 @@ demo ee9-deploy [files] -basehome:modules/demo.d/ee9-demo-moved-context.xml|webapps-ee9/ee9-demo-moved-context.xml +basehome:modules/demo.d/ee9-demo-moved-context.xml|webapps/ee9-demo-moved-context.xml diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/demo.d/ee9-demo-jndi.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/demo.d/ee9-demo-jndi.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/demo.d/ee9-demo-jndi.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/ee9-demo-jndi.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/ee9-demo-jndi.mod index 6f103be7e66..9b330a1edc1 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/ee9-demo-jndi.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jndi-webapp/src/main/config/modules/ee9-demo-jndi.mod @@ -18,6 +18,7 @@ ee9-plus ee9-demo-mock-resources [files] -basehome:modules/demo.d/ee9-demo-jndi.xml|webapps-ee9/ee9-demo-jndi.xml -maven://org.eclipse.jetty.ee9.demos/ee9-demo-jndi-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-jndi.war +basehome:modules/demo.d/ee9-demo-jndi.xml|webapps/ee9-demo-jndi.xml +basehome:modules/demo.d/ee9-demo-jndi.properties|webapps/ee9-demo-jndi.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-jndi-webapp/${jetty.version}/war|webapps/ee9-demo-jndi.war maven://jakarta.mail/jakarta.mail-api/2.0.0/jar|lib/ext/jakarta.mail-api-2.0.0.jar diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/demo.d/ee9-demo-jsp.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/demo.d/ee9-demo-jsp.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/demo.d/ee9-demo-jsp.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/ee9-demo-jsp.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/ee9-demo-jsp.mod index 7a9d56b6826..7863a006985 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/ee9-demo-jsp.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-jsp-webapp/src/main/config/modules/ee9-demo-jsp.mod @@ -14,4 +14,5 @@ jstl ee9-deploy [files] -maven://org.eclipse.jetty.ee9.demos/ee9-demo-jsp-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-jsp.war +basehome:modules/demo.d/ee9-demo-jsp.properties|webapps/ee9-demo-jsp.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-jsp-webapp/${jetty.version}/war|webapps/ee9-demo-jsp.war diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/pom.xml b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/pom.xml index 0eb389365ec..605c0b6d2ac 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/pom.xml +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/pom.xml @@ -24,7 +24,7 @@ - org.eclipse.jetty.demos.ee9-demo-mock-resources + org.eclipse.jetty.ee9.demos.ee9-demo-mock-resources Mock resources used for testing org.example;version="${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}" diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/src/main/config/modules/ee9-demo-mock-resources.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/src/main/config/modules/ee9-demo-mock-resources.mod index 4aab81e61b3..ccefbae6cd8 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/src/main/config/modules/ee9-demo-mock-resources.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-mock-resources/src/main/config/modules/ee9-demo-mock-resources.mod @@ -14,4 +14,4 @@ jdbc ee9-annotations [files] -maven://org.eclipse.jetty.ee9.demos/ee9-demo-mock-resources/${jetty.version}/jar|lib/ext/ee9-demo-mock-resources-${jetty.version}.jar +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-mock-resources/${jetty.version}/jar|lib/ext/ee9-demo-mock-resources-${jetty.version}.jar diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/demo.d/ee9-demo-proxy.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/demo.d/ee9-demo-proxy.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/demo.d/ee9-demo-proxy.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/ee9-demo-proxy.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/ee9-demo-proxy.mod index 8cc403e682b..ca731bd10ac 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/ee9-demo-proxy.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-proxy-webapp/src/main/config/modules/ee9-demo-proxy.mod @@ -14,4 +14,5 @@ webapp ee9-deploy [files] -maven://org.eclipse.jetty.ee9.demos/ee9-demo-proxy-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-proxy.war +basehome:modules/demo.d/ee9-demo-proxy.properties|webapps/ee9-demo-proxy.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-proxy-webapp/${jetty.version}/war|webapps/ee9-demo-proxy.war diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/demo.d/ee9-demo-simple.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/demo.d/ee9-demo-simple.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/demo.d/ee9-demo-simple.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/ee9-demo-simple.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/ee9-demo-simple.mod index 90e13d683d7..96f71170911 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/ee9-demo-simple.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-simple-webapp/src/main/config/modules/ee9-demo-simple.mod @@ -12,4 +12,5 @@ webapp ee9-deploy [files] -maven://org.eclipse.jetty.ee9.demos/ee9-demo-simple-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-simple.war +basehome:modules/demo.d/ee9-demo-simple.properties|webapps/ee9-demo-simple.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-simple-webapp/${jetty.version}/war|webapps/ee9-demo-simple.war diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-container-initializer/pom.xml b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-container-initializer/pom.xml index 0b29c50d96d..7b2dc1ae970 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-container-initializer/pom.xml +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-container-initializer/pom.xml @@ -20,7 +20,7 @@ true - org.eclipse.jetty.demos.ee9-demo-servlet-container-initializer;singleton:=true + org.eclipse.jetty.ee9.demos.ee9-demo-servlet-container-initializer;singleton:=true A bundle containing a ServletContainerInitializer for testing osgi.extender; filter:="(osgi.extender=osgi.serviceloader.registrar)" osgi.serviceloader; osgi.serviceloader=jakarta.servlet.ServletContainerInitializer diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/demo.d/ee9-demo-spec.properties b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/demo.d/ee9-demo-spec.properties new file mode 100644 index 00000000000..17a01425df9 --- /dev/null +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/demo.d/ee9-demo-spec.properties @@ -0,0 +1 @@ +environment: ee9 diff --git a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/ee9-demo-spec.mod b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/ee9-demo-spec.mod index 5d8f7b3a38b..ccb7d83ddf2 100644 --- a/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/ee9-demo-spec.mod +++ b/jetty-ee9/jetty-ee9-demos/jetty-ee9-demo-spec/jetty-ee9-demo-spec-webapp/src/main/config/modules/ee9-demo-spec.mod @@ -20,5 +20,6 @@ ee9-demo-realm ee9-demo-mock-resources [files] -basehome:modules/demo.d/ee9-demo-spec.xml|webapps-ee9/ee9-demo-spec.xml -maven://org.eclipse.jetty.ee9.demos/ee9-demo-spec-webapp/${jetty.version}/war|webapps-ee9/ee9-demo-spec.war +basehome:modules/demo.d/ee9-demo-spec.xml|webapps/ee9-demo-spec.xml +basehome:modules/demo.d/ee9-demo-spec.properties|webapps/ee9-demo-spec.properties +maven://org.eclipse.jetty.ee9.demos/jetty-ee9-demo-spec-webapp/${jetty.version}/war|webapps/ee9-demo-spec.war diff --git a/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/JettyHomeForker.java b/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/JettyHomeForker.java index ec3df1d4f38..2bce96467d4 100644 --- a/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/JettyHomeForker.java +++ b/jetty-ee9/jetty-ee9-maven-plugin/src/main/java/org/eclipse/jetty/ee9/maven/plugin/JettyHomeForker.java @@ -350,7 +350,7 @@ public class JettyHomeForker extends AbstractForker modulesPath = Files.createDirectories(targetBasePath.resolve("modules")); etcPath = Files.createDirectories(targetBasePath.resolve("etc")); libPath = Files.createDirectories(targetBasePath.resolve("lib")); - webappPath = Files.createDirectories(targetBasePath.resolve("webapps-ee9")); + webappPath = Files.createDirectories(targetBasePath.resolve("webapps")); mavenLibPath = Files.createDirectories(libPath.resolve("maven-ee9")); //copy in the jetty-maven-plugin jar diff --git a/jetty-ee9/jetty-ee9-nested/pom.xml b/jetty-ee9/jetty-ee9-nested/pom.xml index 9dab47c92ae..7f32d0011e9 100644 --- a/jetty-ee9/jetty-ee9-nested/pom.xml +++ b/jetty-ee9/jetty-ee9-nested/pom.xml @@ -39,7 +39,7 @@ org.eclipse.jetty - jetty-io + jetty-ee org.eclipse.jetty diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/module-info.java b/jetty-ee9/jetty-ee9-nested/src/main/java/module-info.java index 31df95a1c1b..ed6694df9d3 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/module-info.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/module-info.java @@ -14,6 +14,7 @@ module org.eclipse.jetty.ee9.nested { requires transitive jetty.servlet.api; + requires transitive org.eclipse.jetty.ee; requires transitive org.eclipse.jetty.http; requires transitive org.eclipse.jetty.server; requires transitive org.eclipse.jetty.session; diff --git a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ContextHandler.java b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ContextHandler.java index 91c081022c9..b103500a31a 100644 --- a/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ContextHandler.java +++ b/jetty-ee9/jetty-ee9-nested/src/main/java/org/eclipse/jetty/ee9/nested/ContextHandler.java @@ -198,7 +198,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu protected ContextStatus _contextStatus = ContextStatus.NOTSET; protected APIContext _apiContext; private final Map _initParams; - private boolean _contextPathDefault = true; private String _defaultRequestCharacterEncoding; private String _defaultResponseCharacterEncoding; private String _contextPathEncoded = "/"; @@ -1065,19 +1064,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu _coreContextHandler.setClassLoader(classLoader); } - /** - * Set the default context path. - * A default context path may be overriden by a default-context-path element - * in a web.xml - * - * @param contextPath The _contextPath to set. - */ - public void setDefaultContextPath(String contextPath) - { - setContextPath(contextPath); - _contextPathDefault = true; - } - public void setDefaultRequestCharacterEncoding(String encoding) { _defaultRequestCharacterEncoding = encoding; @@ -1098,14 +1084,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu return _defaultResponseCharacterEncoding; } - /** - * @return True if the current contextPath is from default settings - */ - public boolean isContextPathDefault() - { - return _contextPathDefault; - } - /** * @param contextPath The _contextPath to set. */ @@ -1133,7 +1111,6 @@ public class ContextHandler extends ScopedHandler implements Attributes, Gracefu _coreContextHandler.setContextPath(contextPath); _contextPathEncoded = URIUtil.encodePath(contextPath); - _contextPathDefault = false; // update context mappings if (getServer() != null && getServer().isRunning()) diff --git a/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi-fragment/pom.xml b/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi-fragment/pom.xml index bbe776ab451..38eb5e0119b 100644 --- a/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi-fragment/pom.xml +++ b/jetty-ee9/jetty-ee9-osgi/test-jetty-ee9-osgi-fragment/pom.xml @@ -48,7 +48,7 @@ ${bundle-symbolic-name} Jetty OSGi Test WebApp Fragment J2SE-1.5 - org.eclipse.jetty.demos.spec.webapp + org.eclipse.jetty.ee9.demos.spec.webapp / diff --git a/jetty-ee9/jetty-ee9-webapp/src/main/config/etc/jetty-ee9-deploy.xml b/jetty-ee9/jetty-ee9-webapp/src/main/config/etc/jetty-ee9-deploy.xml index ac0c7ed5388..c24d602719a 100644 --- a/jetty-ee9/jetty-ee9-webapp/src/main/config/etc/jetty-ee9-deploy.xml +++ b/jetty-ee9/jetty-ee9-webapp/src/main/config/etc/jetty-ee9-deploy.xml @@ -21,41 +21,39 @@ - ee9 + ee9 - + - - - jetty.deploy.defaultsDescriptorPath - - /etc/webdefault-ee9.xml - - - - - - - - - - - - - - - + + + + + + + + + + .*jakarta.servlet.jsp.jstl-.*\.jar$ + + + + + + + + + + + + diff --git a/jetty-ee9/jetty-ee9-webapp/src/main/config/modules/ee9-deploy.mod b/jetty-ee9/jetty-ee9-webapp/src/main/config/modules/ee9-deploy.mod index 59b63f4fe9a..222fa7b9a44 100644 --- a/jetty-ee9/jetty-ee9-webapp/src/main/config/modules/ee9-deploy.mod +++ b/jetty-ee9/jetty-ee9-webapp/src/main/config/modules/ee9-deploy.mod @@ -11,23 +11,44 @@ ee9-webapp [lib] [files] -webapps-ee9/ +webapps/ [xml] etc/jetty-ee9-deploy.xml [ini-template] -# Monitored directory name (relative to $jetty.base) -# jetty.deploy.monitoredDir=webapps-ee9 -# - OR - -# Monitored directory path (fully qualified) -# jetty.deploy.monitoredPath=/var/www/webapps-ee9 +## Monitored directory name (relative to $jetty.base) +# jetty.deploy.monitoredDir=webapps +## - OR - +## Monitored directory path (fully qualified) +# jetty.deploy.monitoredPath=/var/www/webapps -# Defaults Descriptor for all deployed webapps -# jetty.deploy.defaultsDescriptorPath=${jetty.base}/etc/webdefault-ee9.xml +## Defaults Descriptor for all deployed webapps +# jetty.deploy.defaultsDescriptor=${jetty.base}/etc/webdefault-ee9.xml -# Monitored directory scan period (seconds) +## Monitored directory scan period (seconds) # jetty.deploy.scanInterval=1 -# Whether to extract *.war files +## Whether to extract *.war files # jetty.deploy.extractWars=true + +## Whether to give the parent classloader priority +# jetty.deploy.parentLoaderPriority=true + +## Comma separated list of configuration classes to set. +# jetty.deploy.configurationClasses= + +## Base temporary directory for deployed web applications. +# jetty.deploy.tempDir= + +## Pattern to select jars from the container classloader to be scanned (or null to scan no jars) +# jetty.deploy.containerScanJarPattern=.*jakarta.servlet.jsp.jstl-.*\.jar$ + +## Pattern to select jars from the container classloader to be scanned (or null to scan all jars). +# jetty.deploy.webInfScanJarPattern= + +## Pattern to exclude discovered ServletContainerInitializers +# jetty.deploy.servletContainerInitializerExclusionPattern= + +## Order of discovered ServletContainerInitializers +# jetty.deploy.servletContainerInitializerOrder= diff --git a/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java b/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java index dc88d3e8512..389875bfec2 100644 --- a/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java +++ b/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/MetaInfConfiguration.java @@ -36,7 +36,9 @@ import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.stream.Collectors; +import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.PatternMatcher; +import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.resource.EmptyResource; import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.ResourceCollection; @@ -186,9 +188,13 @@ public class MetaInfConfiguration extends AbstractConfiguration */ public void findAndFilterContainerPaths(final WebAppContext context) throws Exception { + String pattern = (String)context.getAttribute(CONTAINER_JAR_PATTERN); + if (StringUtil.isBlank(pattern)) + return; // TODO review if this short cut will allow later code simplifications + // Apply an initial name filter to the jars to select which will be eventually // scanned for META-INF info and annotations. The filter is based on inclusion patterns. - ContainerPathNameMatcher containerPathNameMatcher = new ContainerPathNameMatcher(context, (String)context.getAttribute(CONTAINER_JAR_PATTERN)); + ContainerPathNameMatcher containerPathNameMatcher = new ContainerPathNameMatcher(context, pattern); List containerUris = getAllContainerJars(context); if (LOG.isDebugEnabled()) @@ -284,22 +290,19 @@ public class MetaInfConfiguration extends AbstractConfiguration protected List getAllContainerJars(final WebAppContext context) throws URISyntaxException { List uris = new ArrayList<>(); - if (context.getClassLoader() != null) + ClassLoader loader = MetaInfConfiguration.class.getClassLoader(); + while (loader != null) { - ClassLoader loader = context.getClassLoader().getParent(); - while (loader != null) + if (loader instanceof URLClassLoader) { - if (loader instanceof URLClassLoader) + URL[] urls = ((URLClassLoader)loader).getURLs(); + if (urls != null) { - URL[] urls = ((URLClassLoader)loader).getURLs(); - if (urls != null) - for (URL url : urls) - { - uris.add(new URI(url.toString().replaceAll(" ", "%20"))); - } + for (URL url : urls) + uris.add(new URI(url.toString().replaceAll(" ", "%20"))); } - loader = loader.getParent(); } + loader = loader.getParent(); } return uris; } diff --git a/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/WebAppContext.java b/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/WebAppContext.java index 15ef2771d53..85e7b502c5f 100644 --- a/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/WebAppContext.java +++ b/jetty-ee9/jetty-ee9-webapp/src/main/java/org/eclipse/jetty/ee9/webapp/WebAppContext.java @@ -38,10 +38,9 @@ import jakarta.servlet.http.HttpSessionAttributeListener; import jakarta.servlet.http.HttpSessionBindingListener; import jakarta.servlet.http.HttpSessionIdListener; import jakarta.servlet.http.HttpSessionListener; -import org.eclipse.jetty.ee9.nested.AbstractHandler; +import org.eclipse.jetty.ee.Deployable; import org.eclipse.jetty.ee9.nested.ContextHandler; import org.eclipse.jetty.ee9.nested.ErrorHandler; -import org.eclipse.jetty.ee9.nested.ManagedAttributeListener; import org.eclipse.jetty.ee9.nested.SessionHandler; import org.eclipse.jetty.ee9.security.ConstraintAware; import org.eclipse.jetty.ee9.security.ConstraintMapping; @@ -50,13 +49,12 @@ import org.eclipse.jetty.ee9.security.SecurityHandler; import org.eclipse.jetty.ee9.servlet.ErrorPageErrorHandler; import org.eclipse.jetty.ee9.servlet.ServletContextHandler; import org.eclipse.jetty.ee9.servlet.ServletHandler; -import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.server.Connector; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.Attributes; import org.eclipse.jetty.util.MultiException; -import org.eclipse.jetty.util.TopologicalSort; +import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @@ -79,76 +77,9 @@ import org.slf4j.LoggerFactory; * the default being {@link WebXmlConfiguration} and * {@link JettyWebXmlConfiguration}. * - * - *

- * The Start/Configuration of a WebAppContext is rather complex so as to allow - * pluggable behaviour to be added in almost arbitrary ordering. The - * sequence of a WebappContext start is as follows: - *

- * {@link #doStart()}: - *
    - *
  • {@link #preConfigure()} - *
      - *
    • Add all Server class inclusions from all known configurations {@link Configurations#getKnown()}
    • - *
    • {@link #loadConfigurations()}, which uses either explicitly set Configurations or takes the server - * default (which is all known {@link Configuration#isEnabledByDefault()} Configurations.
    • - *
    • Sort the configurations using {@link TopologicalSort} in {@link Configurations#sort()}.
    • - *
    • Add all Server class exclusions from this webapps {@link Configurations}
    • - *
    • Add all System classes inclusions and exclusions for this webapps {@link Configurations}
    • - *
    • Instantiate the WebAppClassLoader (if one not already explicitly set)
    • - *
    • {@link Configuration#preConfigure(WebAppContext)} which calls - * {@link Configuration#preConfigure(WebAppContext)} for this webapps {@link Configurations}
    • - *
    - *
  • - *
  • {@link ServletContextHandler#doStart()} - *
      - *
    • {@link ContextHandler#doStart()} - *
        - *
      • Init {@link MimeTypes}
      • - *
      • enterScope - *
          - *
        • {@link #startContext()} - *
            - *
          • {@link #configure()} - *
              - *
            • Call {@link Configuration#configure(WebAppContext)} on enabled {@link Configurations}
            • - *
            - *
          • - *
          • {@link MetaData#resolve(WebAppContext)}
          • - *
          • {@link #startContext()} - *
          • QuickStart may generate here and/or abort start - *
              - *
            • {@link ServletContextHandler#startContext} - *
                - *
              • Decorate listeners
              • - *
              • {@link ContextHandler#startContext} - *
                  - *
                • add {@link ManagedAttributeListener}
                • - *
                • {@link AbstractHandler#doStart}
                • - *
                • {@link #callContextInitialized(jakarta.servlet.ServletContextListener, jakarta.servlet.ServletContextEvent)}
                • - *
                - *
              • - *
              • {@link ServletHandler#initialize()}
              • - *
              - *
            • - *
            - *
          • - *
          - *
        • - *
        - *
      • - *
      • exitScope
      • - *
      - *
    • - *
    - *
  • - *
  • {@link #postConfigure()}
  • - *
- * - *
*/ @ManagedObject("Web Application ContextHandler") -public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context +public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context, Deployable { static final Logger LOG = LoggerFactory.getLogger(WebAppContext.class); @@ -211,6 +142,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL private boolean _throwUnavailableOnStartupException = false; private MetaData _metadata = new MetaData(); + private boolean _defaultContextPath = true; public static WebAppContext getCurrentWebAppContext() { @@ -307,6 +239,54 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL parent.addHandler(this); } + @Override + public void initializeDefaults(Map properties) + { + for (String property : properties.keySet()) + { + String value = properties.get(property); + if (LOG.isDebugEnabled()) + LOG.debug("init {}: {}", property, value); + switch (property) + { + case Deployable.WAR -> setWar(value); + case Deployable.BASE_TEMP_DIR -> setAttribute(BASETEMPDIR, value); + case Deployable.CONFIGURATION_CLASSES -> setConfigurationClasses(value == null ? null : value.split(",")); + case Deployable.CONTAINER_SCAN_JARS -> setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, value); + case Deployable.EXTRACT_WARS -> setExtractWAR(Boolean.parseBoolean(value)); + case Deployable.PARENT_LOADER_PRIORITY -> setParentLoaderPriority(Boolean.parseBoolean(value)); + case Deployable.WEBINF_SCAN_JARS -> setAttribute(MetaInfConfiguration.WEBINF_JAR_PATTERN, value); + case Deployable.DEFAULTS_DESCRIPTOR -> setDefaultsDescriptor(value); + case Deployable.SCI_EXCLUSION_PATTERN -> setAttribute("org.eclipse.jetty.containerInitializerExclusionPattern", value); + case Deployable.SCI_ORDER -> setAttribute("org.eclipse.jetty.containerInitializerOrder", value); + default -> + { + if (LOG.isDebugEnabled() && StringUtil.isNotBlank(value)) + LOG.debug("unknown property {}={}", property, value); + } + } + } + _defaultContextPath = true; + } + + public boolean isContextPathDefault() + { + return _defaultContextPath; + } + + @Override + public void setContextPath(String contextPath) + { + super.setContextPath(contextPath); + _defaultContextPath = false; + } + + public void setDefaultContextPath(String contextPath) + { + super.setContextPath(contextPath); + _defaultContextPath = true; + } + /** * @param displayName The servletContextName to set. */ @@ -950,14 +930,14 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL name = String.format("%s@%x", name, hashCode()); dumpObjects(out, indent, - Dumpable.named("environment", ENVIRONMENT.getName()), + Dumpable.named("environment", ContextHandler.ENVIRONMENT.getName()), new ClassLoaderDump(getClassLoader()), new DumpableCollection("Systemclasses " + name, systemClasses), new DumpableCollection("Serverclasses " + name, serverClasses), new DumpableCollection("Configurations " + name, _configurations), new DumpableCollection("Handler attributes " + name, getAttributes().asAttributeMap().entrySet()), new DumpableCollection("Context attributes " + name, getServletContext().getContextHandler().asAttributeMap().entrySet()), - new DumpableCollection("Environment attributes " + name, ENVIRONMENT.asAttributeMap().entrySet()), + new DumpableCollection("Environment attributes " + name, ContextHandler.ENVIRONMENT.asAttributeMap().entrySet()), new DumpableCollection("EventListeners " + this, getEventListeners()), new DumpableCollection("Initparams " + name, getInitParams().entrySet()) ); diff --git a/jetty-ee9/jetty-ee9-webapp/src/test/java/org/eclipse/jetty/ee9/webapp/MetaInfConfigurationTest.java b/jetty-ee9/jetty-ee9-webapp/src/test/java/org/eclipse/jetty/ee9/webapp/MetaInfConfigurationTest.java index a67102f5036..dbcf94fb05f 100644 --- a/jetty-ee9/jetty-ee9-webapp/src/test/java/org/eclipse/jetty/ee9/webapp/MetaInfConfigurationTest.java +++ b/jetty-ee9/jetty-ee9-webapp/src/test/java/org/eclipse/jetty/ee9/webapp/MetaInfConfigurationTest.java @@ -20,7 +20,6 @@ import java.util.List; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; import org.eclipse.jetty.util.resource.Resource; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -131,12 +130,11 @@ public class MetaInfConfigurationTest * @throws Exception if the test fails */ @Test - @Disabled // TODO public void testFindAndFilterContainerPathsJDK9() throws Exception { MetaInfConfiguration config = new MetaInfConfiguration(); WebAppContext context = new WebAppContext(); - context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*/jetty-util-[^/]*\\.jar$|.*/jetty-util/target/classes/$|.*/foo-bar-janb.jar"); + context.setAttribute(MetaInfConfiguration.CONTAINER_JAR_PATTERN, ".*servlet-api-[^/]*\\.jar$|.*/foo-bar-janb.jar"); WebAppClassLoader loader = new WebAppClassLoader(context); context.setClassLoader(loader); config.findAndFilterContainerPaths(context); @@ -145,7 +143,7 @@ public class MetaInfConfigurationTest for (Resource r : containerResources) { String s = r.toString(); - assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("jetty-util")); + assertTrue(s.endsWith("foo-bar-janb.jar") || s.contains("servlet-api")); } } } diff --git a/jetty-home/src/main/resources/modules/ee10-demo-root.mod b/jetty-home/src/main/resources/modules/ee10-demo-root.mod index 2f53d5fbf7e..cf69f038e16 100644 --- a/jetty-home/src/main/resources/modules/ee10-demo-root.mod +++ b/jetty-home/src/main/resources/modules/ee10-demo-root.mod @@ -16,7 +16,7 @@ deploy [files] webapps-ee10/root-ee10/ webapps-ee10/root-ee10/images/ -basehome:modules/demo.d/ee10-root/index.html|webapps-ee10/root-ee10/index.html -basehome:modules/demo.d/ee10-root/jetty.css|webapps-ee10/root-ee10/jetty.css -basehome:modules/demo.d/ee10-root/images/jetty-pic.png|webapps-ee10/root-ee10/images/jetty-pic.png -basehome:modules/demo.d/ee10-root/images/webtide_logo.jpg|webapps-ee10/root-ee10/images/webtide_logo.jpg +basehome:modules/demo.d/ee10-root/index.html|webapps/root-ee10/index.html +basehome:modules/demo.d/ee10-root/jetty.css|webapps/root-ee10/jetty.css +basehome:modules/demo.d/ee10-root/images/jetty-pic.png|webapps/root-ee10/images/jetty-pic.png +basehome:modules/demo.d/ee10-root/images/webtide_logo.jpg|webapps/root-ee10/images/webtide_logo.jpg diff --git a/pom.xml b/pom.xml index 760f0c5c0d7..61b991c2d43 100644 --- a/pom.xml +++ b/pom.xml @@ -186,7 +186,7 @@ jetty-core jetty-integrations - jetty-ee8 + jetty-ee9 jetty-ee10 jetty-home @@ -1208,6 +1208,11 @@ jetty-deploy ${project.version}
+ + org.eclipse.jetty + jetty-ee + ${project.version} + org.eclipse.jetty jetty-hazelcast