From 478c1e1f9dec1c41160bb2da00d38cae459084ad Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Wed, 7 Jun 2023 09:34:44 +0200 Subject: [PATCH 1/3] Reenginering to prepare view webapp --- .gitignore | 1 + README.md | 6 +-- {webapp => api-webapp}/pom.xml | 2 +- .../src/main/config/jetty/jetty-env.xml | 0 .../src/main/config/jetty/jetty-http.xml | 0 .../src/main/config/jetty/jetty-https.xml | 0 .../main/config/jetty/jetty-ssl-context.xml | 0 .../src/main/config/jetty/jetty-ssl.xml | 0 .../src/main/config/webapp.properties | 0 .../org/jeudego/pairgoth/api/ApiHandler.kt | 0 .../pairgoth/api/PairgothApiHandler.kt | 0 .../jeudego/pairgoth/api/PairingHandler.kt | 0 .../org/jeudego/pairgoth/api/PlayerHandler.kt | 0 .../jeudego/pairgoth/api/ResultsHandler.kt | 0 .../jeudego/pairgoth/api/StandingsHandler.kt | 0 .../org/jeudego/pairgoth/api/TeamHandler.kt | 0 .../jeudego/pairgoth/api/TournamentHandler.kt | 0 .../org/jeudego/pairgoth/ext/OpenGotha.kt | 0 .../kotlin/org/jeudego/pairgoth/model/Defs.kt | 0 .../kotlin/org/jeudego/pairgoth/model/Game.kt | 0 .../org/jeudego/pairgoth/model/Pairable.kt | 0 .../org/jeudego/pairgoth/model/Pairing.kt | 0 .../org/jeudego/pairgoth/model/Rules.kt | 0 .../org/jeudego/pairgoth/model/TimeSystem.kt | 0 .../org/jeudego/pairgoth/model/Tournament.kt | 0 .../jeudego/pairgoth/oauth/FacebookHelper.kt | 0 .../jeudego/pairgoth/oauth/GoogleHelper.kt | 0 .../jeudego/pairgoth/oauth/InstagramHelper.kt | 0 .../org/jeudego/pairgoth/oauth/OAuthHelper.kt | 0 .../pairgoth/oauth/OauthHelperFactory.kt | 0 .../jeudego/pairgoth/oauth/TwitterHelper.kt | 0 .../jeudego/pairgoth/pairing/HistoryHelper.kt | 0 .../pairgoth/pairing/MacMahonSolver.kt | 0 .../org/jeudego/pairgoth/pairing/Solver.kt | 0 .../jeudego/pairgoth/pairing/SwissSolver.kt | 0 .../org/jeudego/pairgoth/store/FileStore.kt | 0 .../org/jeudego/pairgoth/store/MemoryStore.kt | 0 .../org/jeudego/pairgoth/store/Store.kt | 0 .../pairgoth/store/StoreImplementation.kt | 0 .../org/jeudego/pairgoth/util/Colorizer.kt | 0 .../org/jeudego/pairgoth/util/JsonIO.kt | 0 .../org/jeudego/pairgoth/util/XmlFormat.kt | 0 .../org/jeudego/pairgoth/util/XmlUtils.kt | 0 .../org/jeudego/pairgoth/web/ApiException.kt | 0 .../org/jeudego/pairgoth/web/ApiServlet.kt | 0 .../kotlin/org/jeudego/pairgoth/web/Event.kt | 0 .../org/jeudego/pairgoth/web/Logging.kt | 0 .../org/jeudego/pairgoth/web/SSEServlet.kt | 0 .../org/jeudego/pairgoth/web/WebappManager.kt | 0 .../src/main/webapp/WEB-INF/jetty-web.xml | 0 .../WEB-INF/pairgoth.default.properties | 0 .../src/main/webapp/WEB-INF/web.xml | 2 +- .../src/test/kotlin/.gitkeep | 0 .../src/test/kotlin/BasicTests.kt | 0 .../src/test/kotlin/ImportExportTests.kt | 0 .../src/test/kotlin/TestBase.kt | 0 .../src/test/kotlin/TestUtils.kt | 0 .../test/resources/opengotha/frioul-2018.xml | 0 .../resources/opengotha/veterans-2021.xml | 0 application/pom.xml | 2 +- application/src/assembly/livewar.xml | 2 +- .../pairgoth/container/ServerMain.java | 52 +++++++++++++------ curl.sh | 2 +- pom.xml | 3 +- 64 files changed, 48 insertions(+), 24 deletions(-) rename {webapp => api-webapp}/pom.xml (99%) rename {webapp => api-webapp}/src/main/config/jetty/jetty-env.xml (100%) rename {webapp => api-webapp}/src/main/config/jetty/jetty-http.xml (100%) rename {webapp => api-webapp}/src/main/config/jetty/jetty-https.xml (100%) rename {webapp => api-webapp}/src/main/config/jetty/jetty-ssl-context.xml (100%) rename {webapp => api-webapp}/src/main/config/jetty/jetty-ssl.xml (100%) rename {webapp => api-webapp}/src/main/config/webapp.properties (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/ApiHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/PairgothApiHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/PlayerHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/ResultsHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/TeamHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/api/TournamentHandler.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/Defs.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/Rules.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/oauth/FacebookHelper.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/oauth/GoogleHelper.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/oauth/InstagramHelper.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/oauth/OAuthHelper.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/oauth/OauthHelperFactory.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/oauth/TwitterHelper.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/pairing/HistoryHelper.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/pairing/MacMahonSolver.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/pairing/SwissSolver.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/store/MemoryStore.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/store/Store.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/store/StoreImplementation.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/util/Colorizer.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/util/JsonIO.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/util/XmlFormat.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/util/XmlUtils.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/web/ApiException.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/web/Event.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/web/Logging.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/web/SSEServlet.kt (100%) rename {webapp => api-webapp}/src/main/kotlin/org/jeudego/pairgoth/web/WebappManager.kt (100%) rename {webapp => api-webapp}/src/main/webapp/WEB-INF/jetty-web.xml (100%) rename {webapp => api-webapp}/src/main/webapp/WEB-INF/pairgoth.default.properties (100%) rename {webapp => api-webapp}/src/main/webapp/WEB-INF/web.xml (98%) rename {webapp => api-webapp}/src/test/kotlin/.gitkeep (100%) rename {webapp => api-webapp}/src/test/kotlin/BasicTests.kt (100%) rename {webapp => api-webapp}/src/test/kotlin/ImportExportTests.kt (100%) rename {webapp => api-webapp}/src/test/kotlin/TestBase.kt (100%) rename {webapp => api-webapp}/src/test/kotlin/TestUtils.kt (100%) rename {webapp => api-webapp}/src/test/resources/opengotha/frioul-2018.xml (100%) rename {webapp => api-webapp}/src/test/resources/opengotha/veterans-2021.xml (100%) diff --git a/.gitignore b/.gitignore index 7815b8a..990d7fa 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ target /pairgoth.properties *.err /tournamentfiles +*.iml \ No newline at end of file diff --git a/README.md b/README.md index 788607c..10d50d5 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ ├── docker .................................... Docker packaging │   ├── pairgoth.properties.example ........... Docker property file to instanciate │   └── run.sh ................................ Docker launch script -└── webapp .................................... Engine web application +└── api-webapp ................................ Engine web application └── src ├── main │   ├── kotlin ........................ Engine kotlin sources (the real meat is here!) @@ -26,10 +26,10 @@ └── kotlin ........................ Engine webapp API unit tests ``` -## Webapp sources structure +## API Webapp sources structure ``` -webapp/src/main/kotlin/org/jeudego/pairgoth +api-webapp/src/main/kotlin/org/jeudego/pairgoth ├── api .................................... API handlers ├── ext .................................... External: import/export features ├── model .................................. Domain logic model diff --git a/webapp/pom.xml b/api-webapp/pom.xml similarity index 99% rename from webapp/pom.xml rename to api-webapp/pom.xml index 0270a8c..726ce6b 100644 --- a/webapp/pom.xml +++ b/api-webapp/pom.xml @@ -9,7 +9,7 @@ engine-parent 1.0-SNAPSHOT - webapp + api-webapp war ${project.groupId}:${project.artifactId} diff --git a/webapp/src/main/config/jetty/jetty-env.xml b/api-webapp/src/main/config/jetty/jetty-env.xml similarity index 100% rename from webapp/src/main/config/jetty/jetty-env.xml rename to api-webapp/src/main/config/jetty/jetty-env.xml diff --git a/webapp/src/main/config/jetty/jetty-http.xml b/api-webapp/src/main/config/jetty/jetty-http.xml similarity index 100% rename from webapp/src/main/config/jetty/jetty-http.xml rename to api-webapp/src/main/config/jetty/jetty-http.xml diff --git a/webapp/src/main/config/jetty/jetty-https.xml b/api-webapp/src/main/config/jetty/jetty-https.xml similarity index 100% rename from webapp/src/main/config/jetty/jetty-https.xml rename to api-webapp/src/main/config/jetty/jetty-https.xml diff --git a/webapp/src/main/config/jetty/jetty-ssl-context.xml b/api-webapp/src/main/config/jetty/jetty-ssl-context.xml similarity index 100% rename from webapp/src/main/config/jetty/jetty-ssl-context.xml rename to api-webapp/src/main/config/jetty/jetty-ssl-context.xml diff --git a/webapp/src/main/config/jetty/jetty-ssl.xml b/api-webapp/src/main/config/jetty/jetty-ssl.xml similarity index 100% rename from webapp/src/main/config/jetty/jetty-ssl.xml rename to api-webapp/src/main/config/jetty/jetty-ssl.xml diff --git a/webapp/src/main/config/webapp.properties b/api-webapp/src/main/config/webapp.properties similarity index 100% rename from webapp/src/main/config/webapp.properties rename to api-webapp/src/main/config/webapp.properties diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/ApiHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/ApiHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/ApiHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/ApiHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairgothApiHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairgothApiHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairgothApiHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairgothApiHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PairingHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/PlayerHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PlayerHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/PlayerHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/PlayerHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/ResultsHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/ResultsHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/ResultsHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/ResultsHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/StandingsHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/TeamHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/TeamHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/TeamHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/TeamHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/api/TournamentHandler.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/TournamentHandler.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/api/TournamentHandler.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/api/TournamentHandler.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/ext/OpenGotha.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/Defs.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Defs.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/Defs.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Defs.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Game.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairable.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Pairing.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/Rules.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Rules.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/Rules.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Rules.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/TimeSystem.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/model/Tournament.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/FacebookHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/FacebookHelper.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/FacebookHelper.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/FacebookHelper.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/GoogleHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/GoogleHelper.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/GoogleHelper.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/GoogleHelper.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/InstagramHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/InstagramHelper.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/InstagramHelper.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/InstagramHelper.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OAuthHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OAuthHelper.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OAuthHelper.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OAuthHelper.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OauthHelperFactory.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OauthHelperFactory.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OauthHelperFactory.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/OauthHelperFactory.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/TwitterHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/TwitterHelper.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/TwitterHelper.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/oauth/TwitterHelper.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/HistoryHelper.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/HistoryHelper.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/HistoryHelper.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/HistoryHelper.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/MacMahonSolver.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/MacMahonSolver.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/MacMahonSolver.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/MacMahonSolver.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/Solver.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/SwissSolver.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/SwissSolver.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/SwissSolver.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/pairing/SwissSolver.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/FileStore.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/store/MemoryStore.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/MemoryStore.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/store/MemoryStore.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/MemoryStore.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/store/Store.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/Store.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/store/Store.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/Store.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/store/StoreImplementation.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/StoreImplementation.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/store/StoreImplementation.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/store/StoreImplementation.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/util/Colorizer.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/Colorizer.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/util/Colorizer.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/Colorizer.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/util/JsonIO.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/JsonIO.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/util/JsonIO.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/JsonIO.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlFormat.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlFormat.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlFormat.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlFormat.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlUtils.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlUtils.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlUtils.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/util/XmlUtils.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiException.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiException.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiException.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiException.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/ApiServlet.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/web/Event.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/Event.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/web/Event.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/Event.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/web/Logging.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/Logging.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/web/Logging.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/Logging.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/web/SSEServlet.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/SSEServlet.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/web/SSEServlet.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/SSEServlet.kt diff --git a/webapp/src/main/kotlin/org/jeudego/pairgoth/web/WebappManager.kt b/api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/WebappManager.kt similarity index 100% rename from webapp/src/main/kotlin/org/jeudego/pairgoth/web/WebappManager.kt rename to api-webapp/src/main/kotlin/org/jeudego/pairgoth/web/WebappManager.kt diff --git a/webapp/src/main/webapp/WEB-INF/jetty-web.xml b/api-webapp/src/main/webapp/WEB-INF/jetty-web.xml similarity index 100% rename from webapp/src/main/webapp/WEB-INF/jetty-web.xml rename to api-webapp/src/main/webapp/WEB-INF/jetty-web.xml diff --git a/webapp/src/main/webapp/WEB-INF/pairgoth.default.properties b/api-webapp/src/main/webapp/WEB-INF/pairgoth.default.properties similarity index 100% rename from webapp/src/main/webapp/WEB-INF/pairgoth.default.properties rename to api-webapp/src/main/webapp/WEB-INF/pairgoth.default.properties diff --git a/webapp/src/main/webapp/WEB-INF/web.xml b/api-webapp/src/main/webapp/WEB-INF/web.xml similarity index 98% rename from webapp/src/main/webapp/WEB-INF/web.xml rename to api-webapp/src/main/webapp/WEB-INF/web.xml index 4d50f1b..719647e 100644 --- a/webapp/src/main/webapp/WEB-INF/web.xml +++ b/api-webapp/src/main/webapp/WEB-INF/web.xml @@ -41,7 +41,7 @@ api - /api/* + /* sse diff --git a/webapp/src/test/kotlin/.gitkeep b/api-webapp/src/test/kotlin/.gitkeep similarity index 100% rename from webapp/src/test/kotlin/.gitkeep rename to api-webapp/src/test/kotlin/.gitkeep diff --git a/webapp/src/test/kotlin/BasicTests.kt b/api-webapp/src/test/kotlin/BasicTests.kt similarity index 100% rename from webapp/src/test/kotlin/BasicTests.kt rename to api-webapp/src/test/kotlin/BasicTests.kt diff --git a/webapp/src/test/kotlin/ImportExportTests.kt b/api-webapp/src/test/kotlin/ImportExportTests.kt similarity index 100% rename from webapp/src/test/kotlin/ImportExportTests.kt rename to api-webapp/src/test/kotlin/ImportExportTests.kt diff --git a/webapp/src/test/kotlin/TestBase.kt b/api-webapp/src/test/kotlin/TestBase.kt similarity index 100% rename from webapp/src/test/kotlin/TestBase.kt rename to api-webapp/src/test/kotlin/TestBase.kt diff --git a/webapp/src/test/kotlin/TestUtils.kt b/api-webapp/src/test/kotlin/TestUtils.kt similarity index 100% rename from webapp/src/test/kotlin/TestUtils.kt rename to api-webapp/src/test/kotlin/TestUtils.kt diff --git a/webapp/src/test/resources/opengotha/frioul-2018.xml b/api-webapp/src/test/resources/opengotha/frioul-2018.xml similarity index 100% rename from webapp/src/test/resources/opengotha/frioul-2018.xml rename to api-webapp/src/test/resources/opengotha/frioul-2018.xml diff --git a/webapp/src/test/resources/opengotha/veterans-2021.xml b/api-webapp/src/test/resources/opengotha/veterans-2021.xml similarity index 100% rename from webapp/src/test/resources/opengotha/veterans-2021.xml rename to api-webapp/src/test/resources/opengotha/veterans-2021.xml diff --git a/application/pom.xml b/application/pom.xml index 1a126b2..faf561e 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -15,7 +15,7 @@ ${project.groupId} - webapp + api-webapp ${project.version} war diff --git a/application/src/assembly/livewar.xml b/application/src/assembly/livewar.xml index 58f0085..e547269 100644 --- a/application/src/assembly/livewar.xml +++ b/application/src/assembly/livewar.xml @@ -20,7 +20,7 @@ true false - ${project.groupId}:webapp + ${project.groupId}:api-webapp ${project.groupId}:bootstrap diff --git a/container/src/main/java/org/jeudego/pairgoth/container/ServerMain.java b/container/src/main/java/org/jeudego/pairgoth/container/ServerMain.java index 76b47e4..e9d1f65 100644 --- a/container/src/main/java/org/jeudego/pairgoth/container/ServerMain.java +++ b/container/src/main/java/org/jeudego/pairgoth/container/ServerMain.java @@ -25,11 +25,11 @@ import java.io.IOException; import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; -import java.util.Enumeration; import java.util.Map; import java.util.Properties; import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.server.handler.ContextHandlerCollection; import org.eclipse.jetty.util.resource.PathResource; import org.eclipse.jetty.webapp.WebAppContext; @@ -41,7 +41,8 @@ public class ServerMain PROD } - private Path basePath; + private Path apiBasePath = null; + private Path viewBasePath = null; public static void main(String[] args) { @@ -59,15 +60,25 @@ public class ServerMain { // create server and web context Server server = new Server(8080); - WebAppContext context = new WebAppContext() { + + WebAppContext apiContext = new WebAppContext() { @Override public boolean isServerResource(String name, URL url) { return super.isServerResource(name, url) || url.getFile().contains("/WEB-INF/jetty-server/"); } }; - context.setContextPath("/"); + apiContext.setContextPath("/api"); + WebAppContext viewContext = new WebAppContext() { + @Override + public boolean isServerResource(String name, URL url) + { + return super.isServerResource(name, url) || url.getFile().contains("/WEB-INF/jetty-server/"); + } + }; + viewContext.setContextPath("/"); + // pairgoth runtime properties File properties = new File("./pairgoth.properties"); if (properties.exists()) { @@ -77,7 +88,7 @@ public class ServerMain String property = (String)entry.getKey(); String value = (String)entry.getValue(); if (property.startsWith("logger.")) { - context.setInitParameter("webapp-slf4j-logger." + property.substring(7), value); + apiContext.setInitParameter("webapp-slf4j-logger." + property.substring(7), value); } else { System.setProperty("pairgoth." + property, value); } @@ -88,21 +99,29 @@ public class ServerMain { case PROD: // Configure as WAR - context.setWar(basePath.toString()); + apiContext.setWar(apiBasePath.toString()); + viewContext.setWar(viewBasePath.toString()); break; case DEV: // Configuring from Development Base - context.setBaseResource(new PathResource(basePath.resolve("src/main/webapp"))); + + apiContext.setBaseResource(new PathResource(apiBasePath.resolve("src/main/webapp"))); // Add webapp compiled classes & resources (copied into place from src/main/resources) - Path classesPath = basePath.resolve("target/webapp/WEB-INF/classes"); - context.setExtraClasspath(classesPath.toAbsolutePath().toString()); + Path apiClassesPath = apiBasePath.resolve("target/webapp/WEB-INF/classes"); + apiContext.setExtraClasspath(apiClassesPath.toAbsolutePath().toString()); + + viewContext.setBaseResource(new PathResource(viewBasePath.resolve("src/main/webapp"))); + // Add webapp compiled classes & resources (copied into place from src/main/resources) + Path viewClassesPath = viewBasePath.resolve("target/webapp/WEB-INF/classes"); + viewContext.setExtraClasspath(viewClassesPath.toAbsolutePath().toString()); + server.setDumpAfterStart(true); break; default: throw new FileNotFoundException("Unable to configure WebAppContext base resource undefined"); } - - server.setHandler(context); + + server.setHandler(new ContextHandlerCollection(apiContext, viewContext)); server.start(); server.join(); @@ -117,16 +136,19 @@ public class ServerMain Path warPath = new File(warLocation).toPath().toRealPath(); if (Files.exists(warPath) && Files.isRegularFile(warPath)) { - this.basePath = warPath; + this.apiBasePath = warPath; + this.viewBasePath = warPath; return OperationalMode.PROD; } } // We are in development mode, likely building and testing from an IDE. - Path devPath = new File("../webapp").toPath().toRealPath(); - if (Files.exists(devPath) && Files.isDirectory(devPath)) + Path apiDevPath = new File("../api-webapp").toPath().toRealPath(); + Path viewDevPath = new File("../view-webapp").toPath().toRealPath(); + if (Files.exists(apiDevPath) && Files.isDirectory(apiDevPath) && Files.exists(viewDevPath) && Files.isDirectory(viewDevPath)) { - this.basePath = devPath; + this.apiBasePath = apiDevPath; + this.viewBasePath = viewDevPath; return OperationalMode.DEV; } diff --git a/curl.sh b/curl.sh index 96ba536..02ce12c 100755 --- a/curl.sh +++ b/curl.sh @@ -21,4 +21,4 @@ curl -s --header "Accept: application/json" http://localhost:8080/api/tour/1/par echo echo -curl -s --header "Last-Event-Id: 0" http://localhost:8080/events +curl -s --header "Last-Event-Id: 0" http://localhost:8080/api/events diff --git a/pom.xml b/pom.xml index bb154af..88720b9 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,8 @@ - webapp + api-webapp + container bootstrap application From 79d7d4a8ec0ae26401190a2d98dcf93ea0ed7705 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Wed, 7 Jun 2023 10:00:17 +0200 Subject: [PATCH 2/3] Remove unused files --- .../src/main/config/jetty/jetty-env.xml | 5 -- .../src/main/config/jetty/jetty-http.xml | 26 ----------- .../src/main/config/jetty/jetty-https.xml | 24 ---------- .../main/config/jetty/jetty-ssl-context.xml | 16 ------- .../src/main/config/jetty/jetty-ssl.xml | 46 ------------------- api-webapp/src/main/config/webapp.properties | 8 ---- 6 files changed, 125 deletions(-) delete mode 100644 api-webapp/src/main/config/jetty/jetty-env.xml delete mode 100644 api-webapp/src/main/config/jetty/jetty-http.xml delete mode 100644 api-webapp/src/main/config/jetty/jetty-https.xml delete mode 100644 api-webapp/src/main/config/jetty/jetty-ssl-context.xml delete mode 100644 api-webapp/src/main/config/jetty/jetty-ssl.xml delete mode 100644 api-webapp/src/main/config/webapp.properties diff --git a/api-webapp/src/main/config/jetty/jetty-env.xml b/api-webapp/src/main/config/jetty/jetty-env.xml deleted file mode 100644 index 1f82f54..0000000 --- a/api-webapp/src/main/config/jetty/jetty-env.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/api-webapp/src/main/config/jetty/jetty-http.xml b/api-webapp/src/main/config/jetty/jetty-http.xml deleted file mode 100644 index 49c6123..0000000 --- a/api-webapp/src/main/config/jetty/jetty-http.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/api-webapp/src/main/config/jetty/jetty-https.xml b/api-webapp/src/main/config/jetty/jetty-https.xml deleted file mode 100644 index 99abd18..0000000 --- a/api-webapp/src/main/config/jetty/jetty-https.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - http/1.1 - - - - - - - - - - - - - - - diff --git a/api-webapp/src/main/config/jetty/jetty-ssl-context.xml b/api-webapp/src/main/config/jetty/jetty-ssl-context.xml deleted file mode 100644 index 121a644..0000000 --- a/api-webapp/src/main/config/jetty/jetty-ssl-context.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - true - / - - - / - - - - - - - - - diff --git a/api-webapp/src/main/config/jetty/jetty-ssl.xml b/api-webapp/src/main/config/jetty/jetty-ssl.xml deleted file mode 100644 index 1ee1118..0000000 --- a/api-webapp/src/main/config/jetty/jetty-ssl.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/api-webapp/src/main/config/webapp.properties b/api-webapp/src/main/config/webapp.properties deleted file mode 100644 index ed8aeee..0000000 --- a/api-webapp/src/main/config/webapp.properties +++ /dev/null @@ -1,8 +0,0 @@ -# webapp -webapp.env = ${webapp.env} -webapp.url = ${webapp.url} - -# smtp - -# Logging -logger.level = ${logger.level} From ea02bb3e81918887f2ad7ae8c5f3f710b853a151 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Wed, 7 Jun 2023 10:02:32 +0200 Subject: [PATCH 3/3] Properties file is not mandatory --- api-webapp/pom.xml | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/api-webapp/pom.xml b/api-webapp/pom.xml index 726ce6b..bd4cc47 100644 --- a/api-webapp/pom.xml +++ b/api-webapp/pom.xml @@ -51,25 +51,6 @@ org.apache.maven.plugins maven-enforcer-plugin - - - enforce-properties-file-exists - - enforce - - - - - Missing pairgoth.properties file - - ${project.parent.basedir}/pairgoth.properties - - - - true - - - org.apache.maven.plugins