From a3be81e61809a846681bf398a22190becb9cc0ca Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Thu, 8 Jun 2017 22:00:24 +1000 Subject: [PATCH 01/27] add new module for hazelcast session manager Signed-off-by: olivier lamy --- jetty-distribution/pom.xml | 5 ++ jetty-hazelcast/pom.xml | 64 +++++++++++++++++++ .../config/etc/sessions/hazelcast/default.xml | 19 ++++++ .../config/etc/sessions/hazelcast/remote.xml | 19 ++++++ .../session-store-hazelcast-embedded.mod | 26 ++++++++ .../session-store-hazelcast-remote.mod | 26 ++++++++ pom.xml | 1 + 7 files changed, 160 insertions(+) create mode 100644 jetty-hazelcast/pom.xml create mode 100644 jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml create mode 100644 jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml create mode 100644 jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod create mode 100644 jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod diff --git a/jetty-distribution/pom.xml b/jetty-distribution/pom.xml index d38eac07186..9bd773575d1 100644 --- a/jetty-distribution/pom.xml +++ b/jetty-distribution/pom.xml @@ -822,6 +822,11 @@ jetty-infinispan ${project.version} + + org.eclipse.jetty + jetty-hazelcast + ${project.version} + org.eclipse.jetty.gcloud jetty-gcloud-session-manager diff --git a/jetty-hazelcast/pom.xml b/jetty-hazelcast/pom.xml new file mode 100644 index 00000000000..163f40e24bd --- /dev/null +++ b/jetty-hazelcast/pom.xml @@ -0,0 +1,64 @@ + + + org.eclipse.jetty + jetty-project + 9.3.21-SNAPSHOT + + 4.0.0 + jetty-hazelcast + Jetty :: Hazelcast Session Managers + http://www.eclipse.org/jetty + + ${project.groupId}.hazelcast + 1.0.2 + 3.8.2 + + + + + org.apache.maven.plugins + maven-assembly-plugin + + + package + + single + + + + config + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + + + + com.hazelcast + hazelcast-jetty9-sessionmanager + ${hazelcast.sessionManager.version} + + + com.hazelcast + hazelcast-all + ${hazelcast.version} + + + org.eclipse.jetty + jetty-server + ${project.version} + + + diff --git a/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml new file mode 100644 index 00000000000..3c666c3d3fd --- /dev/null +++ b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/default.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + false + + + + \ No newline at end of file diff --git a/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml new file mode 100644 index 00000000000..47aa62e1b69 --- /dev/null +++ b/jetty-hazelcast/src/main/config/etc/sessions/hazelcast/remote.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + true + + + + \ No newline at end of file diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod new file mode 100644 index 00000000000..139fe8ff81e --- /dev/null +++ b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod @@ -0,0 +1,26 @@ +# +# Jetty Hazelcast module +# + +[depend] +annotations +webapp + +[files] +maven://com.hazelcast/hazelcast-all/3.8.2|lib/hazelcast/hazelcast-all-3.8.2.jar +maven://com.hazelcast/hazelcast-jetty9-sessionmanager/1.0.2|lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar +maven://org.eclipse.jetty/jetty-nosql/${jetty.version}|lib/hazelcast/jetty-nosql-${jetty.version}.jar + +[xml] +etc/sessions/hazelcast/default.xml + +[lib] +lib/hazelcast/*.jar + +[license] +Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. +https://hazelcast.org/ +http://www.apache.org/licenses/LICENSE-2.0.html + +[ini-template] +#jetty.session.hazelcast.configurationLocation= diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod new file mode 100644 index 00000000000..139fe8ff81e --- /dev/null +++ b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod @@ -0,0 +1,26 @@ +# +# Jetty Hazelcast module +# + +[depend] +annotations +webapp + +[files] +maven://com.hazelcast/hazelcast-all/3.8.2|lib/hazelcast/hazelcast-all-3.8.2.jar +maven://com.hazelcast/hazelcast-jetty9-sessionmanager/1.0.2|lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar +maven://org.eclipse.jetty/jetty-nosql/${jetty.version}|lib/hazelcast/jetty-nosql-${jetty.version}.jar + +[xml] +etc/sessions/hazelcast/default.xml + +[lib] +lib/hazelcast/*.jar + +[license] +Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. +https://hazelcast.org/ +http://www.apache.org/licenses/LICENSE-2.0.html + +[ini-template] +#jetty.session.hazelcast.configurationLocation= diff --git a/pom.xml b/pom.xml index 3d2be4e36a8..c2229507310 100644 --- a/pom.xml +++ b/pom.xml @@ -601,6 +601,7 @@ jetty-rewrite jetty-nosql jetty-infinispan + jetty-hazelcast jetty-gcloud tests examples From dae0b7fde3910cf52345f3ea5e923bf3a184a2ec Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Tue, 13 Jun 2017 18:34:55 +1000 Subject: [PATCH 02/27] add documentation page for hazelcast session manager module Signed-off-by: olivier lamy --- .../administration/sessions/chapter.adoc | 1 + .../session-configuration-hazelcast.adoc | 134 ++++++++++++++++++ 2 files changed, 135 insertions(+) create mode 100644 jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc diff --git a/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc b/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc index 5f0ca5c917d..ddd13a71721 100644 --- a/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc +++ b/jetty-documentation/src/main/asciidoc/administration/sessions/chapter.adoc @@ -22,4 +22,5 @@ include::using-persistent-sessions.adoc[] include::session-clustering-jdbc.adoc[] include::session-clustering-mongodb.adoc[] include::session-clustering-infinispan.adoc[] +include::session-configuration-hazelcast.adoc[] include::session-clustering-gcloud-datastore.adoc[] \ No newline at end of file diff --git a/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc b/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc new file mode 100644 index 00000000000..1ca0b0749b1 --- /dev/null +++ b/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc @@ -0,0 +1,134 @@ +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ======================================================================== +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== + +[[configuring-sessions-hazelcast]] + +=== Clustered Session Management: Hazelcast + +==== Enabling Hazelcast Sessions + +When using the Jetty distribution, you will first need to enable the `session-store-hazelcast-remote` link:#startup-modules[module] for your link:#startup-base-and-home[Jetty base] using the `--add-to-start` argument on the command line. + +[source, screen, subs="{sub-order}"] +---- +mb-olamy:tmp-base olamy$ java -jar ../start.jar --create-startd +MKDIR : ${jetty.base}/start.d +INFO : Base directory was modified +mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=session-store-hazelcast-remote + +ALERT: There are enabled module(s) with licenses. +The following 1 module(s): + + contains software not provided by the Eclipse Foundation! + + contains software not covered by the Eclipse Public License! + + has not been audited for compliance with its license + + Module: session-store-hazelcast-remote + + Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + + https://hazelcast.org/ + + http://www.apache.org/licenses/LICENSE-2.0.html + +Proceed (y/N)? y +INFO: session-store-hazelcast-remote initialised in ${jetty.base}/start.ini +COPY: /Users/olamy/repository/com/hazelcast/hazelcast-all/3.8.2/hazelcast-all-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-all-3.8.2.jar +COPY: /Users/olamy/repository/com/hazelcast/hazelcast-jetty9-sessionmanager/1.0.2/hazelcast-jetty9-sessionmanager-1.0.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar +COPY: /Users/olamy/repository/org/eclipse/jetty/jetty-nosql/9.3.21-SNAPSHOT/jetty-nosql-9.3.21-SNAPSHOT.jar to ${jetty.base}/lib/hazelcast/jetty-nosql-9.3.21-SNAPSHOT.jar +INFO: Base directory was modified +---- + +Doing this enables the remote Hazelcast Session module and any dependent modules or files needed for it to run on the server. +The example above is using a fresh `${jetty.base}` with nothing else enabled. +Because Hazelcast is not a technology provided by the Eclipse Foundation, users are prompted to assent to the licenses of the external vendor (Apache in this case). + +When the `--add-to-start` argument was added to the command line, it enabled the the `session-store-hazelcast-remote` module as well as the `sessions` and `server` modules, which are required for Hazelcast session management to operate. +It also downloaded the needed Hazelcast-specific jar files and created a directory named `${jetty.base}/lib/hazelcast/` to house them. + +In addition to adding these modules to the classpath of the server it also added several ini configuration files to the `${jetty.base}/start.d` directory. + +____ +[NOTE] +If you have updated versions of the jar files automatically downloaded by Jetty, you can place them in the associated `${jetty.base}/lib/` directory and use the `--skip-file-validation=` command line option to prevent errors when starting your server. +____ + +==== Configuring Hazelcast Remote Properties + +Opening the `start.ini` will show a list of all the configurable options for the Hazelcast module: + +[source, screen, subs="{sub-order}"] +---- +# --------------------------------------- +# Module: session-store-hazelcast-remote +--module=session-store-hazelcast-remote + +#jetty.session.hazelcast.configurationLocation= +---- + +jetty.session.hazelcast.configurationLocation:: +Path to an an Hazelcast xml configuration file + +==== Configuring Embedded Hazelcast Clustering + +During testing, it can be helpful to run an in-process instance of Hazelcast. +To enable this you will first need to enable the `session-store-hazelcast-embedded` link:#startup-modules[module] for your link:#startup-base-and-home[Jetty base] using the `--add-to-start` argument on the command line. + +[source, screen, subs="{sub-order}"] +---- +mb-olamy:tmp-base olamy$ java -jar ../start.jar --create-startd +MKDIR : ${jetty.base}/start.d +INFO : Base directory was modified +mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=session-store-hazelcast-embedded + +ALERT: There are enabled module(s) with licenses. +The following 1 module(s): + + contains software not provided by the Eclipse Foundation! + + contains software not covered by the Eclipse Public License! + + has not been audited for compliance with its license + + Module: session-store-hazelcast-embedded + + Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + + https://hazelcast.org/ + + http://www.apache.org/licenses/LICENSE-2.0.html + +Proceed (y/N)? y +INFO: session-store-hazelcast-embedded initialised in ${jetty.base}/start.ini +COPY: /Users/olamy/repository/com/hazelcast/hazelcast-all/3.8.2/hazelcast-all-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-all-3.8.2.jar +COPY: /Users/olamy/repository/com/hazelcast/hazelcast-jetty9-sessionmanager/1.0.2/hazelcast-jetty9-sessionmanager-1.0.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar +COPY: /Users/olamy/repository/org/eclipse/jetty/jetty-nosql/9.3.21-SNAPSHOT/jetty-nosql-9.3.21-SNAPSHOT.jar to ${jetty.base}/lib/hazelcast/jetty-nosql-9.3.21-SNAPSHOT.jar +INFO: Base directory was modified +---- + +Doing this enables the embedded Hazelcast Session module and any dependent modules or files needed for it to run on the server. +The example above is using a fresh `${jetty.base}` with nothing else enabled. +Because Hazelcast is not a technology provided by the Eclipse Foundation, users are prompted to assent to the licenses of the external vendor (Apache in this case). + +When the `--add-to-start` argument was added to the command line, it enabled the the `session-store-hazelcast-embedded` module as well as the `sessions` and `server` modules, which are required for Hazelcast session management to operate. +It also downloaded the needed Hazelcast-specific jar files and created a directory named `${jetty.base}/lib/hazelcast/` to house them. + +In addition to adding these modules to the classpath of the server it also added several ini configuration files to the `${jetty.base}/start.d` directory. + +==== Configuring Hazelcast Embedded Properties + +Opening the `start.ini` will show a list of all the configurable options for the Hazelcast module: + +[source, screen, subs="{sub-order}"] +---- +# --------------------------------------- +# Module: session-store-hazelcast-embedded +--module=session-store-hazelcast-embedded + +#jetty.session.hazelcast.configurationLocation= +---- +jetty.session.hazelcast.configurationLocation:: +Path to an an Hazelcast xml configuration file From ec45636c894852fb09563cfbf7690e5bd6e1cb7b Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Wed, 14 Jun 2017 09:46:36 +1000 Subject: [PATCH 03/27] fix file to use Signed-off-by: olivier lamy --- .../src/main/config/modules/session-store-hazelcast-remote.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod index 139fe8ff81e..5038684659d 100644 --- a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod +++ b/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod @@ -12,7 +12,7 @@ maven://com.hazelcast/hazelcast-jetty9-sessionmanager/1.0.2|lib/hazelcast/hazelc maven://org.eclipse.jetty/jetty-nosql/${jetty.version}|lib/hazelcast/jetty-nosql-${jetty.version}.jar [xml] -etc/sessions/hazelcast/default.xml +etc/sessions/hazelcast/remote.xml [lib] lib/hazelcast/*.jar From 53eee555c5a522e5262e1c334a4f29077d5ce161 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Wed, 14 Jun 2017 14:52:08 +1000 Subject: [PATCH 04/27] modify module names after Jan review Signed-off-by: olivier lamy --- .../session-configuration-hazelcast.adoc | 16 ++++++++-------- ...edded.mod => hazelcast-embedded-sessions.mod} | 0 ...-remote.mod => hazelcast-remote-sessions.mod} | 0 3 files changed, 8 insertions(+), 8 deletions(-) rename jetty-hazelcast/src/main/config/modules/{session-store-hazelcast-embedded.mod => hazelcast-embedded-sessions.mod} (100%) rename jetty-hazelcast/src/main/config/modules/{session-store-hazelcast-remote.mod => hazelcast-remote-sessions.mod} (100%) diff --git a/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc b/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc index 1ca0b0749b1..e95a91a58c8 100644 --- a/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc +++ b/jetty-documentation/src/main/asciidoc/administration/sessions/session-configuration-hazelcast.adoc @@ -27,7 +27,7 @@ When using the Jetty distribution, you will first need to enable the `session-st mb-olamy:tmp-base olamy$ java -jar ../start.jar --create-startd MKDIR : ${jetty.base}/start.d INFO : Base directory was modified -mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=session-store-hazelcast-remote +mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=hazelcast-remote-sessions ALERT: There are enabled module(s) with licenses. The following 1 module(s): @@ -35,13 +35,13 @@ The following 1 module(s): + contains software not covered by the Eclipse Public License! + has not been audited for compliance with its license - Module: session-store-hazelcast-remote + Module: hazelcast-remote-sessions + Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + https://hazelcast.org/ + http://www.apache.org/licenses/LICENSE-2.0.html Proceed (y/N)? y -INFO: session-store-hazelcast-remote initialised in ${jetty.base}/start.ini +INFO: hazelcast-remote-sessions initialised in ${jetty.base}/start.ini COPY: /Users/olamy/repository/com/hazelcast/hazelcast-all/3.8.2/hazelcast-all-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-all-3.8.2.jar COPY: /Users/olamy/repository/com/hazelcast/hazelcast-jetty9-sessionmanager/1.0.2/hazelcast-jetty9-sessionmanager-1.0.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar COPY: /Users/olamy/repository/org/eclipse/jetty/jetty-nosql/9.3.21-SNAPSHOT/jetty-nosql-9.3.21-SNAPSHOT.jar to ${jetty.base}/lib/hazelcast/jetty-nosql-9.3.21-SNAPSHOT.jar @@ -88,7 +88,7 @@ To enable this you will first need to enable the `session-store-hazelcast-embedd mb-olamy:tmp-base olamy$ java -jar ../start.jar --create-startd MKDIR : ${jetty.base}/start.d INFO : Base directory was modified -mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=session-store-hazelcast-embedded +mb-olamy:tmp-base olamy$ java -jar ../start.jar --add-to-start=hazelcast-embedded-sessions ALERT: There are enabled module(s) with licenses. The following 1 module(s): @@ -96,13 +96,13 @@ The following 1 module(s): + contains software not covered by the Eclipse Public License! + has not been audited for compliance with its license - Module: session-store-hazelcast-embedded + Module: hazelcast-embedded-sessions + Hazelcast is an open source project hosted on Github and released under the Apache 2.0 license. + https://hazelcast.org/ + http://www.apache.org/licenses/LICENSE-2.0.html Proceed (y/N)? y -INFO: session-store-hazelcast-embedded initialised in ${jetty.base}/start.ini +INFO: hazelcast-embedded-sessions initialised in ${jetty.base}/start.ini COPY: /Users/olamy/repository/com/hazelcast/hazelcast-all/3.8.2/hazelcast-all-3.8.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-all-3.8.2.jar COPY: /Users/olamy/repository/com/hazelcast/hazelcast-jetty9-sessionmanager/1.0.2/hazelcast-jetty9-sessionmanager-1.0.2.jar to ${jetty.base}/lib/hazelcast/hazelcast-jetty9-sessionmanager-1.0.2.jar COPY: /Users/olamy/repository/org/eclipse/jetty/jetty-nosql/9.3.21-SNAPSHOT/jetty-nosql-9.3.21-SNAPSHOT.jar to ${jetty.base}/lib/hazelcast/jetty-nosql-9.3.21-SNAPSHOT.jar @@ -125,8 +125,8 @@ Opening the `start.ini` will show a list of all the configurable options for the [source, screen, subs="{sub-order}"] ---- # --------------------------------------- -# Module: session-store-hazelcast-embedded ---module=session-store-hazelcast-embedded +# Module: hazelcast-embedded-sessions +--module=hazelcast-embedded-sessions #jetty.session.hazelcast.configurationLocation= ---- diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod b/jetty-hazelcast/src/main/config/modules/hazelcast-embedded-sessions.mod similarity index 100% rename from jetty-hazelcast/src/main/config/modules/session-store-hazelcast-embedded.mod rename to jetty-hazelcast/src/main/config/modules/hazelcast-embedded-sessions.mod diff --git a/jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod b/jetty-hazelcast/src/main/config/modules/hazelcast-remote-sessions.mod similarity index 100% rename from jetty-hazelcast/src/main/config/modules/session-store-hazelcast-remote.mod rename to jetty-hazelcast/src/main/config/modules/hazelcast-remote-sessions.mod From a275032915b787455f9482cd8d78616360342d6b Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Thu, 22 Jun 2017 16:24:13 +1000 Subject: [PATCH 05/27] add it for run mojo #1638 Signed-off-by: olivier lamy --- jetty-maven-plugin/pom.xml | 47 ++++++++++ .../it/jetty-run-mojo-it/invoker.properties | 1 + .../jetty-simple-base/pom.xml | 50 +++++++++++ .../its/jetty_run_mojo_it/HelloServlet.java | 44 +++++++++ .../jetty-simple-webapp/pom.xml | 84 +++++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 7 ++ .../jetty_run_mojo_it/TestHelloServlet.java | 66 ++++++++++++++ .../src/it/jetty-run-mojo-it/pom.xml | 89 +++++++++++++++++++ jetty-maven-plugin/src/it/settings.xml | 36 ++++++++ .../jetty/maven/plugin/AbstractJettyMojo.java | 54 ++++++++--- .../jetty/maven/plugin/JettyDeployWar.java | 4 +- .../jetty/maven/plugin/JettyRunMojo.java | 10 +-- .../jetty/maven/plugin/JettyStartMojo.java | 2 +- .../maven/plugin/MavenServerConnector.java | 5 ++ 14 files changed, 481 insertions(+), 18 deletions(-) create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/invoker.properties create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml create mode 100644 jetty-maven-plugin/src/it/settings.xml diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index aad17845263..88b18fb8ba1 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -13,6 +13,7 @@ 3.0.3 3.4 ${project.groupId}.maven.plugin + false @@ -153,6 +154,12 @@ javax.transaction-api compile + + org.eclipse.jetty + jetty-client + ${project.version} + test + @@ -177,4 +184,44 @@ + + + run-its + + + + org.apache.maven.plugins + maven-invoker-plugin + 3.0.0 + + + integration-test + + install + integration-test + verify + + + + + ${it.debug} + true + src/it + ${project.build.directory}/it + + */pom.xml + + setup + verify + ${project.build.directory}/local-repo + src/it/settings.xml + + clean + + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/invoker.properties b/jetty-maven-plugin/src/it/jetty-run-mojo-it/invoker.properties new file mode 100644 index 00000000000..e0222d4d54e --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/invoker.properties @@ -0,0 +1 @@ +invoker.goals = test \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml new file mode 100644 index 00000000000..c29b270cb61 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-base + jar + + Jetty :: Simple :: Base + + + + + javax.servlet + javax.servlet-api + jar + provided + + + + org.slf4j + slf4j-api + + + + commons-io + commons-io + + + + org.eclipse.jetty.toolchain + jetty-perf-helper + 1.0.5 + + + + com.fasterxml.jackson.core + jackson-databind + 2.8.1 + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java new file mode 100644 index 00000000000..bb6915814df --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -0,0 +1,44 @@ +// +// ======================================================================== +// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + */ +@WebServlet("/hello") +public class HelloServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml new file mode 100644 index 00000000000..a11175216c8 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml @@ -0,0 +1,84 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-webapp + war + + Jetty :: Simple :: Webapp + + + + + com.webtide.jetty.its.jetty-run-mojo-it + jetty-simple-base + + + + org.eclipse.jetty + jetty-servlet + provided + + + + org.eclipse.jetty + jetty-client + @project.version@ + test + + + + junit + junit + 4.12 + test + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin-version} + + false + + + + + + + org.eclipse.jetty + jetty-maven-plugin + + + start-jetty + test-compile + + run + + + true + ${project.build.directory}/jetty.properties + + 0 + + + + + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..2a5ac4b71bf --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + Jetty Simple Webapp run-mojo-it + diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java new file mode 100644 index 00000000000..699c3171145 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -0,0 +1,66 @@ +// +// ======================================================================== +// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import org.eclipse.jetty.client.HttpClient; +import org.junit.Assert; +import org.junit.Test; + +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Properties; + +/** + * + */ +public class TestHelloServlet +{ + @Test + public void hello_servlet() + throws Exception + { + + Path path = Paths.get( "target/jetty.properties" ); + int port; + try (InputStream inputStream = Files.newInputStream( path )) + { + Properties properties = new Properties(); + properties.load( inputStream ); + port = Integer.parseInt( properties.getProperty( "port" ) ); + } + + HttpClient httpClient = new HttpClient(); + try + { + httpClient.start(); + + String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "hello beer", response.trim() ); + } + finally + { + httpClient.stop(); + } + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml new file mode 100644 index 00000000000..44247ef1e75 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + com.webtide.jetty.its.jetty-run-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + pom + + Jetty :: Simple + + + UTF-8 + UTF-8 + 1.8 + 3.0.0 + + + + jetty-simple-base + jetty-simple-webapp + + + + + + + com.webtide.jetty.its.jetty-run-mojo-it + jetty-simple-base + ${project.version} + + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + org.slf4j + slf4j-api + 1.7.21 + + + + commons-io + commons-io + 2.5 + + + + org.eclipse.jetty + jetty-servlet + @project.version@ + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + + org.eclipse.jetty + jetty-maven-plugin + @project.version@ + + + + + + diff --git a/jetty-maven-plugin/src/it/settings.xml b/jetty-maven-plugin/src/it/settings.xml new file mode 100644 index 00000000000..d64bdb89034 --- /dev/null +++ b/jetty-maven-plugin/src/it/settings.xml @@ -0,0 +1,36 @@ + + + + + + it-repo + + true + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + local.central + @localRepositoryUrl@ + + true + + + true + + + + + + diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java index 72b8bad3a95..ae15f544235 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java @@ -21,9 +21,13 @@ package org.eclipse.jetty.maven.plugin; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; +import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLClassLoader; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Enumeration; @@ -36,11 +40,14 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Parameter; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils; import org.eclipse.jetty.security.LoginService; +import org.eclipse.jetty.server.NetworkConnector; import org.eclipse.jetty.server.RequestLog; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.server.ShutdownMonitor; import org.eclipse.jetty.server.handler.ContextHandler; import org.eclipse.jetty.server.handler.ContextHandlerCollection; @@ -272,9 +279,14 @@ public abstract class AbstractJettyMojo extends AbstractMojo protected Thread consoleScanner; protected ServerSupport serverSupport; - - - + + + /** + * Will dump port in a properties file with key port. + * If empty no file generated + * @parameter + */ + protected String propertiesPortFilePath; /** *

