-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jetty 12.0.x 11774 backport env web xml (#11966)
* Jetty 12.0.x jetty ee web xml (PR #11746) * Resolve jetty-eeX-web.xml before jetty-web.xml * Support jetty-eeX-env.xml, as per jetty-eeX-web.xml * Support jetty-eeX-env.xml, as per jetty-eeX-web.xml --------- Co-authored-by: Greg Wilkins <[email protected]>
- Loading branch information
Showing
28 changed files
with
822 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
...etty-ee10-plus/src/test/java/org/eclipse/jetty/ee10/plus/webapp/EnvConfigurationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// | ||
// ======================================================================== | ||
// Copyright (c) 1995 Mort Bay Consulting Pty Ltd and others. | ||
// | ||
// This program and the accompanying materials are made available under the | ||
// terms of the Eclipse Public License v. 2.0 which is available at | ||
// https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 | ||
// which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
// | ||
// SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
// ======================================================================== | ||
// | ||
|
||
package org.eclipse.jetty.ee10.plus.webapp; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
import org.eclipse.jetty.ee10.webapp.WebAppContext; | ||
import org.eclipse.jetty.plus.jndi.NamingEntryUtil; | ||
import org.eclipse.jetty.server.Server; | ||
import org.eclipse.jetty.toolchain.test.MavenTestingUtils; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class EnvConfigurationTest | ||
{ | ||
Server _server; | ||
|
||
@BeforeEach | ||
public void setUp() | ||
{ | ||
_server = new Server(); | ||
} | ||
|
||
@AfterEach | ||
public void tearDown() throws Exception | ||
{ | ||
if (_server != null) | ||
_server.stop(); | ||
} | ||
|
||
@Test | ||
public void testWithOnlyJettyWebXml() throws Exception | ||
{ | ||
Path testWebappDir = MavenTestingUtils.getTargetPath("test-classes/webapp-with-jetty-env-xml"); | ||
assertTrue(Files.exists(testWebappDir)); | ||
|
||
WebAppContext context = new WebAppContext(); | ||
context.setContextPath("/"); | ||
_server.setHandler(context); | ||
context.setWar(testWebappDir.toFile().getAbsolutePath()); | ||
_server.start(); | ||
assertNotNull(NamingEntryUtil.lookupNamingEntry(context, "apricot")); | ||
} | ||
|
||
@Test | ||
public void testWithJettyEEWebXml() throws Exception | ||
{ | ||
Path testWebappDir = MavenTestingUtils.getTargetPath("test-classes/webapp-with-jetty-ee10-env-xml"); | ||
assertTrue(Files.exists(testWebappDir)); | ||
|
||
WebAppContext context = new WebAppContext(); | ||
context.setContextPath("/"); | ||
_server.setHandler(context); | ||
context.setWar(testWebappDir.toFile().getAbsolutePath()); | ||
_server.start(); | ||
assertNotNull(NamingEntryUtil.lookupNamingEntry(context, "peach")); | ||
assertNull(NamingEntryUtil.lookupNamingEntry(context, "cabbage")); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ty-ee10-plus/src/test/resources/webapp-with-jetty-ee10-env-xml/WEB-INF/jetty-ee10-env.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd"> | ||
|
||
<Configure id='wac' class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
|
||
<!-- Add an EnvEntry only valid for this webapp --> | ||
<New id="gargle" class="org.eclipse.jetty.plus.jndi.EnvEntry"> | ||
<Arg><Ref refid='wac'/></Arg> | ||
<Arg>peach</Arg> | ||
<Arg type="java.lang.Double">100</Arg> | ||
<Arg type="boolean">true</Arg> | ||
</New> | ||
|
||
</Configure> | ||
|
15 changes: 15 additions & 0 deletions
15
...y-ee10-plus/src/test/resources/webapp-with-jetty-ee10-env-xml/WEB-INF/jetty-ee101-env.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd"> | ||
|
||
<Configure id='wac' class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
|
||
<!-- Add an EnvEntry only valid for this webapp --> | ||
<New id="gargle" class="org.eclipse.jetty.plus.jndi.EnvEntry"> | ||
<Arg><Ref refid='wac'/></Arg> | ||
<Arg>cabbage</Arg> | ||
<Arg type="java.lang.Double">100</Arg> | ||
<Arg type="boolean">true</Arg> | ||
</New> | ||
|
||
</Configure> | ||
|
15 changes: 15 additions & 0 deletions
15
...0/jetty-ee10-plus/src/test/resources/webapp-with-jetty-ee10-env-xml/WEB-INF/jetty-env.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd"> | ||
|
||
<Configure id='wac' class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
|
||
<!-- Add an EnvEntry only valid for this webapp --> | ||
<New id="gargle" class="org.eclipse.jetty.plus.jndi.EnvEntry"> | ||
<Arg><Ref refid='wac'/></Arg> | ||
<Arg>apricot</Arg> | ||
<Arg type="java.lang.Double">100</Arg> | ||
<Arg type="boolean">true</Arg> | ||
</New> | ||
|
||
</Configure> | ||
|
15 changes: 15 additions & 0 deletions
15
...y-ee10/jetty-ee10-plus/src/test/resources/webapp-with-jetty-env-xml/WEB-INF/jetty-env.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd"> | ||
|
||
<Configure id='wac' class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
|
||
<!-- Add an EnvEntry only valid for this webapp --> | ||
<New id="gargle" class="org.eclipse.jetty.plus.jndi.EnvEntry"> | ||
<Arg><Ref refid='wac'/></Arg> | ||
<Arg>apricot</Arg> | ||
<Arg type="java.lang.Double">100</Arg> | ||
<Arg type="boolean">true</Arg> | ||
</New> | ||
|
||
</Configure> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.