Skip to content

Commit

Permalink
Issue warning for overlap on reserved env configuration names in the …
Browse files Browse the repository at this point in the history
…webapps/ directory.
  • Loading branch information
joakime committed Jan 22, 2025
1 parent c7fdc92 commit 745f4fe
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,28 @@ public void pathsChanged(Map<Path, Scanner.Notification> changeSet)
String envname = getEnvironmentName(basename, environmentNames);
if (StringUtil.isNotBlank(envname))
{
// we have an environment configuration specific path entry.
changedBaseNames.add(envname);
Unit unit = units.computeIfAbsent(envname, Unit::new);
unit.setEnvironmentConfigName(envname);
unit.putPath(path, state);
// The file starts with a known environment name.
// We only care if it is a Environment Configuration file, namely an XML or Properties file.
if (FileID.isExtension(path, "xml", "properties"))
{
// we have an environment configuration specific path entry.
changedBaseNames.add(envname);
Unit unit = units.computeIfAbsent(envname, Unit::new);
unit.setEnvironmentConfigName(envname);
unit.putPath(path, state);
}
else
{
LOG.warn("Encountered Path that uses reserved Environment name prefix " +
"(This is seen as a configuration for the environment) [{}]: {}", envname, path);
// This is something like ee10-app.war
// For now, we add it to the basename, but in the future, this will be rejected
// as it prevents the use of a configuration file like ee10-app.xml next to it (which
// will be seen as a XML to configure the ee10 environment, not an XML for deploying that war)
changedBaseNames.add(basename);
Unit unit = units.computeIfAbsent(basename, Unit::new);
unit.putPath(path, state);
}
}
else
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_6_0.xsd"
metadata-complete="false"
version="6.0">
version="6.0">

<display-name>EE10 Demo Jetty Websocket WebApp</display-name>
<display-name>EE10 Demo Jetty Websocket WebApp</display-name>

<servlet>
<servlet-name>WSChat</servlet-name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<artifactId>jetty-ee10-test-webapp-rfc2616</artifactId>
<version>${project.version}</version>
<type>war</type>
<destFileName>ee10-test-rfc2616.war</destFileName>
<destFileName>jetty-ee10-test-rfc2616.war</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.demos</groupId>
Expand All @@ -157,7 +157,7 @@
<groupId>org.eclipse.jetty.ee10.demos</groupId>
<artifactId>jetty-ee10-demo-jetty-websocket-webapp</artifactId>
<type>war</type>
<destFileName>ee10-demo-jetty-websocket.war</destFileName>
<destFileName>jetty-ee10-demo-jetty-websocket.war</destFileName>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
<artifactId>jetty-ee11-test-webapp-rfc2616</artifactId>
<version>${project.version}</version>
<type>war</type>
<destFileName>ee11-test-rfc2616.war</destFileName>
<destFileName>jetty-ee11-test-rfc2616.war</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.demos</groupId>
Expand All @@ -157,7 +157,7 @@
<groupId>org.eclipse.jetty.ee11.demos</groupId>
<artifactId>jetty-ee11-demo-jetty-websocket-webapp</artifactId>
<type>war</type>
<destFileName>ee11-demo-jetty-websocket.war</destFileName>
<destFileName>jetty-ee11-demo-jetty-websocket.war</destFileName>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,34 @@
<Set name="contexts">
<Ref refid="Contexts" />
</Set>

<Call name="addAppProvider">
<Arg>
<New id="WebAppProvider" class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDirName">
<Call name="resolvePath" class="org.eclipse.jetty.xml.XmlConfiguration">
<Arg>target</Arg>
<Arg>webapps</Arg>
</Call>
</Set>

<Set name="scanInterval">1</Set>

<Call name="configureEnvironment">
<Arg>ee11</Arg>
<Set name="contextHandlerClass">org.eclipse.jetty.ee11.webapp.WebAppContext</Set>
<Set name="extractWars">true</Set>
<Set name="containerScanJarPattern">
<Property name="jetty.deploy.containerScanJarPattern">
<Default>.*/jakarta.servlet-api-[^/]*\.jar$|.*wasp-.*\.jar$|.*jakarta.servlet.jsp.jstl-.*\.jar$</Default>
</Property>
<Call name="addAppProvider">
<Arg>
<New id="WebAppProvider" class="org.eclipse.jetty.deploy.providers.ContextProvider">
<Set name="monitoredDirName">
<Call name="resolvePath" class="org.eclipse.jetty.xml.XmlConfiguration">
<Arg>target</Arg>
<Arg>webapps</Arg>
</Call>
</Set>
<Set name="webInfScanJarPattern" property="jetty.deploy.webInfScanJarPattern" />
<Set name="servletContainerInitializerExclusionPattern" property="jetty.deploy.servletContainerInitializerExclusionPattern" />
<Set name="servletContainerInitializerOrder" property="jetty.deploy.servletContainerInitializerOrder" />
</Call>
</New>
</Arg>
</Call>
<Set name="scanInterval">1</Set>

<Call name="configureEnvironment">
<Arg>ee11</Arg>
<Set name="contextHandlerClass">org.eclipse.jetty.ee11.webapp.WebAppContext</Set>
<Set name="extractWars">true</Set>
<Set name="containerScanJarPattern">
<Property name="jetty.deploy.containerScanJarPattern">
<Default>.*/jakarta.servlet-api-[^/]*\.jar$|.*wasp-.*\.jar$|.*jakarta.servlet.jsp.jstl-.*\.jar$</Default>
</Property>
</Set>
<Set name="webInfScanJarPattern" property="jetty.deploy.webInfScanJarPattern" />
<Set name="servletContainerInitializerExclusionPattern" property="jetty.deploy.servletContainerInitializerExclusionPattern" />
<Set name="servletContainerInitializerOrder" property="jetty.deploy.servletContainerInitializerOrder" />
</Call>
</New>
</Arg>
</Call>
</New>
</Arg>
</Call>
Expand Down
4 changes: 2 additions & 2 deletions jetty-ee9/jetty-ee9-tests/jetty-ee9-test-integration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
<artifactId>jetty-ee9-test-webapp-rfc2616</artifactId>
<version>${project.version}</version>
<type>war</type>
<destFileName>ee9-test-rfc2616.war</destFileName>
<destFileName>jetty-ee9-test-rfc2616.war</destFileName>
</artifactItem>
<artifactItem>
<groupId>org.eclipse.jetty.demos</groupId>
Expand All @@ -167,7 +167,7 @@
<groupId>org.eclipse.jetty.ee9.demos</groupId>
<artifactId>jetty-ee9-demo-jetty-websocket-webapp</artifactId>
<type>war</type>
<destFileName>ee9-demo-jetty-websocket.war</destFileName>
<destFileName>jetty-ee9-demo-jetty-websocket.war</destFileName>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
Expand Down

0 comments on commit 745f4fe

Please sign in to comment.