@@ -287,8 +299,9 @@ public abstract class AbstractJettyMojo extends AbstractMojo * If true, the server will not block the execution of subsequent code. This * is the behaviour of the jetty:start and default behaviour of the jetty:deploy goals. *

+ * @parameter default-value="false" */ - protected boolean nonblocking = false; + protected boolean nonBlocking = false; public abstract void restartWebApp(boolean reconfigureScanner) throws Exception; @@ -429,11 +442,13 @@ public abstract class AbstractJettyMojo extends AbstractMojo // if a was specified in the pom, use it if (httpConnector != null) { + // check that its port was set - if (httpConnector.getPort() <= 0) + if (httpConnector.getPort() < 0) { //use any jetty.http.port settings provided - String tmp = System.getProperty(MavenServerConnector.PORT_SYSPROPERTY, System.getProperty("jetty.port", MavenServerConnector.DEFAULT_PORT_STR)); + String tmp = System.getProperty(MavenServerConnector.PORT_SYSPROPERTY, + System.getProperty("jetty.port", MavenServerConnector.DEFAULT_PORT_STR)); httpConnector.setPort(Integer.parseInt(tmp.trim())); } httpConnector.setServer(server); @@ -459,7 +474,25 @@ public abstract class AbstractJettyMojo extends AbstractMojo // start Jetty this.server.start(); - getLog().info("Started Jetty Server"); + if (httpConnector != null) + { + int port = httpConnector.getLocalPort(); + getLog().info( "Started Jetty Server on port: " + port ); + if (propertiesPortFilePath != null) + { + Path propertiesPath = Paths.get( propertiesPortFilePath); + Files.deleteIfExists(propertiesPath); + try(OutputStream outputStream = Files.newOutputStream( propertiesPath )) + { + Properties properties = new Properties( ); + properties.put( "port", Integer.toString( port ) ); + properties.store( outputStream, "Eclipse Jetty Maven Plugin port used" ); + } + } + } else + { + getLog().info( "Started Jetty Server" ); + } if ( dumpOnStart ) { @@ -478,10 +511,11 @@ public abstract class AbstractJettyMojo extends AbstractMojo startConsoleScanner(); // keep the thread going if not in daemon mode - if (!nonblocking ) + if (!nonBlocking ) { server.join(); } + } catch (Exception e) { @@ -489,7 +523,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo } finally { - if (!nonblocking ) + if (!nonBlocking ) { getLog().info("Jetty server exiting."); } @@ -504,7 +538,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo ShutdownMonitor monitor = ShutdownMonitor.getInstance(); monitor.setPort(stopPort); monitor.setKey(stopKey); - monitor.setExitVm(!nonblocking); + monitor.setExitVm(!nonBlocking ); } } diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java index 96ea192a519..8a20299896e 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyDeployWar.java @@ -61,7 +61,7 @@ public class JettyDeployWar extends JettyRunWarMojo @Override public void execute() throws MojoExecutionException, MojoFailureException { - nonblocking = daemon; + nonBlocking = daemon; super.execute(); } @@ -72,7 +72,7 @@ public class JettyDeployWar extends JettyRunWarMojo { super.finishConfigurationBeforeStart(); //only stop the server at shutdown if we are blocking - server.setStopAtShutdown(!nonblocking); + server.setStopAtShutdown(!nonBlocking ); } } diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java index 259cb0f54d0..cdedd33c921 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java @@ -222,7 +222,7 @@ public class JettyRunMojo extends AbstractJettyMojo { getLog().info("Reload Mechanic: " + reload ); } - + getLog().info( "nonBlocking:" + nonBlocking ); // check the classes to form a classpath with try @@ -566,7 +566,7 @@ public class JettyRunMojo extends AbstractJettyMojo */ private List getDependencyFiles() { - List dependencyFiles = new ArrayList(); + List dependencyFiles = new ArrayList<>(); for ( Iterator iter = projectArtifacts.iterator(); iter.hasNext(); ) { Artifact artifact = iter.next(); @@ -596,7 +596,7 @@ public class JettyRunMojo extends AbstractJettyMojo private List getDependencyProjects() { - List dependencyFiles = new ArrayList(); + List dependencyFiles = new ArrayList<>(); for ( Iterator iter = projectArtifacts.iterator(); iter.hasNext(); ) { Artifact artifact = iter.next(); @@ -656,10 +656,10 @@ public class JettyRunMojo extends AbstractJettyMojo if (warArtifacts != null) return warArtifacts; - warArtifacts = new ArrayList(); + warArtifacts = new ArrayList<>(); for ( Iterator iter = projectArtifacts.iterator(); iter.hasNext(); ) { - Artifact artifact = (Artifact) iter.next(); + Artifact artifact = iter.next(); if (artifact.getType().equals("war") || artifact.getType().equals("zip")) { try diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyStartMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyStartMojo.java index ca7068c3ecc..1909536e0ee 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyStartMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyStartMojo.java @@ -44,7 +44,7 @@ public class JettyStartMojo extends JettyRunMojo @Override public void execute() throws MojoExecutionException, MojoFailureException { - nonblocking = true; //ensure that starting jetty won't hold up the thread + nonBlocking = true; //ensure that starting jetty won't hold up the thread super.execute(); } diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenServerConnector.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenServerConnector.java index 075f4d9c66b..aed7f8dddaf 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenServerConnector.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenServerConnector.java @@ -270,6 +270,11 @@ public class MavenServerConnector extends ContainerLifeCycle implements Connecto { return this.name; } + + public int getLocalPort() + { + return this.delegate.getLocalPort(); + } private void checkDelegate() throws IllegalStateException { From 1e7e3568655724fb6e19965b593bf048e2b96938 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 10:42:03 +1000 Subject: [PATCH 06/27] add test for run forked mojo Signed-off-by: olivier lamy --- jetty-maven-plugin/pom.xml | 26 ++++ .../invoker.properties | 1 + .../jetty-simple-base/pom.xml | 50 +++++++ .../its/jetty_run_mojo_it/HelloServlet.java | 45 ++++++ .../jetty-simple-webapp/pom.xml | 133 ++++++++++++++++++ .../jetty-simple-webapp/src/config/jetty.xml | 33 +++++ .../src/main/webapp/WEB-INF/web.xml | 7 + .../jetty_run_mojo_it/TestHelloServlet.java | 52 +++++++ .../src/it/jetty-run-forked-mojo-it/pom.xml | 89 ++++++++++++ .../it/jetty-run-forked-mojo-it/postbuild.foo | 8 ++ .../its/jetty_run_mojo_it/HelloServlet.java | 3 +- .../jetty-simple-webapp/pom.xml | 13 +- .../jetty_run_mojo_it/TestHelloServlet.java | 21 +-- .../jetty/maven/plugin/AbstractJettyMojo.java | 32 +---- .../maven/plugin/JettyRunForkedMojo.java | 17 ++- .../jetty/maven/plugin/JettyRunMojo.java | 2 +- .../eclipse/jetty/maven/plugin/Starter.java | 4 +- 17 files changed, 480 insertions(+), 56 deletions(-) create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/invoker.properties create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/config/jetty.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index 88b18fb8ba1..29a15d50215 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -14,6 +14,7 @@ 3.4 ${project.groupId}.maven.plugin false + FOOBEER @@ -215,11 +216,36 @@ verify ${project.build.directory}/local-repo src/it/settings.xml + + ${jetty.stopKey} + ${jetty.stopPort} + ${jetty.runPort} + clean + + org.codehaus.mojo + build-helper-maven-plugin + 3.0.0 + + + reserve-ports + pre-integration-test + + reserve-network-port + + + + jetty.stopPort + jetty.runPort + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/invoker.properties b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/invoker.properties new file mode 100644 index 00000000000..2fc6409821b --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/invoker.properties @@ -0,0 +1 @@ +invoker.goals = test -fae \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml new file mode 100644 index 00000000000..594ddba4c8d --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-forked-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-base + jar + + Jetty :: Simple :: Base + + + + + javax.servlet + javax.servlet-api + jar + provided + + + + org.slf4j + slf4j-api + + + + commons-io + commons-io + + + + org.eclipse.jetty.toolchain + jetty-perf-helper + 1.0.5 + + + + com.fasterxml.jackson.core + jackson-databind + 2.8.1 + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java new file mode 100644 index 00000000000..a6d2a3e256d --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -0,0 +1,45 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + */ +@WebServlet("/hello") +public class HelloServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml new file mode 100644 index 00000000000..21f5b01073a --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml @@ -0,0 +1,133 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-forked-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-webapp + war + + Jetty :: Simple :: Webapp + + + @jetty.runPort@ + + + + + + com.webtide.jetty.its.jetty-run-forked-mojo-it + jetty-simple-base + + + + org.eclipse.jetty + jetty-servlet + provided + + + + org.eclipse.jetty + jetty-client + @project.version@ + test + + + + junit + junit + 4.12 + test + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin-version} + + false + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + @jetty.runPort@ + + + + + org.eclipse.jetty + jetty-maven-plugin + + @jetty.stopPort@ + @jetty.stopKey@ + + + + start-jetty + test-compile + + run-forked + + + true + false + ${project.build.directory}/config/jetty.xml + + + + stop-jetty + test + + stop + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.2 + + + copy-resources-jetty + generate-resources + + copy-resources + + + ${project.build.directory}/config + + + ${basedir}/src/config/ + true + + **/** + + + + + + + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/config/jetty.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/config/jetty.xml new file mode 100644 index 00000000000..a057f0664eb --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/config/jetty.xml @@ -0,0 +1,33 @@ + + + + + + https + + 32768 + 8192 + 8192 + 512 + + + + + + + + + + + + + + + + + + 30000 + + + + \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..2a5ac4b71bf --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + Jetty Simple Webapp run-mojo-it + diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java new file mode 100644 index 00000000000..27d9d55c787 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -0,0 +1,52 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import org.eclipse.jetty.client.HttpClient; +import org.junit.Assert; +import org.junit.Test; + +/** + * + */ +public class TestHelloServlet +{ + @Test + public void hello_servlet() + throws Exception + { + int port = Integer.getInteger( "jetty.runPort" ); + System.out.println( "port used:" + port ); + HttpClient httpClient = new HttpClient(); + try + { + httpClient.start(); + + String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "hello beer", response.trim() ); + } + finally + { + httpClient.stop(); + } + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml new file mode 100644 index 00000000000..e45f2ad1fcd --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + com.webtide.jetty.its.jetty-run-forked-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + pom + + Jetty :: Simple + + + UTF-8 + UTF-8 + 1.8 + 3.0.0 + + + + jetty-simple-base + jetty-simple-webapp + + + + + + + com.webtide.jetty.its.jetty-run-forked-mojo-it + jetty-simple-base + ${project.version} + + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + org.slf4j + slf4j-api + 1.7.21 + + + + commons-io + commons-io + 2.5 + + + + org.eclipse.jetty + jetty-servlet + @project.version@ + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + + org.eclipse.jetty + jetty-maven-plugin + @project.version@ + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo new file mode 100644 index 00000000000..134e91137c7 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo @@ -0,0 +1,8 @@ + +Socket s=new Socket(InetAddress.getByName("127.0.0.1"),Integer.getInteger( "jetty.runPort" )); +s.setSoLinger(false, 0); + +OutputStream out=s.getOutputStream(); +out.write((System.getProperty( "jetty.stopKey" )+"\r\n"+command+"\r\n").getBytes()); +out.flush(); +s.close() \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java index bb6915814df..a6d2a3e256d 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -1,6 +1,6 @@ // // ======================================================================== -// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 @@ -16,6 +16,7 @@ // ======================================================================== // + package com.webtide.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml index a11175216c8..ce4d50f13ec 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml @@ -57,6 +57,16 @@ + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + @jetty.runPort@ + + + org.eclipse.jetty jetty-maven-plugin @@ -69,9 +79,8 @@ true - ${project.build.directory}/jetty.properties - 0 + @jetty.runPort@ diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 699c3171145..1ec2da6ff78 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -1,6 +1,6 @@ // // ======================================================================== -// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd. +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. // ------------------------------------------------------------------------ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 @@ -16,18 +16,13 @@ // ======================================================================== // + package com.webtide.jetty.its.jetty_run_mojo_it; import org.eclipse.jetty.client.HttpClient; import org.junit.Assert; import org.junit.Test; -import java.io.InputStream; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Properties; - /** * */ @@ -37,16 +32,8 @@ public class TestHelloServlet public void hello_servlet() throws Exception { - - Path path = Paths.get( "target/jetty.properties" ); - int port; - try (InputStream inputStream = Files.newInputStream( path )) - { - Properties properties = new Properties(); - properties.load( inputStream ); - port = Integer.parseInt( properties.getProperty( "port" ) ); - } - + int port = Integer.getInteger( "jetty.runPort" ); + System.out.println( "port used:" + port ); HttpClient httpClient = new HttpClient(); try { diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java index ae15f544235..ef9dbb2674a 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/AbstractJettyMojo.java @@ -280,14 +280,6 @@ public abstract class AbstractJettyMojo extends AbstractMojo protected ServerSupport serverSupport; - - /** - * Will dump port in a properties file with key port. - * If empty no file generated - * @parameter - */ - protected String propertiesPortFilePath; - /** *

