Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Jetty 12.1.x jetty ee web xml (#11746)
* Resolve jetty-eeX-web.xml before jetty-web.xml
- Loading branch information
Showing
15 changed files
with
561 additions
and
87 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
73 changes: 73 additions & 0 deletions
73
...ee10-webapp/src/test/java/org/eclipse/jetty/ee10/webapp/JettyWebXmlConfigurationTest.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,73 @@ | ||
// | ||
// ======================================================================== | ||
// 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.webapp; | ||
|
||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
|
||
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.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.is; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
||
public class JettyWebXmlConfigurationTest | ||
{ | ||
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-web-xml"); | ||
assertTrue(Files.exists(testWebappDir)); | ||
|
||
WebAppContext context = new WebAppContext(); | ||
context.setContextPath("/banana"); | ||
_server.setHandler(context); | ||
context.setWar(testWebappDir.toFile().getAbsolutePath()); | ||
_server.start(); | ||
assertThat(context.getContextPath(), is("/orange")); | ||
} | ||
|
||
@Test | ||
public void testWithJettyEEWebXml() throws Exception | ||
{ | ||
Path testWebappDir = MavenTestingUtils.getTargetPath("test-classes/webapp-with-jetty-ee10-web-xml"); | ||
assertTrue(Files.exists(testWebappDir)); | ||
|
||
WebAppContext context = new WebAppContext(); | ||
context.setContextPath("/banana"); | ||
_server.setHandler(context); | ||
context.setWar(testWebappDir.toFile().getAbsolutePath()); | ||
_server.start(); | ||
assertThat(context.getContextPath(), is("/raspberry")); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...-ee10-webapp/src/test/resources/webapp-with-jetty-ee10-web-xml/WEB-INF/jetty-ee10-web.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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- // --> | ||
<!-- // ======================================================================== --> | ||
<!-- // 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 --> | ||
<!-- // ======================================================================== --> | ||
<!-- // --> | ||
|
||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://eclipse.dev/jetty/configure_10_0.dtd"> | ||
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
<Set name="contextPath">/raspberry</Set> | ||
</Configure> | ||
|
19 changes: 19 additions & 0 deletions
19
...jetty-ee10-webapp/src/test/resources/webapp-with-jetty-ee10-web-xml/WEB-INF/jetty-web.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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- // --> | ||
<!-- // ======================================================================== --> | ||
<!-- // 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 --> | ||
<!-- // ======================================================================== --> | ||
<!-- // --> | ||
|
||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://eclipse.dev/jetty/configure_10_0.dtd"> | ||
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
<Set name="contextPath">/apple</Set> | ||
</Configure> | ||
|
19 changes: 19 additions & 0 deletions
19
...ee10/jetty-ee10-webapp/src/test/resources/webapp-with-jetty-web-xml/WEB-INF/jetty-web.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,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- // --> | ||
<!-- // ======================================================================== --> | ||
<!-- // 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 --> | ||
<!-- // ======================================================================== --> | ||
<!-- // --> | ||
|
||
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://eclipse.dev/jetty/configure_10_0.dtd"> | ||
<Configure class="org.eclipse.jetty.ee10.webapp.WebAppContext"> | ||
<Set name="contextPath">/orange</Set> | ||
</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.