diff --git a/jetty-ee10/jetty-ee10-maven-plugin/pom.xml b/jetty-ee10/jetty-ee10-maven-plugin/pom.xml index 7c787754a86..3124b1141c4 100644 --- a/jetty-ee10/jetty-ee10-maven-plugin/pom.xml +++ b/jetty-ee10/jetty-ee10-maven-plugin/pom.xml @@ -112,8 +112,6 @@ jetty-start-gwt-it/pom.xml jetty-start-war-mojo-it/pom.xml - - jetty-effective-web-xml-it/pom.xml ${jetty.stopKey} diff --git a/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartGeneratorConfiguration.java b/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartGeneratorConfiguration.java index 67ece78fb29..0de531b58d6 100644 --- a/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartGeneratorConfiguration.java +++ b/jetty-ee10/jetty-ee10-quickstart/src/main/java/org/eclipse/jetty/ee10/quickstart/QuickStartGeneratorConfiguration.java @@ -58,6 +58,7 @@ import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.resource.AttributeNormalizer; +import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.security.Constraint; import org.eclipse.jetty.xml.XmlAppendable; import org.slf4j.Logger; @@ -165,9 +166,9 @@ public class QuickStartGeneratorConfiguration extends AbstractConfiguration out.tag("display-name", context.getDisplayName()); // Set some special context parameters - - // The location of the war file on disk - AttributeNormalizer normalizer = new AttributeNormalizer(context.getBaseResource()); + Resource base = context.getBaseResource(); + base = (base != null ? base.iterator().next() : null); + AttributeNormalizer normalizer = new AttributeNormalizer(base); // The library order addContextParamFromAttribute(context, out, ServletContext.ORDERED_LIBS); diff --git a/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/QuickStartTest.java b/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/QuickStartTest.java index 0160d65e158..81603eec463 100644 --- a/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/QuickStartTest.java +++ b/jetty-ee10/jetty-ee10-tests/jetty-ee10-test-quickstart/src/test/java/org/eclipse/jetty/ee10/quickstart/QuickStartTest.java @@ -140,12 +140,20 @@ public class QuickStartTest server.setHandler(webapp); server.start(); - URL url = new URL("http://127.0.0.1:" + server.getBean(NetworkConnector.class).getLocalPort() + "/test/"); + //test static content added by fragment + URL url = new URL("http://127.0.0.1:" + server.getBean(NetworkConnector.class).getLocalPort() + "/fragmentA/index.html"); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); + assertEquals(200, connection.getResponseCode()); + String content = IO.toString((InputStream)connection.getContent()); + assertThat(content, Matchers.containsString("Welcome to a Fragment")); + + //test annotations etc + url = new URL("http://127.0.0.1:" + server.getBean(NetworkConnector.class).getLocalPort() + "/test/"); + connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); assertEquals(200, connection.getResponseCode()); - String content = IO.toString((InputStream)connection.getContent()); + content = IO.toString((InputStream)connection.getContent()); assertThat(content, Matchers.containsString("Results")); assertThat(content, Matchers.not(Matchers.containsString("FAIL"))); server.stop(); 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 3033e09b211..084f3139487 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 @@ -450,7 +450,7 @@ public class MetaInfConfiguration extends AbstractConfiguration private static boolean isEmptyResource(Resource resourcesDir) { - return !Resources.isReadableFile(resourcesDir); + return !Resources.isReadableDirectory(resourcesDir); } /** diff --git a/jetty-ee9/jetty-ee9-maven-plugin/pom.xml b/jetty-ee9/jetty-ee9-maven-plugin/pom.xml index abf2facdff7..aa2013ed635 100644 --- a/jetty-ee9/jetty-ee9-maven-plugin/pom.xml +++ b/jetty-ee9/jetty-ee9-maven-plugin/pom.xml @@ -111,7 +111,7 @@ jetty-start-war-mojo-it/pom.xml - jetty-effective-web-xml-it/pom.xml + ${jetty.stopKey} diff --git a/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartGeneratorConfiguration.java b/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartGeneratorConfiguration.java index 01ab7f2df5d..e1c21e154cc 100644 --- a/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartGeneratorConfiguration.java +++ b/jetty-ee9/jetty-ee9-quickstart/src/main/java/org/eclipse/jetty/ee9/quickstart/QuickStartGeneratorConfiguration.java @@ -58,6 +58,7 @@ import org.eclipse.jetty.http.MimeTypes; import org.eclipse.jetty.util.QuotedStringTokenizer; import org.eclipse.jetty.util.StringUtil; import org.eclipse.jetty.util.resource.AttributeNormalizer; +import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.security.Constraint; import org.eclipse.jetty.xml.XmlAppendable; import org.slf4j.Logger; @@ -165,9 +166,9 @@ public class QuickStartGeneratorConfiguration extends AbstractConfiguration out.tag("display-name", context.getDisplayName()); // Set some special context parameters - - // The location of the war file on disk - AttributeNormalizer normalizer = new AttributeNormalizer(context.getBaseResource()); + Resource base = context.getBaseResource(); + base = (base != null ? base.iterator().next() : null); + AttributeNormalizer normalizer = new AttributeNormalizer(base); // The library order addContextParamFromAttribute(context, out, ServletContext.ORDERED_LIBS); diff --git a/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/QuickStartTest.java b/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/QuickStartTest.java index 4fb6d7dd972..800e3e21aad 100644 --- a/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/QuickStartTest.java +++ b/jetty-ee9/jetty-ee9-tests/jetty-ee9-test-quickstart/src/test/java/org/eclipse/jetty/ee9/quickstart/QuickStartTest.java @@ -149,13 +149,21 @@ public class QuickStartTest server.setHandler(webapp); server.start(); - - URL url = new URL("http://127.0.0.1:" + server.getBean(NetworkConnector.class).getLocalPort() + "/test/"); + + //test fragment static resource + URL url = new URL("http://127.0.0.1:" + server.getBean(NetworkConnector.class).getLocalPort() + "/fragmentA/index.html"); HttpURLConnection connection = (HttpURLConnection)url.openConnection(); + assertEquals(200, connection.getResponseCode()); + String content = IO.toString((InputStream)connection.getContent()); + assertThat(content, Matchers.containsString("Welcome to a Fragment")); + + //test annotations etc etc + url = new URL("http://127.0.0.1:" + server.getBean(NetworkConnector.class).getLocalPort() + "/test/"); + connection = (HttpURLConnection)url.openConnection(); connection.setRequestMethod("POST"); assertEquals(200, connection.getResponseCode()); - String content = IO.toString((InputStream)connection.getContent()); + content = IO.toString((InputStream)connection.getContent()); assertThat(content, Matchers.containsString("Results")); assertThat(content, Matchers.not(Matchers.containsString("FAIL"))); server.stop();