* Determines whether or not the server blocks when started. The default @@ -444,10 +436,10 @@ public abstract class AbstractJettyMojo extends AbstractMojo { // check that its port was set - if (httpConnector.getPort() < 0) + if (httpConnector.getPort() <= 0) { //use any jetty.http.port settings provided - String tmp = System.getProperty(MavenServerConnector.PORT_SYSPROPERTY, + String tmp = System.getProperty(MavenServerConnector.PORT_SYSPROPERTY, // System.getProperty("jetty.port", MavenServerConnector.DEFAULT_PORT_STR)); httpConnector.setPort(Integer.parseInt(tmp.trim())); } @@ -474,25 +466,7 @@ public abstract class AbstractJettyMojo extends AbstractMojo // start Jetty this.server.start(); - if (httpConnector != null) - { - int port = httpConnector.getLocalPort(); - getLog().info( "Started Jetty Server on port: " + port ); - if (propertiesPortFilePath != null) - { - Path propertiesPath = Paths.get( propertiesPortFilePath); - Files.deleteIfExists(propertiesPath); - try(OutputStream outputStream = Files.newOutputStream( propertiesPath )) - { - Properties properties = new Properties( ); - properties.put( "port", Integer.toString( port ) ); - properties.store( outputStream, "Eclipse Jetty Maven Plugin port used" ); - } - } - } else - { - getLog().info( "Started Jetty Server" ); - } + getLog().info( "Started Jetty Server" ); if ( dumpOnStart ) { diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java index c4d03008abf..6e6b35b46a3 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java @@ -44,6 +44,7 @@ import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.apache.maven.project.MavenProject; import org.eclipse.jetty.annotations.AnnotationConfiguration; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.util.IO; @@ -169,10 +170,18 @@ public class JettyRunForkedMojo extends JettyRunMojo } } } - - - + + @Override + /** + * we o + */ + protected MavenProject getProjectReferences( Artifact artifact, MavenProject project ) + { + + return null; + } + /** * ConsoleStreamer * @@ -349,7 +358,7 @@ public class JettyRunForkedMojo extends JettyRunMojo builder.directory(project.getBasedir()); if (PluginLog.getLog().isDebugEnabled()) - PluginLog.getLog().debug(Arrays.toString(cmd.toArray())); + PluginLog.getLog().debug("Forked cli:"+Arrays.toString(cmd.toArray())); PluginLog.getLog().info("Forked process starting"); diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java index cdedd33c921..00a6b9f3ec8 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java @@ -626,7 +626,7 @@ public class JettyRunMojo extends AbstractJettyMojo } - private MavenProject getProjectReferences( Artifact artifact, MavenProject project ) + protected MavenProject getProjectReferences( Artifact artifact, MavenProject project ) { if ( project.getProjectReferences() == null || project.getProjectReferences().isEmpty() ) { diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java index 040a58202cf..37a155f6b89 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java @@ -246,7 +246,7 @@ public class Starter Set matchedWars = new HashSet(); //process any overlays and the war type artifacts - List overlays = new ArrayList(); + List overlays = new ArrayList<>(); for (OverlayConfig config:orderedConfigs.values()) { //overlays can be individually skipped @@ -302,7 +302,7 @@ public class Starter // - the equivalent of web-inf lib - str = (String)props.getProperty("lib.jars"); + str = props.getProperty("lib.jars"); if (str != null && !"".equals(str.trim())) { List jars = new ArrayList(); From d72718b67f7dc15105485f26fe54345e07dadfe2 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 14:55:44 +1000 Subject: [PATCH 07/27] fix run forked support of reactor projects Signed-off-by: olivier lamy --- jetty-maven-plugin/pom.xml | 11 ++--- .../jetty-simple-webapp/pom.xml | 4 ++ .../it/jetty-run-forked-mojo-it/postbuild.foo | 8 --- .../jetty-run-forked-mojo-it/postbuild.groovy | 13 +++++ .../maven/plugin/JettyRunForkedMojo.java | 49 ++++++++++++------- .../jetty/maven/plugin/ServerSupport.java | 2 +- .../eclipse/jetty/maven/plugin/Starter.java | 36 +++++++++----- 7 files changed, 77 insertions(+), 46 deletions(-) delete mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.groovy diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index 29a15d50215..5cee41ef475 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -15,6 +15,7 @@ ${project.groupId}.maven.plugin false FOOBEER + @@ -193,7 +194,7 @@ org.apache.maven.plugins maven-invoker-plugin - 3.0.0 + 3.0.1-SNAPSHOT integration-test @@ -212,14 +213,12 @@ */pom.xml - setup - verify ${project.build.directory}/local-repo src/it/settings.xml - ${jetty.stopKey} - ${jetty.stopPort} - ${jetty.runPort} + ${jetty.stopKey} + ${jetty.stopPort} + ${jetty.runPort} clean diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml index 21f5b01073a..3c6f21d22ea 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml @@ -16,6 +16,7 @@ @jetty.runPort@ + @jetty.jvmArgs@ @@ -89,8 +90,10 @@ true false ${project.build.directory}/config/jetty.xml + ${jetty.jvmArgs} + diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo deleted file mode 100644 index 134e91137c7..00000000000 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.foo +++ /dev/null @@ -1,8 +0,0 @@ - -Socket s=new Socket(InetAddress.getByName("127.0.0.1"),Integer.getInteger( "jetty.runPort" )); -s.setSoLinger(false, 0); - -OutputStream out=s.getOutputStream(); -out.write((System.getProperty( "jetty.stopKey" )+"\r\n"+command+"\r\n").getBytes()); -out.flush(); -s.close() \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.groovy b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.groovy new file mode 100644 index 00000000000..8a524044e2a --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/postbuild.groovy @@ -0,0 +1,13 @@ + + +System.out.println( "running postbuild.groovy port " + jettyStopPort + ", key:" + jettyStopKey ) + +int port = Integer.parseInt( jettyStopPort ) + +Socket s=new Socket(InetAddress.getByName("127.0.0.1"),port ) +s.setSoLinger(false, 0) + +OutputStream out=s.getOutputStream() +out.write(( jettyStopKey +"\r\nforcestop\r\n").getBytes()) +out.flush() +s.close() \ No newline at end of file diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java index 6e6b35b46a3..4de7f20ae53 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunForkedMojo.java @@ -18,6 +18,17 @@ package org.eclipse.jetty.maven.plugin; +import org.apache.maven.artifact.Artifact; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.descriptor.PluginDescriptor; +import org.eclipse.jetty.annotations.AnnotationConfiguration; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.util.IO; +import org.eclipse.jetty.util.resource.Resource; +import org.eclipse.jetty.util.resource.ResourceCollection; +import org.eclipse.jetty.util.thread.QueuedThreadPool; + import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.File; @@ -40,18 +51,6 @@ import java.util.Properties; import java.util.Random; import java.util.Set; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.project.MavenProject; -import org.eclipse.jetty.annotations.AnnotationConfiguration; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.util.IO; -import org.eclipse.jetty.util.resource.Resource; -import org.eclipse.jetty.util.resource.ResourceCollection; -import org.eclipse.jetty.util.thread.QueuedThreadPool; - /** * This goal is used to deploy your unassembled webapp into a forked JVM. @@ -172,15 +171,14 @@ public class JettyRunForkedMojo extends JettyRunMojo } - @Override /** * we o */ - protected MavenProject getProjectReferences( Artifact artifact, MavenProject project ) - { - - return null; - } +// protected MavenProject getProjectReferences( Artifact artifact, MavenProject project ) +// { +// +// return null; +// } /** * ConsoleStreamer @@ -519,6 +517,19 @@ public class JettyRunForkedMojo extends JettyRunMojo props.put("testClasses.dir", webApp.getTestClasses().getAbsolutePath()); } + if ( !webApp.getClassPathFiles().isEmpty() ) + { + StringBuilder stringBuilder = new StringBuilder(); + for ( File dependency : webApp.getClassPathFiles() ) + { + if (dependency.isDirectory()) + { + stringBuilder.append( dependency.getCanonicalPath() ).append( '|' ); + } + } + props.put( "projects.classes.dir", stringBuilder.toString() ); + } + //web-inf lib List deps = webApp.getWebInfLib(); StringBuffer strbuff = new StringBuffer(); @@ -587,7 +598,7 @@ public class JettyRunForkedMojo extends JettyRunMojo List warArtifacts = new ArrayList(); for ( Iterator iter = project.getArtifacts().iterator(); iter.hasNext(); ) { - Artifact artifact = (Artifact) iter.next(); + Artifact artifact = iter.next(); if (artifact.getType().equals("war")) warArtifacts.add(artifact); diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ServerSupport.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ServerSupport.java index eeda81108f0..3b0512ced41 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ServerSupport.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/ServerSupport.java @@ -164,7 +164,7 @@ public class ServerSupport if (server == null) return null; - return (ContextHandlerCollection)server.getChildHandlerByClass(ContextHandlerCollection.class); + return server.getChildHandlerByClass(ContextHandlerCollection.class); } diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java index 37a155f6b89..88f542db616 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/Starter.java @@ -22,7 +22,9 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.net.URL; +import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.Enumeration; import java.util.HashSet; import java.util.Iterator; @@ -30,6 +32,8 @@ import java.util.List; import java.util.Properties; import java.util.Set; import java.util.TreeMap; +import java.util.regex.Pattern; +import java.util.stream.Collectors; import org.eclipse.jetty.server.Handler; import org.eclipse.jetty.server.Server; @@ -174,31 +178,31 @@ public class Starter //apply a properties file that defines the things that we configure in the jetty:run plugin: // - the context path - String str = (String)props.get("context.path"); + String str = props.getProperty("context.path"); if (str != null) webApp.setContextPath(str); // - web.xml - str = (String)props.get("web.xml"); + str = props.getProperty("web.xml"); if (str != null) webApp.setDescriptor(str); - str = (String)props.get("quickstart.web.xml"); + str = props.getProperty("quickstart.web.xml"); if (str != null) webApp.setQuickStartWebDescriptor(Resource.newResource(new File(str))); // - the tmp directory - str = (String)props.getProperty("tmp.dir"); + str = props.getProperty("tmp.dir"); if (str != null) webApp.setTempDirectory(new File(str.trim())); - str = (String)props.getProperty("tmp.dir.persist"); + str = props.getProperty("tmp.dir.persist"); if (str != null) webApp.setPersistTempDirectory(Boolean.valueOf(str)); //Get the calculated base dirs which includes the overlays - str = (String)props.getProperty("base.dirs"); + str = props.getProperty("base.dirs"); if (str != null && !"".equals(str.trim())) { ResourceCollection bases = new ResourceCollection(StringUtil.csvSplit(str)); @@ -207,7 +211,7 @@ public class Starter } //Get the original base dirs without the overlays - str = (String)props.get("base.dirs.orig"); + str = props.getProperty("base.dirs.orig"); if (str != null && !"".equals(str.trim())) { ResourceCollection bases = new ResourceCollection(StringUtil.csvSplit(str)); @@ -215,9 +219,9 @@ public class Starter } //For overlays - str = (String)props.getProperty("maven.war.includes"); + str = props.getProperty("maven.war.includes"); List defaultWarIncludes = fromCSV(str); - str = (String)props.getProperty("maven.war.excludes"); + str = props.getProperty("maven.war.excludes"); List defaultWarExcludes = fromCSV(str); //List of war artifacts @@ -288,19 +292,18 @@ public class Starter // - the equivalent of web-inf classes - str = (String)props.getProperty("classes.dir"); + str = props.getProperty("classes.dir"); if (str != null && !"".equals(str.trim())) { webApp.setClasses(new File(str)); } - str = (String)props.getProperty("testClasses.dir"); + str = props.getProperty("testClasses.dir"); if (str != null && !"".equals(str.trim())) { webApp.setTestClasses(new File(str)); } - // - the equivalent of web-inf lib str = props.getProperty("lib.jars"); if (str != null && !"".equals(str.trim())) @@ -311,6 +314,15 @@ public class Starter jars.add(new File(names[j].trim())); webApp.setWebInfLib(jars); } + + str = props.getProperty( "projects.classes.dir" ); + if (str != null && !"".equals(str.trim())) + { + List classesDirectories = // + Arrays.stream(str.split( Pattern.quote("|") )) // + .map( s -> Paths.get( s).toFile() ).collect( Collectors.toList() ); + webApp.getWebInfLib().addAll( classesDirectories ); + } } From 5f96644cf85c5d2af6255fda9b33c254e28598e4 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 15:07:18 +1000 Subject: [PATCH 08/27] Add it test for Maven Plugin #1638 Signed-off-by: olivier lamy --- .../it/jetty-start-mojo-it/invoker.properties | 1 + .../jetty-simple-base/pom.xml | 50 ++++++++++ .../its/jetty_run_mojo_it/HelloServlet.java | 45 +++++++++ .../jetty-simple-webapp/pom.xml | 92 +++++++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 7 ++ .../jetty_run_mojo_it/TestHelloServlet.java | 53 +++++++++++ .../src/it/jetty-start-mojo-it/pom.xml | 89 ++++++++++++++++++ 7 files changed, 337 insertions(+) create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/invoker.properties create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/invoker.properties b/jetty-maven-plugin/src/it/jetty-start-mojo-it/invoker.properties new file mode 100644 index 00000000000..e0222d4d54e --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/invoker.properties @@ -0,0 +1 @@ +invoker.goals = test \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml new file mode 100644 index 00000000000..7a9a5382308 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-start-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-base + jar + + Jetty :: Simple :: Base + + + + + javax.servlet + javax.servlet-api + jar + provided + + + + org.slf4j + slf4j-api + + + + commons-io + commons-io + + + + org.eclipse.jetty.toolchain + jetty-perf-helper + 1.0.5 + + + + com.fasterxml.jackson.core + jackson-databind + 2.8.1 + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java new file mode 100644 index 00000000000..a6d2a3e256d --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -0,0 +1,45 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + */ +@WebServlet("/hello") +public class HelloServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml new file mode 100644 index 00000000000..38ae1555a4b --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-start-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-webapp + war + + Jetty :: Simple :: Webapp + + + + + com.webtide.jetty.its.jetty-start-mojo-it + jetty-simple-base + + + + org.eclipse.jetty + jetty-servlet + provided + + + + org.eclipse.jetty + jetty-client + @project.version@ + test + + + + junit + junit + 4.12 + test + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin-version} + + false + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + + @jetty.runPort@ + + + + + org.eclipse.jetty + jetty-maven-plugin + + + start-jetty + test-compile + + start + + + + @jetty.runPort@ + + + + + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..2a5ac4b71bf --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + Jetty Simple Webapp run-mojo-it + diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java new file mode 100644 index 00000000000..1ec2da6ff78 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -0,0 +1,53 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import org.eclipse.jetty.client.HttpClient; +import org.junit.Assert; +import org.junit.Test; + +/** + * + */ +public class TestHelloServlet +{ + @Test + public void hello_servlet() + throws Exception + { + int port = Integer.getInteger( "jetty.runPort" ); + System.out.println( "port used:" + port ); + HttpClient httpClient = new HttpClient(); + try + { + httpClient.start(); + + String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "hello beer", response.trim() ); + } + finally + { + httpClient.stop(); + } + } +} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml new file mode 100644 index 00000000000..bc0398916e7 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml @@ -0,0 +1,89 @@ + + + 4.0.0 + + com.webtide.jetty.its.jetty-start-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + pom + + Jetty :: Simple + + + UTF-8 + UTF-8 + 1.8 + 3.0.0 + + + + jetty-simple-base + jetty-simple-webapp + + + + + + + com.webtide.jetty.its.jetty-start-mojo-it + jetty-simple-base + ${project.version} + + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + org.slf4j + slf4j-api + 1.7.21 + + + + commons-io + commons-io + 2.5 + + + + org.eclipse.jetty + jetty-servlet + @project.version@ + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + + org.eclipse.jetty + jetty-maven-plugin + @project.version@ + + + + + + From 7e27f038849fc3a39e14e0f83f640438ae67dd2b Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 15:51:38 +1000 Subject: [PATCH 09/27] add test with fragment for #1623 Signed-off-by: olivier lamy --- .../its/jetty_run_mojo_it/PingServlet.java | 41 +++++++++++++++++++ .../main/resources/META-INF/web-fragment.xml | 32 +++++++++++++++ .../jetty_run_mojo_it/TestHelloServlet.java | 6 +++ .../its/jetty_run_mojo_it/PingServlet.java | 41 +++++++++++++++++++ .../main/resources/META-INF/web-fragment.xml | 32 +++++++++++++++ .../jetty_run_mojo_it/TestHelloServlet.java | 6 +++ .../its/jetty_run_mojo_it/PingServlet.java | 41 +++++++++++++++++++ .../java/resources/META-INF/web-fragment.xml | 32 +++++++++++++++ .../jetty_run_mojo_it/TestHelloServlet.java | 6 +++ .../main/resources/META-INF/web-fragment.xml | 1 - 10 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/resources/META-INF/web-fragment.xml diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java new file mode 100644 index 00000000000..f5686592252 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PingServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml new file mode 100644 index 00000000000..031012f7fed --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -0,0 +1,32 @@ + + + + + FragmentA + + + + + + + Ping + com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + + extra1123 + + + extra2345 + + + + + Ping + /ping + + + + \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 27d9d55c787..f48eee38074 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -43,6 +43,12 @@ public class TestHelloServlet System.out.println( "httpResponse:" + response ); Assert.assertEquals( "hello beer", response.trim() ); + + response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "pong beer", response.trim() ); } finally { diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java new file mode 100644 index 00000000000..f5686592252 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PingServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml new file mode 100644 index 00000000000..031012f7fed --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -0,0 +1,32 @@ + + + + + FragmentA + + + + + + + Ping + com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + + extra1123 + + + extra2345 + + + + + Ping + /ping + + + + \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 1ec2da6ff78..4e3ced68d91 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -44,6 +44,12 @@ public class TestHelloServlet System.out.println( "httpResponse:" + response ); Assert.assertEquals( "hello beer", response.trim() ); + + response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "pong beer", response.trim() ); } finally { diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java new file mode 100644 index 00000000000..f5686592252 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PingServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/resources/META-INF/web-fragment.xml new file mode 100644 index 00000000000..031012f7fed --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/resources/META-INF/web-fragment.xml @@ -0,0 +1,32 @@ + + + + + FragmentA + + + + + + + Ping + com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + + extra1123 + + + extra2345 + + + + + Ping + /ping + + + + \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 1ec2da6ff78..4e3ced68d91 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -44,6 +44,12 @@ public class TestHelloServlet System.out.println( "httpResponse:" + response ); Assert.assertEquals( "hello beer", response.trim() ); + + response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "pong beer", response.trim() ); } finally { diff --git a/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/resources/META-INF/web-fragment.xml b/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/resources/META-INF/web-fragment.xml index a85aea5f030..ae015f2712c 100644 --- a/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/resources/META-INF/web-fragment.xml +++ b/tests/test-webapps/test-servlet-spec/test-web-fragment/src/main/resources/META-INF/web-fragment.xml @@ -32,7 +32,6 @@ Fragment /fragment/* - From 52fa23b968c2f34a6cc000f71ea15f7ab046441e Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 20:35:59 +1000 Subject: [PATCH 10/27] try to fix web fragment for directory classes #1623 Signed-off-by: olivier lamy --- jetty-maven-plugin/pom.xml | 12 ++++++++++++ .../org/eclipse/jetty/maven/plugin/JettyRunMojo.java | 12 +++++++++--- .../eclipse/jetty/webapp/MetaInfConfiguration.java | 3 +-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/jetty-maven-plugin/pom.xml b/jetty-maven-plugin/pom.xml index 5cee41ef475..0cf086102cd 100644 --- a/jetty-maven-plugin/pom.xml +++ b/jetty-maven-plugin/pom.xml @@ -247,6 +247,18 @@ + + + apache.snaphots + https://repository.apache.org/content/repositories/snapshots + + false + + + true + + + diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java index 00a6b9f3ec8..23f21a7125f 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java @@ -40,6 +40,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Set; +import java.util.stream.Collector; +import java.util.stream.Collectors; /** * This goal is used in-situ on a Maven project without first requiring that the project @@ -281,14 +283,18 @@ public class JettyRunMojo extends AbstractJettyMojo if (useTestScope && (testClassesDirectory != null)) webApp.setTestClasses (testClassesDirectory); - webApp.getClassPathFiles().addAll( getDependencyProjects() ); + List dependencyProjects = getDependencyProjects(); + webApp.getClassPathFiles().addAll( dependencyProjects ); + List dependencyResources = // + dependencyProjects.stream() // + .map( file -> Resource.newResource( file ) ) // + .collect( Collectors.toList() ); + webApp.getMetaData().getContainerResources().addAll( dependencyResources ); webApp.setWebInfLib (getDependencyFiles()); //get copy of a list of war artifacts Set matchedWarArtifacts = new HashSet(); - - //process any overlays and the war type artifacts List overlays = new ArrayList(); for (OverlayConfig config:warPluginInfo.getMavenWarOverlayConfigs()) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java index ea973624719..e06a55cda1e 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/MetaInfConfiguration.java @@ -276,8 +276,7 @@ public class MetaInfConfiguration extends AbstractConfiguration if (LOG.isDebugEnabled()) LOG.debug(jar+" META-INF/web-fragment.xml checked"); if (jar.isDirectory()) { - //TODO ???? - webFrag = jar.addPath("/META-INF/web-fragment.xml"); + webFrag = Resource.newResource( new File (jar.getFile(),"/META-INF/web-fragment.xml")); } else { From 4d43261031a6c1ab3ebc64d3198ba561126c543f Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 20:46:09 +1000 Subject: [PATCH 11/27] version in only one place Signed-off-by: olivier lamy --- jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml | 5 +++-- jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml | 5 +++-- jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml index e45f2ad1fcd..cada3739cce 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml @@ -15,6 +15,7 @@ UTF-8 1.8 3.0.0 + @project.version@ @@ -54,7 +55,7 @@ org.eclipse.jetty jetty-servlet - @project.version@ + ${jetty.version} @@ -80,7 +81,7 @@ org.eclipse.jetty jetty-maven-plugin - @project.version@ + ${jetty.version} diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml index 44247ef1e75..3d303f4caf8 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml @@ -15,6 +15,7 @@ UTF-8 1.8 3.0.0 + @project.version@ @@ -54,7 +55,7 @@ org.eclipse.jetty jetty-servlet - @project.version@ + ${jetty.version} @@ -80,7 +81,7 @@ org.eclipse.jetty jetty-maven-plugin - @project.version@ + ${jetty.version} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml index bc0398916e7..7319c0d604f 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml @@ -15,6 +15,7 @@ UTF-8 1.8 3.0.0 + @project.version@ @@ -54,7 +55,7 @@ org.eclipse.jetty jetty-servlet - @project.version@ + ${jetty.version} @@ -80,7 +81,7 @@ org.eclipse.jetty jetty-maven-plugin - @project.version@ + ${jetty.version} From 008158d9758bcb17a29abb43f34f30912191800a Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Fri, 23 Jun 2017 21:32:11 +1000 Subject: [PATCH 12/27] fix fragment from dependent projects #1623 Signed-off-by: olivier lamy --- .../resources/META-INF/web-fragment.xml | 0 .../jetty/maven/plugin/JettyRunMojo.java | 18 ++++++++++++++++-- .../jetty/maven/plugin/JettyWebAppContext.java | 9 ++++++--- .../maven/plugin/MavenWebInfConfiguration.java | 2 ++ 4 files changed, 24 insertions(+), 5 deletions(-) rename jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/{java => }/resources/META-INF/web-fragment.xml (100%) diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml similarity index 100% rename from jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/resources/META-INF/web-fragment.xml rename to jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java index 23f21a7125f..94102e9db95 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunMojo.java @@ -291,7 +291,11 @@ public class JettyRunMojo extends AbstractJettyMojo .collect( Collectors.toList() ); webApp.getMetaData().getContainerResources().addAll( dependencyResources ); webApp.setWebInfLib (getDependencyFiles()); - +// webApp.getWebInfLib().addAll( dependencyResources // +// .stream() // +// .map( resource -> toFile(resource) ) // +// .collect( Collectors.toList() ) ); + webApp.getDependentProjects().addAll( dependencyResources ); //get copy of a list of war artifacts Set matchedWarArtifacts = new HashSet(); @@ -373,7 +377,17 @@ public class JettyRunMojo extends AbstractJettyMojo getLog().info("Webapp directory = " + webAppSourceDirectory.getCanonicalPath()); } - + private static File toFile(Resource resource) + { + try + { + return resource.getFile(); + } + catch ( IOException e ) + { + throw new RuntimeException( e.getMessage(), e ); + } + } /** diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java index a27903ceed5..3ec20ce8081 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyWebAppContext.java @@ -104,9 +104,7 @@ public class JettyWebAppContext extends WebAppContext private Resource _quickStartWebXml; private String _originAttribute; private boolean _generateOrigin; - - - + private List dependentProjects = new ArrayList<>(); /** * Set the "org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern" with a pattern for matching jars on @@ -321,6 +319,11 @@ public class JettyWebAppContext extends WebAppContext { return _webInfJars; } + + public List getDependentProjects() + { + return dependentProjects; + } /* ------------------------------------------------------------ */ public void setGenerateQuickStart (boolean quickStart) diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenWebInfConfiguration.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenWebInfConfiguration.java index 2ea7443713e..440238d22b4 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenWebInfConfiguration.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/MavenWebInfConfiguration.java @@ -93,6 +93,8 @@ public class MavenWebInfConfiguration extends WebInfConfiguration public void preConfigure(WebAppContext context) throws Exception { super.preConfigure(context); + ((JettyWebAppContext)context).getDependentProjects() + .stream().forEach( resource -> context.getMetaData().addWebInfJar( resource ) ); } From 388106303faa10a906198c84b125289cd55c6ef7 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sat, 24 Jun 2017 21:22:06 +1000 Subject: [PATCH 13/27] add it test for run war mojo Signed-off-by: olivier lamy --- .../jetty-run-war-mojo-it/invoker.properties | 2 + .../jetty-simple-base/pom.xml | 50 ++++++++ .../its/jetty_run_mojo_it/HelloServlet.java | 45 +++++++ .../its/jetty_run_mojo_it/PingServlet.java | 41 ++++++ .../main/resources/META-INF/web-fragment.xml | 32 +++++ .../jetty-simple-webapp/pom.xml | 121 ++++++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 7 + .../jetty_run_mojo_it/TestHelloServlet.java | 59 +++++++++ .../src/it/jetty-run-war-mojo-it/pom.xml | 90 +++++++++++++ .../jetty/maven/plugin/JettyRunWarMojo.java | 4 + 10 files changed, 451 insertions(+) create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/invoker.properties create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/invoker.properties b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/invoker.properties new file mode 100644 index 00000000000..161dd58f0af --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = verify +#test-compile failsafe:integration-test \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml new file mode 100644 index 00000000000..8903e68d8a0 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-war-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-base + jar + + Jetty :: Simple :: Base + + + + + javax.servlet + javax.servlet-api + jar + provided + + + + org.slf4j + slf4j-api + + + + commons-io + commons-io + + + + org.eclipse.jetty.toolchain + jetty-perf-helper + 1.0.5 + + + + com.fasterxml.jackson.core + jackson-databind + 2.8.1 + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java new file mode 100644 index 00000000000..a6d2a3e256d --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -0,0 +1,45 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + */ +@WebServlet("/hello") +public class HelloServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java new file mode 100644 index 00000000000..f5686592252 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PingServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml new file mode 100644 index 00000000000..031012f7fed --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -0,0 +1,32 @@ + + + + + FragmentA + + + + + + + Ping + com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + + extra1123 + + + extra2345 + + + + + Ping + /ping + + + + \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml new file mode 100644 index 00000000000..23109b90f00 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml @@ -0,0 +1,121 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-war-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-webapp + war + + Jetty :: Simple :: Webapp + + + + + com.webtide.jetty.its.jetty-run-war-mojo-it + jetty-simple-base + + + + org.eclipse.jetty + jetty-servlet + provided + + + + org.eclipse.jetty + jetty-client + @project.version@ + test + + + + junit + junit + 4.12 + test + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin-version} + + false + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + true + + @jetty.runPort@ + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.20 + + + @jetty.runPort@ + + + **/*TestHelloServlet* + + + + + integration-test + + integration-test + + + + verify + + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + + + start-jetty + test-compile + + run-war + + + true + + @jetty.runPort@ + + + + + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..2a5ac4b71bf --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + Jetty Simple Webapp run-mojo-it + diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java new file mode 100644 index 00000000000..4e3ced68d91 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -0,0 +1,59 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import org.eclipse.jetty.client.HttpClient; +import org.junit.Assert; +import org.junit.Test; + +/** + * + */ +public class TestHelloServlet +{ + @Test + public void hello_servlet() + throws Exception + { + int port = Integer.getInteger( "jetty.runPort" ); + System.out.println( "port used:" + port ); + HttpClient httpClient = new HttpClient(); + try + { + httpClient.start(); + + String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "hello beer", response.trim() ); + + response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "pong beer", response.trim() ); + } + finally + { + httpClient.stop(); + } + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml new file mode 100644 index 00000000000..432f0120781 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + com.webtide.jetty.its.jetty-run-war-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + pom + + Jetty :: Simple + + + UTF-8 + UTF-8 + 1.8 + 3.0.0 + @project.version@ + + + + jetty-simple-base + jetty-simple-webapp + + + + + + + com.webtide.jetty.its.jetty-run-war-mojo-it + jetty-simple-base + ${project.version} + + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + org.slf4j + slf4j-api + 1.7.21 + + + + commons-io + commons-io + 2.5 + + + + org.eclipse.jetty + jetty-servlet + ${jetty.version} + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + + + + + diff --git a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java index 46249291769..aa81cb021d3 100644 --- a/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java +++ b/jetty-maven-plugin/src/main/java/org/eclipse/jetty/maven/plugin/JettyRunWarMojo.java @@ -61,6 +61,10 @@ public class JettyRunWarMojo extends AbstractJettyMojo */ public void execute() throws MojoExecutionException, MojoFailureException { + if ( !"war".equals( project.getPackaging() ) || skip ) + { + return; + } super.execute(); } From 8146001093333df87296d2f96f8a32df16d737bf Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sat, 24 Jun 2017 21:27:24 +1000 Subject: [PATCH 14/27] add it test for run war exploded mojo Signed-off-by: olivier lamy --- .../invoker.properties | 2 + .../jetty-simple-base/pom.xml | 50 ++++++++ .../its/jetty_run_mojo_it/HelloServlet.java | 45 +++++++ .../its/jetty_run_mojo_it/PingServlet.java | 41 ++++++ .../main/resources/META-INF/web-fragment.xml | 32 +++++ .../jetty-simple-webapp/pom.xml | 121 ++++++++++++++++++ .../src/main/webapp/WEB-INF/web.xml | 7 + .../jetty_run_mojo_it/TestHelloServlet.java | 59 +++++++++ .../it/jetty-run-war-exploded-mojo-it/pom.xml | 90 +++++++++++++ 9 files changed, 447 insertions(+) create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/invoker.properties create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/invoker.properties b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/invoker.properties new file mode 100644 index 00000000000..161dd58f0af --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/invoker.properties @@ -0,0 +1,2 @@ +invoker.goals = verify +#test-compile failsafe:integration-test \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml new file mode 100644 index 00000000000..4425c34f117 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml @@ -0,0 +1,50 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-base + jar + + Jetty :: Simple :: Base + + + + + javax.servlet + javax.servlet-api + jar + provided + + + + org.slf4j + slf4j-api + + + + commons-io + commons-io + + + + org.eclipse.jetty.toolchain + jetty-perf-helper + 1.0.5 + + + + com.fasterxml.jackson.core + jackson-databind + 2.8.1 + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java new file mode 100644 index 00000000000..a6d2a3e256d --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -0,0 +1,45 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + */ +@WebServlet("/hello") +public class HelloServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java new file mode 100644 index 00000000000..f5686592252 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PingServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml new file mode 100644 index 00000000000..031012f7fed --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -0,0 +1,32 @@ + + + + + FragmentA + + + + + + + Ping + com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + + extra1123 + + + extra2345 + + + + + Ping + /ping + + + + \ No newline at end of file diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml new file mode 100644 index 00000000000..0489e0e1a2c --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml @@ -0,0 +1,121 @@ + + + 4.0.0 + + + com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + + + jetty-simple-webapp + war + + Jetty :: Simple :: Webapp + + + + + com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + jetty-simple-base + + + + org.eclipse.jetty + jetty-servlet + provided + + + + org.eclipse.jetty + jetty-client + @project.version@ + test + + + + junit + junit + 4.12 + test + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + ${maven-war-plugin-version} + + false + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.20 + + true + + @jetty.runPort@ + + + + + org.apache.maven.plugins + maven-failsafe-plugin + 2.20 + + + @jetty.runPort@ + + + **/*TestHelloServlet* + + + + + integration-test + + integration-test + + + + verify + + verify + + + + + + org.eclipse.jetty + jetty-maven-plugin + + + start-jetty + test-compile + + run-exploded + + + true + + @jetty.runPort@ + + + + + + + + + + diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000000..2a5ac4b71bf --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,7 @@ + + + Jetty Simple Webapp run-mojo-it + diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java new file mode 100644 index 00000000000..4e3ced68d91 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -0,0 +1,59 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package com.webtide.jetty.its.jetty_run_mojo_it; + +import org.eclipse.jetty.client.HttpClient; +import org.junit.Assert; +import org.junit.Test; + +/** + * + */ +public class TestHelloServlet +{ + @Test + public void hello_servlet() + throws Exception + { + int port = Integer.getInteger( "jetty.runPort" ); + System.out.println( "port used:" + port ); + HttpClient httpClient = new HttpClient(); + try + { + httpClient.start(); + + String response = httpClient.GET( "http://localhost:" + port + "/hello?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "hello beer", response.trim() ); + + response = httpClient.GET( "http://localhost:" + port + "/ping?name=beer" ).getContentAsString(); + + System.out.println( "httpResponse:" + response ); + + Assert.assertEquals( "pong beer", response.trim() ); + } + finally + { + httpClient.stop(); + } + } +} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml new file mode 100644 index 00000000000..5b88c8fd196 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + jetty-simple-project + 0.0.1-SNAPSHOT + pom + + Jetty :: Simple + + + UTF-8 + UTF-8 + 1.8 + 3.0.0 + @project.version@ + + + + jetty-simple-base + jetty-simple-webapp + + + + + + + com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + jetty-simple-base + ${project.version} + + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + org.slf4j + slf4j-api + 1.7.21 + + + + commons-io + commons-io + 2.5 + + + + org.eclipse.jetty + jetty-servlet + ${jetty.version} + + + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.5.1 + + 1.8 + 1.8 + + + + org.apache.maven.plugins + maven-resources-plugin + 3.0.1 + + + org.eclipse.jetty + jetty-maven-plugin + ${jetty.version} + + + + + + From d249ba6ee0683a43e17b0e3e6af7afd3990696b9 Mon Sep 17 00:00:00 2001 From: olivier lamy Date: Sat, 24 Jun 2017 21:28:31 +1000 Subject: [PATCH 15/27] activate mojo it profile in Jenkinsfile Signed-off-by: olivier lamy --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0016dc734dd..185f2d6ab31 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -53,7 +53,7 @@ node { withEnv(mvnEnv) { timeout(time: 90, unit: 'MINUTES') { // Run test phase / ignore test failures - sh "mvn -B install -Dmaven.test.failure.ignore=true" + sh "mvn -B install -Dmaven.test.failure.ignore=true -Prun-its" // Report failures in the jenkins UI step([$class: 'JUnitResultArchiver', testResults: '**/target/surefire-reports/TEST-*.xml']) From 432b941f32b9faa54d726c5e567c36f8216a64bd Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Tue, 27 Jun 2017 10:36:17 +0200 Subject: [PATCH 16/27] Issue #1643 Configure selectors for AbstractProxyServlet --- .../org/eclipse/jetty/proxy/AbstractProxyServlet.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java index 09c50264057..5fc8e34813d 100644 --- a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java +++ b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java @@ -44,6 +44,7 @@ import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.ProtocolHandlers; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Response; +import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP; import org.eclipse.jetty.http.HttpField; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeaderValue; @@ -259,7 +260,7 @@ public abstract class AbstractProxyServlet extends HttpServlet * * * - * + * @see #newHttpClient() * @return a {@link HttpClient} configured from the {@link #getServletConfig() servlet configuration} * @throws ServletException if the {@link HttpClient} cannot be created */ @@ -340,11 +341,17 @@ public abstract class AbstractProxyServlet extends HttpServlet } /** + * The servlet init parameter 'selectors' can be set for the number of + * selector threads to be used by the HttpClient. * @return a new HttpClient instance */ protected HttpClient newHttpClient() { - return new HttpClient(); + int selectors = (Runtime.getRuntime().availableProcessors() + 1) / 2; + String value = getServletConfig().getInitParameter("selectors"); + if (value != null) + selectors = Integer.parseInt(value); + return new HttpClient(new HttpClientTransportOverHTTP(selectors),null); } protected HttpClient getHttpClient() From 7e462851492e8235255b122678383e09e4f05eb5 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Thu, 29 Jun 2017 08:12:11 +0200 Subject: [PATCH 17/27] Fix #1653 --- .../jetty/webapp/ClasspathPattern.java | 2 +- .../eclipse/jetty/webapp/WebAppContext.java | 33 +++++++++++++------ 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java index 9c224ef9ff0..5c089b1a331 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/ClasspathPattern.java @@ -43,7 +43,7 @@ import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.resource.Resource; /** - * Classpath classes list performs sequential pattern matching of a class name + * Classpath classes list performs pattern matching of a class name * against an internal array of classpath pattern entries. * A class pattern is a string of one of the forms:

    *
  • 'org.package.SomeClass' will match a specific class diff --git a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java index 070c670bd1c..5268e9e9c8a 100644 --- a/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java +++ b/jetty-webapp/src/main/java/org/eclipse/jetty/webapp/WebAppContext.java @@ -702,6 +702,10 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL } /* ------------------------------------------------------------ */ + /** + * @deprecated Use {@link #getServerClasspathPattern()}.{@link ClasspathPattern#add(String)} + * @param classOrPackageOrLocation pattern (see {@link ClasspathPattern} + */ @Deprecated public void addServerClass(String classOrPackageOrLocation) { @@ -713,13 +717,10 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL /* ------------------------------------------------------------ */ /** Prepend to the list of Server classes. - * @param classOrPackage A fully qualified class name (eg com.foo.MyClass) - * or a qualified package name ending with '.' (eg com.foo.). If the class - * or package has '-' it is excluded from the server classes and order is thus - * important when added system class patterns. This argument may also be a comma - * separated list of classOrPackage patterns. + * @param classOrPackage A pattern. * @see #setServerClasses(String[]) * @see Jetty Documentation: Classloading + * @deprecated Use {@link #getServerClasspathPattern()}.{@link ClasspathPattern#add(String)} */ @Deprecated public void prependServerClass(String classOrPackage) @@ -757,6 +758,11 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL } /* ------------------------------------------------------------ */ + /** + * + * @param classOrPackage pattern + * @deprecated Use {@link #getSystemClasspathPattern()}.{@link ClasspathPattern#add(String)} + */ @Deprecated public void addSystemClass(String classOrPackage) { @@ -769,13 +775,10 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL /* ------------------------------------------------------------ */ /** Prepend to the list of System classes. - * @param classOrPackage A fully qualified class name (eg com.foo.MyClass) - * or a qualified package name ending with '.' (eg com.foo.). If the class - * or package has '-' it is excluded from the system classes and order is thus - * important when added system class patterns.This argument may also be a comma - * separated list of classOrPackage patterns. + * @param classOrPackage A pattern. * @see #setSystemClasses(String[]) * @see Jetty Documentation: Classloading + * @deprecated Use {@link #getSystemClasspathPattern()}.{@link ClasspathPattern#add(String)} */ @Deprecated public void prependSystemClass(String classOrPackage) @@ -787,6 +790,11 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL } /* ------------------------------------------------------------ */ + /** + * @param name class name + * @return true if matched by {@link #getServerClasspathPattern()} + * @deprecated Use {@link #getServerClasspathPattern()}.{@link ClasspathPattern#match(String)} + */ @Deprecated public boolean isServerClass(String name) { @@ -797,6 +805,11 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL } /* ------------------------------------------------------------ */ + /** + * @param name class name + * @return true if matched by {@link #getServerClasspathPattern()} + * @deprecated Use {@link #getSystemClasspathPattern()}.{@link ClasspathPattern#match(String)} + */ @Deprecated public boolean isSystemClass(String name) { From 15cbaf9f83ef550f0adc3153d6a3d15e6eac7c1b Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 29 Jun 2017 06:43:27 -0700 Subject: [PATCH 18/27] Improving test reliability (esp on Windows) --- .../eclipse/jetty/util/BufferUtilTest.java | 14 +++++++------- .../util/RolloverFileOutputStreamTest.java | 7 +++---- .../org/eclipse/jetty/util/TypeUtilTest.java | 19 +++++++++++-------- .../util/resource/FileSystemResourceTest.java | 7 +++---- .../jetty/util/resource/ResourceTest.java | 5 +++-- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java index 7c7a038dd4d..89a1f7e6470 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/BufferUtilTest.java @@ -19,6 +19,12 @@ package org.eclipse.jetty.util; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; + import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileWriter; @@ -35,12 +41,6 @@ import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - public class BufferUtilTest { @Test @@ -346,7 +346,7 @@ public class BufferUtilTest String data="Now is the time for all good men to come to the aid of the party"; File file = File.createTempFile("test",".txt"); file.deleteOnExit(); - try(FileWriter out = new FileWriter(file);) + try(FileWriter out = new FileWriter(file)) { out.write(data); } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java index 9fa00057c4c..56947e9e3fb 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java @@ -37,7 +37,6 @@ import java.util.concurrent.TimeUnit; import org.eclipse.jetty.toolchain.test.FS; import org.eclipse.jetty.toolchain.test.MavenTestingUtils; -import org.eclipse.jetty.util.resource.ResourceTest; import org.hamcrest.Matchers; import org.junit.Test; @@ -182,9 +181,9 @@ public class RolloverFileOutputStreamTest } @Test - public void testFilehandling() throws Exception + public void testFileHandling() throws Exception { - File testDir = MavenTestingUtils.getTargetTestingDir(ResourceTest.class.getName()); + File testDir = MavenTestingUtils.getTargetTestingDir(RolloverFileOutputStreamTest.class.getName() + "_testFileHandling"); Path testPath = testDir.toPath(); FS.ensureEmpty(testDir); @@ -290,7 +289,7 @@ public class RolloverFileOutputStreamTest @Test public void testRollover() throws Exception { - File testDir = MavenTestingUtils.getTargetTestingDir(ResourceTest.class.getName()); + File testDir = MavenTestingUtils.getTargetTestingDir(RolloverFileOutputStreamTest.class.getName() + "_testRollover"); FS.ensureEmpty(testDir); ZoneId zone = toZoneId("Australia/Sydney"); diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java index 032cae7c313..d7085b9c77f 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/TypeUtilTest.java @@ -19,14 +19,16 @@ package org.eclipse.jetty.util; -import org.eclipse.jetty.toolchain.test.JDK; -import org.hamcrest.Matchers; -import org.junit.Assert; -import org.junit.Test; +import static org.hamcrest.CoreMatchers.containsString; +import static org.junit.Assert.assertThat; import java.nio.file.Path; import java.nio.file.Paths; +import org.eclipse.jetty.toolchain.test.JDK; +import org.junit.Assert; +import org.junit.Test; + public class TypeUtilTest { @Test @@ -129,18 +131,19 @@ public class TypeUtilTest public void testGetLocationOfClass() throws Exception { Path mavenRepoPath = Paths.get( System.getProperty( "mavenRepoPath" ) ); - String mavenRepo = mavenRepoPath.toFile().getPath(); + String mavenRepo = mavenRepoPath.toFile().getPath().replaceAll("\\\\", "/"); + // Classes from maven dependencies - Assert.assertThat(TypeUtil.getLocationOfClass(Assert.class).toASCIIString(),Matchers.containsString(mavenRepo)); + assertThat(TypeUtil.getLocationOfClass(Assert.class).toASCIIString(),containsString(mavenRepo)); // Class from project dependencies - Assert.assertThat(TypeUtil.getLocationOfClass(TypeUtil.class).toASCIIString(),Matchers.containsString("/classes/")); + assertThat(TypeUtil.getLocationOfClass(TypeUtil.class).toASCIIString(),containsString("/classes/")); // Class from JVM core String expectedJavaBase = "/rt.jar"; if(JDK.IS_9) expectedJavaBase = "/java.base/"; - Assert.assertThat(TypeUtil.getLocationOfClass(String.class).toASCIIString(),Matchers.containsString(expectedJavaBase)); + assertThat(TypeUtil.getLocationOfClass(String.class).toASCIIString(),containsString(expectedJavaBase)); } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java index f1e3e16316b..68b8d28266a 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/FileSystemResourceTest.java @@ -1404,13 +1404,12 @@ public class FileSystemResourceTest assumeTrue("Only windows supports UNC paths", OS.IS_WINDOWS); assumeFalse("FileResource does not support this test", _class.equals(FileResource.class)); - try (Resource base = newResource(URI.create("file://127.0.0.1/path"))) + try (Resource base = newResource(URI.create("file:////127.0.0.1/path"))) { Resource resource = base.addPath("WEB-INF/"); assertThat("getURI()", resource.getURI().toASCIIString(), containsString("path/WEB-INF/")); - assertThat("isAlias()", resource.isAlias(), is(true)); - assertThat("getAlias()", resource.getAlias(), notNullValue()); - assertThat("getAlias()", resource.getAlias().toASCIIString(), containsString("path/WEB-INF")); + assertThat("isAlias()", resource.isAlias(), is(false)); + assertThat("getAlias()", resource.getAlias(), nullValue()); } } } diff --git a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java index 3937d97a248..f978024bf4d 100644 --- a/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java +++ b/jetty-util/src/test/java/org/eclipse/jetty/util/resource/ResourceTest.java @@ -196,8 +196,9 @@ public class ResourceTest File testDir = MavenTestingUtils.getTargetTestingDir(ResourceTest.class.getName()); FS.ensureEmpty(testDir); - File tmpFile = File.createTempFile("test",null,testDir); - + File tmpFile = new File(testDir, "test.tmp"); + FS.touch(tmpFile); + cases.addCase(new Data(tmpFile.toString(),EXISTS,!DIR)); // Some resource references. From bb9a05d9feb9d9574a9ab59bb6fa3e7c95294c10 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Thu, 29 Jun 2017 09:57:28 -0700 Subject: [PATCH 19/27] Making tests more reliable on lesser FileSystems --- .../jetty/servlet/DefaultServletTest.java | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java index cff16eeea75..833d9236298 100644 --- a/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java +++ b/jetty-servlet/src/test/java/org/eclipse/jetty/servlet/DefaultServletTest.java @@ -19,6 +19,7 @@ package org.eclipse.jetty.servlet; import static org.junit.Assert.assertTrue; +import static org.junit.Assume.assumeTrue; import java.io.File; import java.io.FileOutputStream; @@ -231,10 +232,7 @@ public class DefaultServletTest createFile(index, "

    Hello Index

    "); File wackyDir = new File(resBase, "dir?"); - if (!OS.IS_WINDOWS) - { - FS.ensureDirExists(wackyDir); - } + assumeTrue("FileSystem should support question dirs", wackyDir.mkdirs()); wackyDir = new File(resBase, "dir;"); assertTrue(wackyDir.mkdirs()); @@ -266,13 +264,8 @@ public class DefaultServletTest response = connector.getResponse("GET /context/dir?/ HTTP/1.0\r\n\r\n"); assertResponseContains("404", response); - if (!OS.IS_WINDOWS) - { - response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n"); - assertResponseContains("Directory: /context/dir?/<", response); - } - else - assertResponseContains("404", response); + response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n"); + assertResponseContains("Directory: /context/dir?/<", response); response = connector.getResponse("GET /context/index.html HTTP/1.0\r\n\r\n"); assertResponseContains("Hello Index", response); @@ -421,7 +414,8 @@ public class DefaultServletTest context.setBaseResource(Resource.newResource(resBase)); File dir = new File(resBase, "dir?"); - assertTrue(dir.mkdirs()); + assumeTrue("FileSystem should support question dirs", dir.mkdirs()); + File index = new File(dir, "index.html"); createFile(index, "

    Hello Index

    "); @@ -437,7 +431,6 @@ public class DefaultServletTest response = connector.getResponse("GET /context/dir%3F/ HTTP/1.0\r\n\r\n"); assertResponseContains("Location: http://0.0.0.0/context/dir%3F/index.html", response); } - @Test public void testWelcomeServlet() throws Exception From 1341b47ad621b28b3550d68b4d11523c0fef38c7 Mon Sep 17 00:00:00 2001 From: WalkerWatch Date: Thu, 29 Jun 2017 14:09:37 -0400 Subject: [PATCH 20/27] Resolves #1408 --- .../clients/http/http-client-cookie.adoc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/jetty-documentation/src/main/asciidoc/development/clients/http/http-client-cookie.adoc b/jetty-documentation/src/main/asciidoc/development/clients/http/http-client-cookie.adoc index a2ab7b39eaa..9aa7d8839f2 100644 --- a/jetty-documentation/src/main/asciidoc/development/clients/http/http-client-cookie.adoc +++ b/jetty-documentation/src/main/asciidoc/development/clients/http/http-client-cookie.adoc @@ -86,3 +86,33 @@ public class GoogleOnlyCookieStore extends HttpCookieStore ---- The example above will retain only cookies that come from the `google.com` domain or sub-domains. + +==== Special Characters in Cookies +Jetty is compliant with link:https://tools.ietf.org/html/rfc6265[RFC6265], and as such care must be taken when setting a cookie value that includes special characters such as `;`. + +Previously, Version=1 cookies defined in link:https://tools.ietf.org/html/rfc2109[RFC2109] (and continued in link:https://tools.ietf.org/html/rfc2965[RFC2965]) allowed for special/reserved characters to be enclosed within double quotes when declared in a `Set-Cookie` response header: + +[source, java, subs="{sub-order}"] +---- +Set-Cookie: foo="bar;baz";Version=1;Path="/secur" +---- + +This was added to the HTTP Response header as follows: + +[source, java, subs="{sub-order}"] +---- +Cookie cookie = new Cookie("foo", "bar;baz"); +cookie.setPath("/secur"); +response.addCookie(cookie); +---- + +The introduction of RFC6265 has rendered this approach no longer possible; users are now required to encode cookie values that use these special characters. +This can be done utilizing `javax.servlet.http.Cookie` as follows: + +[source, java, subs="{sub-order}"] +---- +Cookie cookie = new Cookie("foo", URLEncoder.encode("bar;baz", "utf-8")); +---- + +Jetty validates all cookie names and values being added to the `HttpServletResponse` via the `addCookie(Cookie)` method. +If an illegal value is discovered Jetty will throw an `IllegalArgumentException` with the details. From 78e42130e71b9d1604f97aca05de61ab015831b8 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Mon, 3 Jul 2017 13:15:45 +0200 Subject: [PATCH 21/27] Issue #1643 - ProxyServlet always uses default number of selector threads. Reviewed changes and applied them to FastCGIProxyServlet as well. --- .../server/proxy/FastCGIProxyServlet.java | 20 +++++++++++-------- .../jetty/proxy/AbstractProxyServlet.java | 7 ++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/proxy/FastCGIProxyServlet.java b/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/proxy/FastCGIProxyServlet.java index b2cc9ffa25a..b5a42262c40 100644 --- a/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/proxy/FastCGIProxyServlet.java +++ b/jetty-fcgi/fcgi-server/src/main/java/org/eclipse/jetty/fcgi/server/proxy/FastCGIProxyServlet.java @@ -45,23 +45,23 @@ import org.eclipse.jetty.proxy.AsyncProxyServlet; * Specific implementation of {@link org.eclipse.jetty.proxy.AsyncProxyServlet.Transparent} for FastCGI. *

    * This servlet accepts a HTTP request and transforms it into a FastCGI request - * that is sent to the FastCGI server specified in the proxyTo + * that is sent to the FastCGI server specified in the {@code proxyTo} * init-param. *

    * This servlet accepts two additional init-params: *

      - *
    • scriptRoot, mandatory, that must be set to the directory where + *
    • {@code scriptRoot}, mandatory, that must be set to the directory where * the application that must be served via FastCGI is installed and corresponds to * the FastCGI DOCUMENT_ROOT parameter
    • - *
    • scriptPattern, optional, defaults to (.+?\.php), + *
    • {@code scriptPattern}, optional, defaults to {@code (.+?\.php)}, * that specifies a regular expression with at least 1 and at most 2 groups that specify * respectively: *
        *
      • the FastCGI SCRIPT_NAME parameter
      • *
      • the FastCGI PATH_INFO parameter
      • *
    • - *
    • fastCGI.HTTPS, optional, defaults to false, that specifies whether - * to force the FastCGI HTTPS parameter to the value on
    • + *
    • {@code fastCGI.HTTPS}, optional, defaults to false, that specifies whether + * to force the FastCGI {@code HTTPS} parameter to the value {@code on}
    • *
    * * @see TryFilesFilter @@ -111,7 +111,11 @@ public class FastCGIProxyServlet extends AsyncProxyServlet.Transparent String scriptRoot = config.getInitParameter(SCRIPT_ROOT_INIT_PARAM); if (scriptRoot == null) throw new IllegalArgumentException("Mandatory parameter '" + SCRIPT_ROOT_INIT_PARAM + "' not configured"); - return new HttpClient(new ProxyHttpClientTransportOverFCGI(scriptRoot), null); + int selectors = Math.max(1, Runtime.getRuntime().availableProcessors() / 2); + String value = config.getInitParameter("selectors"); + if (value != null) + selectors = Integer.parseInt(value); + return new HttpClient(new ProxyHttpClientTransportOverFCGI(selectors, scriptRoot), null); } @Override @@ -238,9 +242,9 @@ public class FastCGIProxyServlet extends AsyncProxyServlet.Transparent private class ProxyHttpClientTransportOverFCGI extends HttpClientTransportOverFCGI { - public ProxyHttpClientTransportOverFCGI(String scriptRoot) + private ProxyHttpClientTransportOverFCGI(int selectors, String scriptRoot) { - super(scriptRoot); + super(selectors, false, scriptRoot); } @Override diff --git a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java index 5fc8e34813d..cda4db05d1d 100644 --- a/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java +++ b/jetty-proxy/src/main/java/org/eclipse/jetty/proxy/AbstractProxyServlet.java @@ -258,6 +258,11 @@ public abstract class AbstractProxyServlet extends HttpServlet * HttpClient's default * The response buffer size, see {@link HttpClient#setResponseBufferSize(int)} * + * + * selectors + * cores / 2 + * The number of NIO selectors used by {@link HttpClient} + * * * * @see #newHttpClient() @@ -347,7 +352,7 @@ public abstract class AbstractProxyServlet extends HttpServlet */ protected HttpClient newHttpClient() { - int selectors = (Runtime.getRuntime().availableProcessors() + 1) / 2; + int selectors = Math.max(1, Runtime.getRuntime().availableProcessors() / 2); String value = getServletConfig().getInitParameter("selectors"); if (value != null) selectors = Integer.parseInt(value); From 6c0100181e8d3182be4906019b1475b09a7e1103 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 3 Jul 2017 14:51:45 +0200 Subject: [PATCH 22/27] Issue #1655 added openAcceptChannel --- .../eclipse/jetty/server/ServerConnector.java | 62 +++++++++++-------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java index 49bd3e5aaf3..cb39db08497 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java @@ -298,36 +298,44 @@ public class ServerConnector extends AbstractNetworkConnector { if (_acceptChannel == null) { - ServerSocketChannel serverChannel = null; - if (isInheritChannel()) - { - Channel channel = System.inheritedChannel(); - if (channel instanceof ServerSocketChannel) - serverChannel = (ServerSocketChannel)channel; - else - LOG.warn("Unable to use System.inheritedChannel() [{}]. Trying a new ServerSocketChannel at {}:{}", channel, getHost(), getPort()); - } - - if (serverChannel == null) - { - serverChannel = ServerSocketChannel.open(); - - InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort()); - serverChannel.socket().setReuseAddress(getReuseAddress()); - serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); - - _localPort = serverChannel.socket().getLocalPort(); - if (_localPort <= 0) - throw new IOException("Server channel not bound"); - } - - serverChannel.configureBlocking(true); - addBean(serverChannel); - - _acceptChannel = serverChannel; + _acceptChannel = openAcceptChannel(); + _acceptChannel.configureBlocking(true); + _localPort = _acceptChannel.socket().getLocalPort(); + if (_localPort <= 0) + throw new IOException("Server channel not bound"); + addBean(_acceptChannel); } } + /** + * Called by {@link #open()} to obtain the accepting channel. + * @return ServerSocketChannel used to accept connections. + * @throws IOException + */ + protected ServerSocketChannel openAcceptChannel() throws IOException + { + ServerSocketChannel serverChannel = null; + if (isInheritChannel()) + { + Channel channel = System.inheritedChannel(); + if (channel instanceof ServerSocketChannel) + serverChannel = (ServerSocketChannel)channel; + else + LOG.warn("Unable to use System.inheritedChannel() [{}]. Trying a new ServerSocketChannel at {}:{}", channel, getHost(), getPort()); + } + + if (serverChannel == null) + { + serverChannel = ServerSocketChannel.open(); + + InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort()); + serverChannel.socket().setReuseAddress(getReuseAddress()); + serverChannel.socket().bind(bindAddress, getAcceptQueueSize()); + } + + return serverChannel; + } + @Override public Future shutdown() { From fd44bbabdea2f416a3a9a8be78fbb4254c3d5059 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 3 Jul 2017 15:34:23 +0200 Subject: [PATCH 23/27] Issue #1655 added setter for accept channel --- .../org/eclipse/jetty/server/ServerConnector.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java index cb39db08497..4b21d948694 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java @@ -293,6 +293,20 @@ public class ServerConnector extends AbstractNetworkConnector _inheritChannel = inheritChannel; } + + public ServerSocketChannel getAcceptChannel() + { + return _acceptChannel; + } + + public void setAcceptChannel(ServerSocketChannel acceptChannel) + { + if (isStarted()) + throw new IllegalStateException(getState()); + updateBean(_acceptChannel,acceptChannel); + _acceptChannel = acceptChannel; + } + @Override public void open() throws IOException { @@ -307,6 +321,7 @@ public class ServerConnector extends AbstractNetworkConnector } } + /** * Called by {@link #open()} to obtain the accepting channel. * @return ServerSocketChannel used to accept connections. From 070a58ff591cc079dd861a657dd51b17d745ef03 Mon Sep 17 00:00:00 2001 From: Greg Wilkins Date: Mon, 3 Jul 2017 17:48:07 +0200 Subject: [PATCH 24/27] Issue #1655 ServerConnector configured with channel converted setter to open method added test harness --- .../eclipse/jetty/server/ServerConnector.java | 21 +++++----- .../jetty/server/ServerConnectorTest.java | 39 +++++++++++++++++++ 2 files changed, 51 insertions(+), 9 deletions(-) diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java index 4b21d948694..20382d8581f 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java @@ -285,7 +285,7 @@ public class ServerConnector extends AbstractNetworkConnector *

    Use it with xinetd/inetd, to launch an instance of Jetty on demand. The port * used to access pages on the Jetty instance is the same as the port used to * launch Jetty.

    - * + * @see ServerConnector#openAcceptChannel() * @param inheritChannel whether this connector uses a channel inherited from the JVM. */ public void setInheritChannel(boolean inheritChannel) @@ -293,18 +293,22 @@ public class ServerConnector extends AbstractNetworkConnector _inheritChannel = inheritChannel; } - - public ServerSocketChannel getAcceptChannel() - { - return _acceptChannel; - } - - public void setAcceptChannel(ServerSocketChannel acceptChannel) + /** + * Open the connector using the passed ServerSocketChannel. + * This open method can be called before starting the connector to pass it a ServerSocketChannel + * that will be used instead of one returned from {@link #openAcceptChannel()} + * @param acceptChannel the channel to use + * @throws IOException + */ + public void open(ServerSocketChannel acceptChannel) throws IOException { if (isStarted()) throw new IllegalStateException(getState()); updateBean(_acceptChannel,acceptChannel); _acceptChannel = acceptChannel; + _localPort = _acceptChannel.socket().getLocalPort(); + if (_localPort <= 0) + throw new IOException("Server channel not bound"); } @Override @@ -321,7 +325,6 @@ public class ServerConnector extends AbstractNetworkConnector } } - /** * Called by {@link #open()} to obtain the accepting channel. * @return ServerSocketChannel used to accept connections. diff --git a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java index 6783a8d5119..663eb64850c 100644 --- a/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java +++ b/jetty-server/src/test/java/org/eclipse/jetty/server/ServerConnectorTest.java @@ -23,9 +23,11 @@ import java.io.InputStream; import java.io.PrintWriter; import java.lang.reflect.Field; import java.net.HttpURLConnection; +import java.net.InetSocketAddress; import java.net.Socket; import java.net.URI; import java.net.URISyntaxException; +import java.nio.channels.ServerSocketChannel; import java.nio.charset.StandardCharsets; import java.util.Collection; import java.util.concurrent.atomic.AtomicLong; @@ -43,16 +45,19 @@ import org.eclipse.jetty.toolchain.test.OS; import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.log.StacklessLogging; import org.hamcrest.Matchers; +import org.junit.Assert; import org.junit.Test; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertSame; import static org.junit.Assert.assertThat; +import static org.junit.Assert.assertTrue; public class ServerConnectorTest { @@ -265,5 +270,39 @@ public class ServerConnectorTest { server.stop(); } + } + + @Test + public void testOpenWithServerSocketChannel() throws Exception + { + Server server = new Server(); + ServerConnector connector = new ServerConnector(server); + server.addConnector(connector); + + ServerSocketChannel channel = ServerSocketChannel.open(); + channel.bind(new InetSocketAddress(0)); + + assertTrue(channel.isOpen()); + int port = channel.socket().getLocalPort(); + assertThat(port,greaterThan(0)); + + connector.open(channel); + + assertThat(connector.getLocalPort(),is(port)); + + server.start(); + + assertThat(connector.getLocalPort(),is(port)); + assertThat(connector.getTransport(),is(channel)); + + server.stop(); + + assertThat(connector.getTransport(),Matchers.nullValue()); + + + + + + } } From 9d0bcdbce4c3698aa5332b851eb7751a0bd504dd Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 4 Jul 2017 11:23:17 +0200 Subject: [PATCH 25/27] Fixes #1656 - Improve configurability of ConnectionPools. Introduced ConnectionPool.Factory and HttpClientTransport.connectionPoolFactory. This allows applications to create a ConnectionPool given the HttpDestination. --- .../AbstractConnectorHttpClientTransport.java | 183 ++++++++++++++++++ .../client/AbstractHttpClientTransport.java | 160 +-------------- .../eclipse/jetty/client/ConnectionPool.java | 53 +++++ .../jetty/client/HttpClientTransport.java | 10 + .../eclipse/jetty/client/HttpDestination.java | 5 +- .../client/MultiplexHttpDestination.java | 6 - .../jetty/client/PoolingHttpDestination.java | 5 - .../http/HttpClientTransportOverHTTP.java | 6 +- .../client/ValidatingConnectionPoolTest.java | 31 +-- .../http/HttpClientTransportOverFCGI.java | 15 +- .../server/AbstractHttpClientServerTest.java | 29 +-- .../http/HttpClientTransportOverHTTP2.java | 32 ++- .../jetty/http/client/HttpClientLoadTest.java | 58 ++---- 13 files changed, 313 insertions(+), 280 deletions(-) create mode 100644 jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java new file mode 100644 index 00000000000..e50294ba3f5 --- /dev/null +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractConnectorHttpClientTransport.java @@ -0,0 +1,183 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + +package org.eclipse.jetty.client; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.SocketException; +import java.nio.channels.SelectableChannel; +import java.nio.channels.SelectionKey; +import java.nio.channels.SocketChannel; +import java.util.Map; + +import org.eclipse.jetty.client.api.Connection; +import org.eclipse.jetty.io.EndPoint; +import org.eclipse.jetty.io.ManagedSelector; +import org.eclipse.jetty.io.SelectorManager; +import org.eclipse.jetty.io.SocketChannelEndPoint; +import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; +import org.eclipse.jetty.util.Promise; +import org.eclipse.jetty.util.annotation.ManagedAttribute; + +public abstract class AbstractConnectorHttpClientTransport extends AbstractHttpClientTransport +{ + private final int selectors; + private SelectorManager selectorManager; + + protected AbstractConnectorHttpClientTransport(int selectors) + { + this.selectors = selectors; + } + + @ManagedAttribute(value = "The number of selectors", readonly = true) + public int getSelectors() + { + return selectors; + } + + @Override + protected void doStart() throws Exception + { + HttpClient httpClient = getHttpClient(); + selectorManager = newSelectorManager(httpClient); + selectorManager.setConnectTimeout(httpClient.getConnectTimeout()); + addBean(selectorManager); + super.doStart(); + } + + @Override + protected void doStop() throws Exception + { + super.doStop(); + removeBean(selectorManager); + } + + @Override + public void connect(InetSocketAddress address, Map context) + { + SocketChannel channel = null; + try + { + channel = SocketChannel.open(); + HttpDestination destination = (HttpDestination)context.get(HTTP_DESTINATION_CONTEXT_KEY); + HttpClient client = destination.getHttpClient(); + SocketAddress bindAddress = client.getBindAddress(); + if (bindAddress != null) + channel.bind(bindAddress); + configure(client, channel); + + context.put(SslClientConnectionFactory.SSL_PEER_HOST_CONTEXT_KEY, destination.getHost()); + context.put(SslClientConnectionFactory.SSL_PEER_PORT_CONTEXT_KEY, destination.getPort()); + + if (client.isConnectBlocking()) + { + channel.socket().connect(address, (int)client.getConnectTimeout()); + channel.configureBlocking(false); + selectorManager.accept(channel, context); + } + else + { + channel.configureBlocking(false); + if (channel.connect(address)) + selectorManager.accept(channel, context); + else + selectorManager.connect(channel, context); + } + } + // Must catch all exceptions, since some like + // UnresolvedAddressException are not IOExceptions. + catch (Throwable x) + { + // If IPv6 is not deployed, a generic SocketException "Network is unreachable" + // exception is being thrown, so we attempt to provide a better error message. + if (x.getClass() == SocketException.class) + x = new SocketException("Could not connect to " + address).initCause(x); + + try + { + if (channel != null) + channel.close(); + } + catch (IOException xx) + { + LOG.ignore(xx); + } + finally + { + connectFailed(context, x); + } + } + } + + protected void connectFailed(Map context, Throwable x) + { + if (LOG.isDebugEnabled()) + LOG.debug("Could not connect to {}", context.get(HTTP_DESTINATION_CONTEXT_KEY)); + @SuppressWarnings("unchecked") + Promise promise = (Promise)context.get(HTTP_CONNECTION_PROMISE_CONTEXT_KEY); + promise.failed(x); + } + + protected void configure(HttpClient client, SocketChannel channel) throws IOException + { + channel.socket().setTcpNoDelay(client.isTCPNoDelay()); + } + + protected SelectorManager newSelectorManager(HttpClient client) + { + return new ClientSelectorManager(client, getSelectors()); + } + + protected class ClientSelectorManager extends SelectorManager + { + private final HttpClient client; + + protected ClientSelectorManager(HttpClient client, int selectors) + { + super(client.getExecutor(), client.getScheduler(), selectors); + this.client = client; + } + + @Override + protected EndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey key) + { + SocketChannelEndPoint endp = new SocketChannelEndPoint(channel, selector, key, getScheduler()); + endp.setIdleTimeout(client.getIdleTimeout()); + return endp; + } + + @Override + public org.eclipse.jetty.io.Connection newConnection(SelectableChannel channel, EndPoint endPoint, Object attachment) throws IOException + { + @SuppressWarnings("unchecked") + Map context = (Map)attachment; + HttpDestination destination = (HttpDestination)context.get(HTTP_DESTINATION_CONTEXT_KEY); + return destination.getClientConnectionFactory().newConnection(endPoint, context); + } + + @Override + protected void connectionFailed(SelectableChannel channel, Throwable x, Object attachment) + { + @SuppressWarnings("unchecked") + Map context = (Map)attachment; + connectFailed(context, x); + } + } +} diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpClientTransport.java b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpClientTransport.java index 0b120aa6a16..499c170c69e 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpClientTransport.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/AbstractHttpClientTransport.java @@ -18,24 +18,6 @@ package org.eclipse.jetty.client; -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.SocketAddress; -import java.net.SocketException; -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; -import java.util.Map; - -import org.eclipse.jetty.client.api.Connection; -import org.eclipse.jetty.io.EndPoint; -import org.eclipse.jetty.io.ManagedSelector; -import org.eclipse.jetty.io.SelectChannelEndPoint; -import org.eclipse.jetty.io.SelectorManager; -import org.eclipse.jetty.io.SocketChannelEndPoint; -import org.eclipse.jetty.io.ssl.SslClientConnectionFactory; -import org.eclipse.jetty.util.Promise; -import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.log.Log; @@ -46,14 +28,8 @@ public abstract class AbstractHttpClientTransport extends ContainerLifeCycle imp { protected static final Logger LOG = Log.getLogger(HttpClientTransport.class); - private final int selectors; - private volatile HttpClient client; - private volatile SelectorManager selectorManager; - - protected AbstractHttpClientTransport(int selectors) - { - this.selectors = selectors; - } + private HttpClient client; + private ConnectionPool.Factory factory; protected HttpClient getHttpClient() { @@ -66,137 +42,15 @@ public abstract class AbstractHttpClientTransport extends ContainerLifeCycle imp this.client = client; } - @ManagedAttribute(value = "The number of selectors", readonly = true) - public int getSelectors() + @Override + public ConnectionPool.Factory getConnectionPoolFactory() { - return selectors; + return factory; } @Override - protected void doStart() throws Exception + public void setConnectionPoolFactory(ConnectionPool.Factory factory) { - selectorManager = newSelectorManager(client); - selectorManager.setConnectTimeout(client.getConnectTimeout()); - addBean(selectorManager); - super.doStart(); - } - - @Override - protected void doStop() throws Exception - { - super.doStop(); - removeBean(selectorManager); - } - - @Override - public void connect(InetSocketAddress address, Map context) - { - SocketChannel channel = null; - try - { - channel = SocketChannel.open(); - HttpDestination destination = (HttpDestination)context.get(HTTP_DESTINATION_CONTEXT_KEY); - HttpClient client = destination.getHttpClient(); - SocketAddress bindAddress = client.getBindAddress(); - if (bindAddress != null) - channel.bind(bindAddress); - configure(client, channel); - - context.put(SslClientConnectionFactory.SSL_PEER_HOST_CONTEXT_KEY, destination.getHost()); - context.put(SslClientConnectionFactory.SSL_PEER_PORT_CONTEXT_KEY, destination.getPort()); - - if (client.isConnectBlocking()) - { - channel.socket().connect(address, (int)client.getConnectTimeout()); - channel.configureBlocking(false); - selectorManager.accept(channel, context); - } - else - { - channel.configureBlocking(false); - if (channel.connect(address)) - selectorManager.accept(channel, context); - else - selectorManager.connect(channel, context); - } - } - // Must catch all exceptions, since some like - // UnresolvedAddressException are not IOExceptions. - catch (Throwable x) - { - // If IPv6 is not deployed, a generic SocketException "Network is unreachable" - // exception is being thrown, so we attempt to provide a better error message. - if (x.getClass() == SocketException.class) - x = new SocketException("Could not connect to " + address).initCause(x); - - try - { - if (channel != null) - channel.close(); - } - catch (IOException xx) - { - LOG.ignore(xx); - } - finally - { - connectFailed(context, x); - } - } - } - - protected void connectFailed(Map context, Throwable x) - { - if (LOG.isDebugEnabled()) - LOG.debug("Could not connect to {}", context.get(HTTP_DESTINATION_CONTEXT_KEY)); - @SuppressWarnings("unchecked") - Promise promise = (Promise)context.get(HTTP_CONNECTION_PROMISE_CONTEXT_KEY); - promise.failed(x); - } - - protected void configure(HttpClient client, SocketChannel channel) throws IOException - { - channel.socket().setTcpNoDelay(client.isTCPNoDelay()); - } - - protected SelectorManager newSelectorManager(HttpClient client) - { - return new ClientSelectorManager(client, selectors); - } - - protected class ClientSelectorManager extends SelectorManager - { - private final HttpClient client; - - protected ClientSelectorManager(HttpClient client, int selectors) - { - super(client.getExecutor(), client.getScheduler(), selectors); - this.client = client; - } - - @Override - protected EndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey key) - { - SocketChannelEndPoint endp = new SocketChannelEndPoint(channel, selector, key, getScheduler()); - endp.setIdleTimeout(client.getIdleTimeout()); - return endp; - } - - @Override - public org.eclipse.jetty.io.Connection newConnection(SelectableChannel channel, EndPoint endPoint, Object attachment) throws IOException - { - @SuppressWarnings("unchecked") - Map context = (Map)attachment; - HttpDestination destination = (HttpDestination)context.get(HTTP_DESTINATION_CONTEXT_KEY); - return destination.getClientConnectionFactory().newConnection(endPoint, context); - } - - @Override - protected void connectionFailed(SelectableChannel channel, Throwable x, Object attachment) - { - @SuppressWarnings("unchecked") - Map context = (Map)attachment; - connectFailed(context, x); - } + this.factory = factory; } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/ConnectionPool.java b/jetty-client/src/main/java/org/eclipse/jetty/client/ConnectionPool.java index 9bdcc297a44..effaa0da802 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/ConnectionPool.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/ConnectionPool.java @@ -22,20 +22,73 @@ import java.io.Closeable; import org.eclipse.jetty.client.api.Connection; +/** + *

    Client-side connection pool abstraction.

    + */ public interface ConnectionPool extends Closeable { + /** + * @param connection the connection to test + * @return whether the given connection is currently in use + */ boolean isActive(Connection connection); + /** + * @return whether this ConnectionPool has no open connections + */ boolean isEmpty(); + /** + * @return whether this ConnectionPool has been closed + * @see #close() + */ boolean isClosed(); + /** + *

    Returns an idle connection, if available, or schedules the opening + * of a new connection and returns {@code null}.

    + * + * @return an available connection, or null + */ Connection acquire(); + /** + *

    Returns the given connection, previously obtained via {@link #acquire()}, + * back to this ConnectionPool.

    + * + * @param connection the connection to release + * @return true if the connection has been released, false if the connection + * was not obtained from the this ConnectionPool + */ boolean release(Connection connection); + /** + *

    Removes the given connection from this ConnectionPool.

    + * + * @param connection the connection to remove + * @return true if the connection was removed from this ConnectionPool + */ boolean remove(Connection connection); + /** + * Closes this ConnectionPool. + * + * @see #isClosed() + */ @Override void close(); + + /** + * Factory for ConnectionPool instances. + */ + interface Factory + { + /** + * Creates a new ConnectionPool for the given destination. + * + * @param destination the destination to create the ConnectionPool for + * @return the newly created ConnectionPool + */ + ConnectionPool newConnectionPool(HttpDestination destination); + } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClientTransport.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClientTransport.java index 45382531b1d..b799b1be1de 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClientTransport.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpClientTransport.java @@ -68,4 +68,14 @@ public interface HttpClientTransport extends ClientConnectionFactory * @param context the context information to establish the connection */ public void connect(InetSocketAddress address, Map context); + + /** + * @return the factory for ConnectionPool instances + */ + public ConnectionPool.Factory getConnectionPoolFactory(); + + /** + * @param factory the factory for ConnectionPool instances + */ + public void setConnectionPoolFactory(ConnectionPool.Factory factory); } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java index dbc4ba4f787..bbe3bb375e5 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java @@ -114,7 +114,10 @@ public abstract class HttpDestination extends ContainerLifeCycle implements Dest removeBean(connectionPool); } - protected abstract ConnectionPool newConnectionPool(HttpClient client); + protected ConnectionPool newConnectionPool(HttpClient client) + { + return client.getTransport().getConnectionPoolFactory().newConnectionPool(this); + } protected Queue newExchangeQueue(HttpClient client) { diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java index 4267a40be15..da168f889f0 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/MultiplexHttpDestination.java @@ -25,12 +25,6 @@ public abstract class MultiplexHttpDestination extends HttpDestination super(client, origin); } - protected ConnectionPool newConnectionPool(HttpClient client) - { - return new MultiplexConnectionPool(this, client.getMaxConnectionsPerDestination(), this, - client.getMaxRequestsQueuedPerDestination()); - } - public int getMaxRequestsPerConnection() { ConnectionPool connectionPool = getConnectionPool(); diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/PoolingHttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/PoolingHttpDestination.java index a9ee093e67a..9746052497f 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/PoolingHttpDestination.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/PoolingHttpDestination.java @@ -24,9 +24,4 @@ public abstract class PoolingHttpDestination extends HttpDestination { super(client, origin); } - - protected ConnectionPool newConnectionPool(HttpClient client) - { - return new DuplexConnectionPool(this, client.getMaxConnectionsPerDestination(), this); - } } diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java index 931ca304299..1380c52b48b 100644 --- a/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java +++ b/jetty-client/src/main/java/org/eclipse/jetty/client/http/HttpClientTransportOverHTTP.java @@ -21,7 +21,8 @@ package org.eclipse.jetty.client.http; import java.io.IOException; import java.util.Map; -import org.eclipse.jetty.client.AbstractHttpClientTransport; +import org.eclipse.jetty.client.AbstractConnectorHttpClientTransport; +import org.eclipse.jetty.client.DuplexConnectionPool; import org.eclipse.jetty.client.HttpDestination; import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.client.api.Connection; @@ -30,7 +31,7 @@ import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.annotation.ManagedObject; @ManagedObject("The HTTP/1.1 client transport") -public class HttpClientTransportOverHTTP extends AbstractHttpClientTransport +public class HttpClientTransportOverHTTP extends AbstractConnectorHttpClientTransport { public HttpClientTransportOverHTTP() { @@ -40,6 +41,7 @@ public class HttpClientTransportOverHTTP extends AbstractHttpClientTransport public HttpClientTransportOverHTTP(int selectors) { super(selectors); + setConnectionPoolFactory(destination -> new DuplexConnectionPool(destination, getHttpClient().getMaxConnectionsPerDestination(), destination)); } @Override diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java index 5beda2959fa..5629d2dc938 100644 --- a/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java +++ b/jetty-client/src/test/java/org/eclipse/jetty/client/ValidatingConnectionPoolTest.java @@ -29,7 +29,6 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP; -import org.eclipse.jetty.client.http.HttpDestinationOverHTTP; import org.eclipse.jetty.client.util.FutureResponseListener; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpHeaderValue; @@ -50,7 +49,11 @@ public class ValidatingConnectionPoolTest extends AbstractHttpClientServerTest @Override protected void startClient() throws Exception { - startClient(new ValidatingHttpClientTransportOverHTTP(1000)); + long timeout = 1000; + HttpClientTransportOverHTTP transport = new HttpClientTransportOverHTTP(1); + transport.setConnectionPoolFactory(destination -> + new ValidatingConnectionPool(destination, destination.getHttpClient().getMaxConnectionsPerDestination(), destination, destination.getHttpClient().getScheduler(), timeout)); + startClient(transport); } @Test @@ -177,28 +180,4 @@ public class ValidatingConnectionPoolTest extends AbstractHttpClientServerTest ContentResponse response2 = listener2.get(5, TimeUnit.SECONDS); Assert.assertEquals(200, response2.getStatus()); } - - private static class ValidatingHttpClientTransportOverHTTP extends HttpClientTransportOverHTTP - { - private final long timeout; - - public ValidatingHttpClientTransportOverHTTP(long timeout) - { - super(1); - this.timeout = timeout; - } - - @Override - public HttpDestination newHttpDestination(Origin origin) - { - return new HttpDestinationOverHTTP(getHttpClient(), origin) - { - @Override - protected DuplexConnectionPool newConnectionPool(HttpClient client) - { - return new ValidatingConnectionPool(this, client.getMaxConnectionsPerDestination(), this, client.getScheduler(), timeout); - } - }; - } - } } diff --git a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpClientTransportOverFCGI.java b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpClientTransportOverFCGI.java index aded21e1b48..693c56fb990 100644 --- a/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpClientTransportOverFCGI.java +++ b/jetty-fcgi/fcgi-client/src/main/java/org/eclipse/jetty/fcgi/client/http/HttpClientTransportOverFCGI.java @@ -21,8 +21,11 @@ package org.eclipse.jetty.fcgi.client.http; import java.io.IOException; import java.util.Map; -import org.eclipse.jetty.client.AbstractHttpClientTransport; +import org.eclipse.jetty.client.AbstractConnectorHttpClientTransport; +import org.eclipse.jetty.client.DuplexConnectionPool; +import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpDestination; +import org.eclipse.jetty.client.MultiplexConnectionPool; import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.client.api.Connection; import org.eclipse.jetty.client.api.Request; @@ -34,7 +37,7 @@ import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; @ManagedObject("The FastCGI/1.0 client transport") -public class HttpClientTransportOverFCGI extends AbstractHttpClientTransport +public class HttpClientTransportOverFCGI extends AbstractConnectorHttpClientTransport { private final boolean multiplexed; private final String scriptRoot; @@ -49,6 +52,14 @@ public class HttpClientTransportOverFCGI extends AbstractHttpClientTransport super(selectors); this.multiplexed = multiplexed; this.scriptRoot = scriptRoot; + setConnectionPoolFactory(destination -> + { + HttpClient httpClient = getHttpClient(); + int maxConnections = httpClient.getMaxConnectionsPerDestination(); + return isMultiplexed() ? + new MultiplexConnectionPool(destination, maxConnections, destination, httpClient.getMaxRequestsQueuedPerDestination()) : + new DuplexConnectionPool(destination, maxConnections, destination); + }); } public boolean isMultiplexed() diff --git a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java index b9a8346e7ee..58452512ccd 100644 --- a/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java +++ b/jetty-fcgi/fcgi-server/src/test/java/org/eclipse/jetty/fcgi/server/AbstractHttpClientServerTest.java @@ -20,13 +20,10 @@ package org.eclipse.jetty.fcgi.server; import java.util.concurrent.atomic.AtomicLong; -import org.eclipse.jetty.client.DuplexConnectionPool; import org.eclipse.jetty.client.HttpClient; -import org.eclipse.jetty.client.HttpDestination; +import org.eclipse.jetty.client.HttpClientTransport; import org.eclipse.jetty.client.LeakTrackingConnectionPool; -import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.fcgi.client.http.HttpClientTransportOverFCGI; -import org.eclipse.jetty.fcgi.client.http.HttpDestinationOverFCGI; import org.eclipse.jetty.http.HttpScheme; import org.eclipse.jetty.io.LeakTrackingByteBufferPool; import org.eclipse.jetty.io.MappedByteBufferPool; @@ -72,28 +69,16 @@ public abstract class AbstractHttpClientServerTest QueuedThreadPool executor = new QueuedThreadPool(); executor.setName(executor.getName() + "-client"); - client = new HttpClient(new HttpClientTransportOverFCGI(1, false, "") + HttpClientTransport transport = new HttpClientTransportOverFCGI(1, false, ""); + transport.setConnectionPoolFactory(destination -> new LeakTrackingConnectionPool(destination, client.getMaxConnectionsPerDestination(), destination) { @Override - public HttpDestination newHttpDestination(Origin origin) + protected void leaked(LeakDetector.LeakInfo leakInfo) { - return new HttpDestinationOverFCGI(client, origin) - { - @Override - protected DuplexConnectionPool newConnectionPool(HttpClient client) - { - return new LeakTrackingConnectionPool(this, client.getMaxConnectionsPerDestination(), this) - { - @Override - protected void leaked(LeakDetector.LeakInfo leakInfo) - { - connectionLeaks.incrementAndGet(); - } - }; - } - }; + connectionLeaks.incrementAndGet(); } - }, null); + }); + client = new HttpClient(transport, null); client.setExecutor(executor); clientBufferPool = new LeakTrackingByteBufferPool(new MappedByteBufferPool.Tagged()); client.setByteBufferPool(clientBufferPool); diff --git a/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java b/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java index 81f96481bf6..76a5cf036eb 100644 --- a/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java +++ b/jetty-http2/http2-http-client-transport/src/main/java/org/eclipse/jetty/http2/client/http/HttpClientTransportOverHTTP2.java @@ -24,9 +24,10 @@ import java.util.HashMap; import java.util.Map; import org.eclipse.jetty.alpn.client.ALPNClientConnectionFactory; +import org.eclipse.jetty.client.AbstractHttpClientTransport; import org.eclipse.jetty.client.HttpClient; -import org.eclipse.jetty.client.HttpClientTransport; import org.eclipse.jetty.client.HttpDestination; +import org.eclipse.jetty.client.MultiplexConnectionPool; import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.client.ProxyConfiguration; import org.eclipse.jetty.client.api.Connection; @@ -42,20 +43,23 @@ import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.util.Promise; import org.eclipse.jetty.util.annotation.ManagedAttribute; import org.eclipse.jetty.util.annotation.ManagedObject; -import org.eclipse.jetty.util.component.ContainerLifeCycle; import org.eclipse.jetty.util.ssl.SslContextFactory; @ManagedObject("The HTTP/2 client transport") -public class HttpClientTransportOverHTTP2 extends ContainerLifeCycle implements HttpClientTransport +public class HttpClientTransportOverHTTP2 extends AbstractHttpClientTransport { private final HTTP2Client client; private ClientConnectionFactory connectionFactory; - private HttpClient httpClient; private boolean useALPN = true; public HttpClientTransportOverHTTP2(HTTP2Client client) { this.client = client; + setConnectionPoolFactory(destination -> + { + HttpClient httpClient = getHttpClient(); + return new MultiplexConnectionPool(destination, httpClient.getMaxConnectionsPerDestination(), destination, httpClient.getMaxRequestsQueuedPerDestination()); + }); } @ManagedAttribute(value = "The number of selectors", readonly = true) @@ -79,6 +83,7 @@ public class HttpClientTransportOverHTTP2 extends ContainerLifeCycle implements { if (!client.isStarted()) { + HttpClient httpClient = getHttpClient(); client.setExecutor(httpClient.getExecutor()); client.setScheduler(httpClient.getScheduler()); client.setByteBufferPool(httpClient.getByteBufferPool()); @@ -104,34 +109,23 @@ public class HttpClientTransportOverHTTP2 extends ContainerLifeCycle implements removeBean(client); } - protected HttpClient getHttpClient() - { - return httpClient; - } - - @Override - public void setHttpClient(HttpClient client) - { - httpClient = client; - } - @Override public HttpDestination newHttpDestination(Origin origin) { - return new HttpDestinationOverHTTP2(httpClient, origin); + return new HttpDestinationOverHTTP2(getHttpClient(), origin); } @Override public void connect(InetSocketAddress address, Map context) { - client.setConnectTimeout(httpClient.getConnectTimeout()); + client.setConnectTimeout(getHttpClient().getConnectTimeout()); SessionListenerPromise listenerPromise = new SessionListenerPromise(context); HttpDestinationOverHTTP2 destination = (HttpDestinationOverHTTP2)context.get(HTTP_DESTINATION_CONTEXT_KEY); SslContextFactory sslContextFactory = null; if (HttpScheme.HTTPS.is(destination.getScheme())) - sslContextFactory = httpClient.getSslContextFactory(); + sslContextFactory = getHttpClient().getSslContextFactory(); client.connect(sslContextFactory, address, listenerPromise, listenerPromise, context); } @@ -139,7 +133,7 @@ public class HttpClientTransportOverHTTP2 extends ContainerLifeCycle implements @Override public org.eclipse.jetty.io.Connection newConnection(EndPoint endPoint, Map context) throws IOException { - endPoint.setIdleTimeout(httpClient.getIdleTimeout()); + endPoint.setIdleTimeout(getHttpClient().getIdleTimeout()); ClientConnectionFactory factory = connectionFactory; HttpDestinationOverHTTP2 destination = (HttpDestinationOverHTTP2)context.get(HTTP_DESTINATION_CONTEXT_KEY); diff --git a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java index 99e65cb44de..4da12ae0527 100644 --- a/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java +++ b/tests/test-http-client-transport/src/test/java/org/eclipse/jetty/http/client/HttpClientLoadTest.java @@ -34,20 +34,14 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.eclipse.jetty.client.ConnectionPool; -import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpClientTransport; -import org.eclipse.jetty.client.HttpDestination; import org.eclipse.jetty.client.LeakTrackingConnectionPool; -import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.client.api.Request; import org.eclipse.jetty.client.api.Response; import org.eclipse.jetty.client.api.Result; import org.eclipse.jetty.client.http.HttpClientTransportOverHTTP; -import org.eclipse.jetty.client.http.HttpDestinationOverHTTP; import org.eclipse.jetty.client.util.BytesContentProvider; import org.eclipse.jetty.fcgi.client.http.HttpClientTransportOverFCGI; -import org.eclipse.jetty.fcgi.client.http.HttpDestinationOverFCGI; import org.eclipse.jetty.http.HttpHeader; import org.eclipse.jetty.http.HttpMethod; import org.eclipse.jetty.io.ArrayByteBufferPool; @@ -97,55 +91,31 @@ public class HttpClientLoadTest extends AbstractTest case HTTP: case HTTPS: { - return new HttpClientTransportOverHTTP(1) + HttpClientTransport clientTransport = new HttpClientTransportOverHTTP(1); + clientTransport.setConnectionPoolFactory(destination -> new LeakTrackingConnectionPool(destination, client.getMaxConnectionsPerDestination(), destination) { @Override - public HttpDestination newHttpDestination(Origin origin) + protected void leaked(LeakDetector.LeakInfo leakInfo) { - return new HttpDestinationOverHTTP(getHttpClient(), origin) - { - @Override - protected ConnectionPool newConnectionPool(HttpClient client) - { - return new LeakTrackingConnectionPool(this, client.getMaxConnectionsPerDestination(), this) - { - @Override - protected void leaked(LeakDetector.LeakInfo leakInfo) - { - super.leaked(leakInfo); - connectionLeaks.incrementAndGet(); - } - }; - } - }; + super.leaked(leakInfo); + connectionLeaks.incrementAndGet(); } - }; + }); + return clientTransport; } case FCGI: { - return new HttpClientTransportOverFCGI(1, false, "") + HttpClientTransport clientTransport = new HttpClientTransportOverFCGI(1, false, ""); + clientTransport.setConnectionPoolFactory(destination -> new LeakTrackingConnectionPool(destination, client.getMaxConnectionsPerDestination(), destination) { @Override - public HttpDestination newHttpDestination(Origin origin) + protected void leaked(LeakDetector.LeakInfo leakInfo) { - return new HttpDestinationOverFCGI(getHttpClient(), origin) - { - @Override - protected ConnectionPool newConnectionPool(HttpClient client) - { - return new LeakTrackingConnectionPool(this, client.getMaxConnectionsPerDestination(), this) - { - @Override - protected void leaked(LeakDetector.LeakInfo leakInfo) - { - super.leaked(leakInfo); - connectionLeaks.incrementAndGet(); - } - }; - } - }; + super.leaked(leakInfo); + connectionLeaks.incrementAndGet(); } - }; + }); + return clientTransport; } default: { From c465a9d8339fc614fdf345b27abecc9fccb196e5 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Mon, 10 Jul 2017 18:17:16 -0700 Subject: [PATCH 26/27] Renaming to fit Eclipse Jetty naming guidelines --- .../jetty-simple-base/pom.xml | 2 +- .../its/jetty_run_mojo_it/HelloServlet.java | 2 +- .../its/jetty_run_mojo_it/PingServlet.java | 2 +- .../main/resources/META-INF/web-fragment.xml | 2 +- .../jetty-simple-webapp/pom.xml | 4 +- .../jetty_run_mojo_it/TestHelloServlet.java | 2 +- .../src/it/jetty-run-forked-mojo-it/pom.xml | 4 +- .../jetty-simple-base/pom.xml | 2 +- .../its/jetty_run_mojo_it/HelloServlet.java | 2 +- .../its/jetty_run_mojo_it/PingServlet.java | 2 +- .../main/resources/META-INF/web-fragment.xml | 2 +- .../jetty-simple-webapp/pom.xml | 4 +- .../jetty_run_mojo_it/TestHelloServlet.java | 2 +- .../src/it/jetty-run-mojo-it/pom.xml | 4 +- .../jetty-simple-base/pom.xml | 2 +- .../its/jetty_run_mojo_it/HelloServlet.java | 2 +- .../its/jetty_run_mojo_it/PingServlet.java | 2 +- .../main/resources/META-INF/web-fragment.xml | 2 +- .../jetty-simple-webapp/pom.xml | 4 +- .../jetty_run_mojo_it/TestHelloServlet.java | 2 +- .../it/jetty-run-war-exploded-mojo-it/pom.xml | 4 +- .../jetty-simple-base/pom.xml | 2 +- .../its/jetty_run_mojo_it/HelloServlet.java | 2 +- .../its/jetty_run_mojo_it/PingServlet.java | 2 +- .../main/resources/META-INF/web-fragment.xml | 2 +- .../jetty-simple-webapp/pom.xml | 4 +- .../jetty_run_mojo_it/TestHelloServlet.java | 2 +- .../src/it/jetty-run-war-mojo-it/pom.xml | 4 +- .../jetty-simple-base/pom.xml | 2 +- .../its/jetty_run_mojo_it/HelloServlet.java | 45 ------------------- .../its/jetty_run_mojo_it/PingServlet.java | 41 ----------------- .../its/jetty_run_mojo_it/HelloServlet.java | 45 +++++++++++++++++++ .../its/jetty_run_mojo_it/PingServlet.java | 41 +++++++++++++++++ .../main/resources/META-INF/web-fragment.xml | 2 +- .../jetty-simple-webapp/pom.xml | 4 +- .../jetty_run_mojo_it/TestHelloServlet.java | 2 +- .../src/it/jetty-start-mojo-it/pom.xml | 4 +- 37 files changed, 129 insertions(+), 129 deletions(-) rename jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/{com/webtide => org/eclipse}/jetty/its/jetty_run_mojo_it/HelloServlet.java (96%) rename jetty-maven-plugin/src/it/{jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide => jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse}/jetty/its/jetty_run_mojo_it/PingServlet.java (96%) rename jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/{com/webtide => org/eclipse}/jetty/its/jetty_run_mojo_it/TestHelloServlet.java (97%) rename jetty-maven-plugin/src/it/{jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide => jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse}/jetty/its/jetty_run_mojo_it/HelloServlet.java (96%) rename jetty-maven-plugin/src/it/{jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide => jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse}/jetty/its/jetty_run_mojo_it/PingServlet.java (96%) rename jetty-maven-plugin/src/it/{jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide => jetty-run-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse}/jetty/its/jetty_run_mojo_it/TestHelloServlet.java (97%) rename jetty-maven-plugin/src/it/{jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide => jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse}/jetty/its/jetty_run_mojo_it/HelloServlet.java (96%) rename jetty-maven-plugin/src/it/{jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide => jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse}/jetty/its/jetty_run_mojo_it/PingServlet.java (96%) rename jetty-maven-plugin/src/it/{jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide => jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse}/jetty/its/jetty_run_mojo_it/TestHelloServlet.java (97%) rename jetty-maven-plugin/src/it/{jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide => jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse}/jetty/its/jetty_run_mojo_it/HelloServlet.java (96%) rename jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/{com/webtide => org/eclipse}/jetty/its/jetty_run_mojo_it/PingServlet.java (96%) rename jetty-maven-plugin/src/it/{jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide => jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse}/jetty/its/jetty_run_mojo_it/TestHelloServlet.java (97%) delete mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java delete mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java create mode 100644 jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java rename jetty-maven-plugin/src/it/{jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide => jetty-start-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse}/jetty/its/jetty_run_mojo_it/TestHelloServlet.java (97%) diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml index 594ddba4c8d..7cb2a2e00be 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-forked-mojo-it + org.eclipse.jetty.its.jetty-run-forked-mojo-it jetty-simple-project 0.0.1-SNAPSHOT diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java index a6d2a3e256d..b45f5d2c476 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java rename to jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java index f5686592252..c43fe013720 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml index 031012f7fed..a1ec4e27ce4 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -14,7 +14,7 @@ Ping - com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + org.eclipse.jetty.its.jetty_run_mojo_it.PingServlet extra1123 diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml index 3c6f21d22ea..fa400e45aa1 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-forked-mojo-it + org.eclipse.jetty.its.jetty-run-forked-mojo-it jetty-simple-project 0.0.1-SNAPSHOT @@ -22,7 +22,7 @@ - com.webtide.jetty.its.jetty-run-forked-mojo-it + org.eclipse.jetty.its.jetty-run-forked-mojo-it jetty-simple-base diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java similarity index 97% rename from jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index f48eee38074..31a195c1407 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -16,7 +16,7 @@ // ======================================================================== // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import org.eclipse.jetty.client.HttpClient; import org.junit.Assert; diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml index cada3739cce..fae3f39a0c6 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.webtide.jetty.its.jetty-run-forked-mojo-it + org.eclipse.jetty.its.jetty-run-forked-mojo-it jetty-simple-project 0.0.1-SNAPSHOT pom @@ -27,7 +27,7 @@ - com.webtide.jetty.its.jetty-run-forked-mojo-it + org.eclipse.jetty.its.jetty-run-forked-mojo-it jetty-simple-base ${project.version} diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml index c29b270cb61..94e3cf2b8ee 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-mojo-it + org.eclipse.jetty.its.jetty-run-mojo-it jetty-simple-project 0.0.1-SNAPSHOT diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java index a6d2a3e256d..b45f5d2c476 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java rename to jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java index f5686592252..c43fe013720 100644 --- a/jetty-maven-plugin/src/it/jetty-run-forked-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml index 031012f7fed..a1ec4e27ce4 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -14,7 +14,7 @@ Ping - com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + org.eclipse.jetty.its.jetty_run_mojo_it.PingServlet extra1123 diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml index ce4d50f13ec..7fb521911d7 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-mojo-it + org.eclipse.jetty.its.jetty-run-mojo-it jetty-simple-project 0.0.1-SNAPSHOT @@ -17,7 +17,7 @@ - com.webtide.jetty.its.jetty-run-mojo-it + org.eclipse.jetty.its.jetty-run-mojo-it jetty-simple-base diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java similarity index 97% rename from jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 4e3ced68d91..5d700a60525 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import org.eclipse.jetty.client.HttpClient; import org.junit.Assert; diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml index 3d303f4caf8..213a79af16b 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-mojo-it/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.webtide.jetty.its.jetty-run-mojo-it + org.eclipse.jetty.its.jetty-run-mojo-it jetty-simple-project 0.0.1-SNAPSHOT pom @@ -27,7 +27,7 @@ - com.webtide.jetty.its.jetty-run-mojo-it + org.eclipse.jetty.its.jetty-run-mojo-it jetty-simple-base ${project.version} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml index 4425c34f117..3ae1e093bb8 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + org.eclipse.jetty.its.jetty-run-war-exploded-mojo-it jetty-simple-project 0.0.1-SNAPSHOT diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java index a6d2a3e256d..b45f5d2c476 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java rename to jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java index f5686592252..c43fe013720 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml index 031012f7fed..a1ec4e27ce4 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -14,7 +14,7 @@ Ping - com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + org.eclipse.jetty.its.jetty_run_mojo_it.PingServlet extra1123 diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml index 0489e0e1a2c..6cab86275c0 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + org.eclipse.jetty.its.jetty-run-war-exploded-mojo-it jetty-simple-project 0.0.1-SNAPSHOT @@ -17,7 +17,7 @@ - com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + org.eclipse.jetty.its.jetty-run-war-exploded-mojo-it jetty-simple-base diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java similarity index 97% rename from jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 4e3ced68d91..5d700a60525 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import org.eclipse.jetty.client.HttpClient; import org.junit.Assert; diff --git a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml index 5b88c8fd196..a6ef2713d27 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-exploded-mojo-it/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + org.eclipse.jetty.its.jetty-run-war-exploded-mojo-it jetty-simple-project 0.0.1-SNAPSHOT pom @@ -27,7 +27,7 @@ - com.webtide.jetty.its.jetty-run-war-exploded-mojo-it + org.eclipse.jetty.its.jetty-run-war-exploded-mojo-it jetty-simple-base ${project.version} diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml index 8903e68d8a0..8f0aab6e5ad 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-war-mojo-it + org.eclipse.jetty.its.jetty-run-war-mojo-it jetty-simple-project 0.0.1-SNAPSHOT diff --git a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java index a6d2a3e256d..b45f5d2c476 100644 --- a/jetty-maven-plugin/src/it/jetty-run-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java similarity index 96% rename from jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java rename to jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java index f5686592252..c43fe013720 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml index 031012f7fed..a1ec4e27ce4 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -14,7 +14,7 @@ Ping - com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + org.eclipse.jetty.its.jetty_run_mojo_it.PingServlet extra1123 diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml index 23109b90f00..f9ba41b965d 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-run-war-mojo-it + org.eclipse.jetty.its.jetty-run-war-mojo-it jetty-simple-project 0.0.1-SNAPSHOT @@ -17,7 +17,7 @@ - com.webtide.jetty.its.jetty-run-war-mojo-it + org.eclipse.jetty.its.jetty-run-war-mojo-it jetty-simple-base diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java similarity index 97% rename from jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java rename to jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 4e3ced68d91..5d700a60525 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import org.eclipse.jetty.client.HttpClient; import org.junit.Assert; diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml index 432f0120781..a48c4d51db1 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.webtide.jetty.its.jetty-run-war-mojo-it + org.eclipse.jetty.its.jetty-run-war-mojo-it jetty-simple-project 0.0.1-SNAPSHOT pom @@ -27,7 +27,7 @@ - com.webtide.jetty.its.jetty-run-war-mojo-it + org.eclipse.jetty.its.jetty-run-war-mojo-it jetty-simple-base ${project.version} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml index 7a9a5382308..a5e1cb9cea5 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-start-mojo-it + org.eclipse.jetty.its.jetty-start-mojo-it jetty-simple-project 0.0.1-SNAPSHOT diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java deleted file mode 100644 index a6d2a3e256d..00000000000 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/HelloServlet.java +++ /dev/null @@ -1,45 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - - -package com.webtide.jetty.its.jetty_run_mojo_it; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * - */ -@WebServlet("/hello") -public class HelloServlet - extends HttpServlet -{ - - @Override - protected void doGet( HttpServletRequest req, HttpServletResponse resp ) - throws ServletException, IOException - { - String who = req.getParameter( "name" ); - - resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); - } -} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java deleted file mode 100644 index f5686592252..00000000000 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/com/webtide/jetty/its/jetty_run_mojo_it/PingServlet.java +++ /dev/null @@ -1,41 +0,0 @@ -// -// ======================================================================== -// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. -// ------------------------------------------------------------------------ -// All rights reserved. This program and the accompanying materials -// are made available under the terms of the Eclipse Public License v1.0 -// and Apache License v2.0 which accompanies this distribution. -// -// The Eclipse Public License is available at -// http://www.eclipse.org/legal/epl-v10.html -// -// The Apache License v2.0 is available at -// http://www.opensource.org/licenses/apache2.0.php -// -// You may elect to redistribute this code under either of these licenses. -// ======================================================================== -// - - -package com.webtide.jetty.its.jetty_run_mojo_it; - -import javax.servlet.ServletException; -import javax.servlet.annotation.WebServlet; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class PingServlet - extends HttpServlet -{ - - @Override - protected void doGet( HttpServletRequest req, HttpServletResponse resp ) - throws ServletException, IOException - { - String who = req.getParameter( "name" ); - - resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); - } -} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java new file mode 100644 index 00000000000..b45f5d2c476 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/HelloServlet.java @@ -0,0 +1,45 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package org.eclipse.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +/** + * + */ +@WebServlet("/hello") +public class HelloServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "hello " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java new file mode 100644 index 00000000000..c43fe013720 --- /dev/null +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/java/org/eclipse/jetty/its/jetty_run_mojo_it/PingServlet.java @@ -0,0 +1,41 @@ +// +// ======================================================================== +// Copyright (c) 1995-2017 Mort Bay Consulting Pty. Ltd. +// ------------------------------------------------------------------------ +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the Eclipse Public License v1.0 +// and Apache License v2.0 which accompanies this distribution. +// +// The Eclipse Public License is available at +// http://www.eclipse.org/legal/epl-v10.html +// +// The Apache License v2.0 is available at +// http://www.opensource.org/licenses/apache2.0.php +// +// You may elect to redistribute this code under either of these licenses. +// ======================================================================== +// + + +package org.eclipse.jetty.its.jetty_run_mojo_it; + +import javax.servlet.ServletException; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class PingServlet + extends HttpServlet +{ + + @Override + protected void doGet( HttpServletRequest req, HttpServletResponse resp ) + throws ServletException, IOException + { + String who = req.getParameter( "name" ); + + resp.getWriter().write( "pong " + (who == null ? "unknown" : who) ); + } +} diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml index 031012f7fed..a1ec4e27ce4 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-base/src/main/resources/META-INF/web-fragment.xml @@ -14,7 +14,7 @@ Ping - com.webtide.jetty.its.jetty_run_mojo_it.PingServlet + org.eclipse.jetty.its.jetty_run_mojo_it.PingServlet extra1123 diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml index 38ae1555a4b..fdb6bf16cff 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/pom.xml @@ -4,7 +4,7 @@ 4.0.0 - com.webtide.jetty.its.jetty-start-mojo-it + org.eclipse.jetty.its.jetty-start-mojo-it jetty-simple-project 0.0.1-SNAPSHOT @@ -17,7 +17,7 @@ - com.webtide.jetty.its.jetty-start-mojo-it + org.eclipse.jetty.its.jetty-start-mojo-it jetty-simple-base diff --git a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java similarity index 97% rename from jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java rename to jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java index 4e3ced68d91..5d700a60525 100644 --- a/jetty-maven-plugin/src/it/jetty-run-war-mojo-it/jetty-simple-webapp/src/test/java/com/webtide/jetty/its/jetty_run_mojo_it/TestHelloServlet.java +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/jetty-simple-webapp/src/test/java/org/eclipse/jetty/its/jetty_run_mojo_it/TestHelloServlet.java @@ -17,7 +17,7 @@ // -package com.webtide.jetty.its.jetty_run_mojo_it; +package org.eclipse.jetty.its.jetty_run_mojo_it; import org.eclipse.jetty.client.HttpClient; import org.junit.Assert; diff --git a/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml b/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml index 7319c0d604f..58add42c68c 100644 --- a/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml +++ b/jetty-maven-plugin/src/it/jetty-start-mojo-it/pom.xml @@ -3,7 +3,7 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - com.webtide.jetty.its.jetty-start-mojo-it + org.eclipse.jetty.its.jetty-start-mojo-it jetty-simple-project 0.0.1-SNAPSHOT pom @@ -27,7 +27,7 @@ - com.webtide.jetty.its.jetty-start-mojo-it + org.eclipse.jetty.its.jetty-start-mojo-it jetty-simple-base ${project.version} From 60335bf8fe2d57b20c8cc9d6e924fbf3969e3825 Mon Sep 17 00:00:00 2001 From: WalkerWatch Date: Wed, 12 Jul 2017 11:34:14 -0400 Subject: [PATCH 27/27] Documentation update for Connectors. Resolves #1663 --- .../configuring/connectors/configuring-connectors.adoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-connectors.adoc b/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-connectors.adoc index d3df02c9f34..5f9719ae1f7 100644 --- a/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-connectors.adoc +++ b/jetty-documentation/src/main/asciidoc/configuring/connectors/configuring-connectors.adoc @@ -41,6 +41,8 @@ link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty-ssl.xml[`jetty-ssl.xm On it's own, this connector is not functional and requires one or more of the following files to also be configured to add link:{JDURL}/org/eclipse/jetty/server/ConnectionFactory.html[`ConnectionFactories`] to make the connector functional. link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty-https.xml[`jetty-https.xml`]:: Adds a link:{JDURL}/org/eclipse/jetty/server/HttpConnectionFactory.html[`HttpConnectionFactory`] to the link:{JDURL}/org/eclipse/jetty/server/ServerConnector.html[`ServerConnector`] configured by `jetty-ssl.xml` which combine to provide support for HTTPS. +link:{GITBROWSEURL}/jetty-server/src/main/config/etc/jetty-http-forwarded.xml[`jetty-http-forwarded.xml`]:: + Adds a link:{JDURL}/org/eclipse/jetty/server/ForwardedRequestCustomizer.html[`ForwardedRequestCustomizer`]to the HTTP Connector to process forwarded-for style headers from a proxy. link:{GITBROWSEURL}/jetty-http2/http2-server/src/main/config/etc/jetty-http2.xml[`jetty-http2.xml`]:: Adds a link:{JDURL}/org/eclipse/jetty/http2/server/HTTP2ServerConnectionFactory.html[`Http2ServerConnectionFactory`] to the link:{JDURL}/org/eclipse/jetty/server/ServerConnector.html[`ServerConnector`] configured by `jetty-ssl.xml` to support the http2 protocol. Also prepends either `protonego-alpn.xml` or `protonego-npn.xml` so that the next protocol can be negotiated, which allows the same SSL port to handle multiple protocols. link:{GITBROWSEURL}/jetty-alpn/jetty-alpn-server/src/main/config/etc/jetty-alpn.xml[`jetty-alpn.xml`]:: @@ -49,6 +51,12 @@ link:{GITBROWSEURL}/jetty-alpn/jetty-alpn-server/src/main/config/etc/jetty-alpn. Typically connectors require very little configuration aside from setting the listening port (see link:#jetty-connectors-network-settings[Network Settings]), and enabling `X-Forwarded-For` customization when applicable. (see link:#jetty-connectors-http-configuration[HTTP Configuration]). Additional settings are for expert configuration only. +____ +[NOTE] +All the connectors discussed in this chapter can be enabled in the Jetty Distribution by enabling them via the module system. +Please refer to our chapter on link:#startup-modules[Managing Startup Modules] for more information. +____ + ==== Constructing a ServerConnector The services a link:{JDURL}/org/eclipse/jetty/server/ServerConnector.html[`ServerConnector`] instance uses are set by constructor injection and once instantiated cannot be changed.