From 8f213796ed1c5f126ddcfe6a269061a3a27b6425 Mon Sep 17 00:00:00 2001 From: Manfred Riem Date: Sat, 30 Nov 2024 10:34:48 -0600 Subject: [PATCH] Fixes #4303 - Move Piranha Core Profile to use Grizzly for HTTP engine (#4304) --- dist/coreprofile/pom.xml | 6 ++++++ .../dist/coreprofile/CoreProfilePiranhaMain.java | 15 +++++++++++++-- dist/coreprofile/src/main/java/module-info.java | 1 + .../distribution}/DependencyInjectionBean.java | 2 +- .../distribution}/IntegrationApplication.java | 2 +- .../distribution}/InterceptInterceptor.java | 2 +- .../distribution/InterceptedBean.java} | 6 +++--- .../test/coreprofile/distribution}/Jsonb.java | 2 +- .../test/coreprofile/distribution/RestBean.java} | 8 ++++---- .../coreprofile/distribution}/IntegrationIT.java | 6 +++--- 10 files changed, 34 insertions(+), 16 deletions(-) rename test/coreprofile/integration/src/main/java/{integration => cloud/piranha/test/coreprofile/distribution}/DependencyInjectionBean.java (97%) rename test/coreprofile/integration/src/main/java/{integration => cloud/piranha/test/coreprofile/distribution}/IntegrationApplication.java (97%) rename test/coreprofile/integration/src/main/java/{integration => cloud/piranha/test/coreprofile/distribution}/InterceptInterceptor.java (97%) rename test/coreprofile/integration/src/main/java/{integration/InterceptBean.java => cloud/piranha/test/coreprofile/distribution/InterceptedBean.java} (94%) rename test/coreprofile/integration/src/main/java/{integration => cloud/piranha/test/coreprofile/distribution}/Jsonb.java (97%) rename test/coreprofile/integration/src/main/java/{integration/IntegrationBean.java => cloud/piranha/test/coreprofile/distribution/RestBean.java} (95%) rename test/coreprofile/integration/src/test/java/{integration => cloud/piranha/test/coreprofile/distribution}/IntegrationIT.java (97%) diff --git a/dist/coreprofile/pom.xml b/dist/coreprofile/pom.xml index cb0c8076f4..12c54219fe 100644 --- a/dist/coreprofile/pom.xml +++ b/dist/coreprofile/pom.xml @@ -28,6 +28,12 @@ ${project.version} compile + + cloud.piranha.http + piranha-http-grizzly + ${project.version} + compile + diff --git a/dist/coreprofile/src/main/java/cloud/piranha/dist/coreprofile/CoreProfilePiranhaMain.java b/dist/coreprofile/src/main/java/cloud/piranha/dist/coreprofile/CoreProfilePiranhaMain.java index b7f72c06db..3e3fbd8b81 100644 --- a/dist/coreprofile/src/main/java/cloud/piranha/dist/coreprofile/CoreProfilePiranhaMain.java +++ b/dist/coreprofile/src/main/java/cloud/piranha/dist/coreprofile/CoreProfilePiranhaMain.java @@ -28,6 +28,7 @@ package cloud.piranha.dist.coreprofile; import cloud.piranha.extension.coreprofile.CoreProfileExtension; +import cloud.piranha.http.grizzly.GrizzlyHttpServer; import cloud.piranha.single.SingleMain; import cloud.piranha.single.SinglePiranhaBuilder; @@ -35,9 +36,13 @@ * The Main for Piranha Core Profile. * *

- * This version of Main sets the extension class to the CoreProfileExtension to - * deliver Piranha Core Profile (unless it was overridden). + * This version of Main changes the following: *

+ *
    + *
  1. extensionClass - set to CoreProfileExtension (unless it was overridden)
  2. + *
  3. httpServerClass - set to GrizzlyHttpServer (unless it was overridden)
  4. + *
  5. httpsServerClass - set to GrizzlyHttpServer (unless it was overridden)
  6. + *
* * @author Manfred Riem (mriem@manorrock.com) */ @@ -54,6 +59,12 @@ public static void main(String[] arguments) { if (builder.getConfiguration().getClass("extensionClass") == null) { builder.extensionClass(CoreProfileExtension.class); } + if (builder.getConfiguration().getClass("httpServerClass") == null) { + builder.httpServerClass(GrizzlyHttpServer.class.getName()); + } + if (builder.getConfiguration().getClass("httpsServerClass") == null) { + builder.httpsServerClass(GrizzlyHttpServer.class.getName()); + } builder.build().start(); } else { showHelp(); diff --git a/dist/coreprofile/src/main/java/module-info.java b/dist/coreprofile/src/main/java/module-info.java index 8b39412662..e5f1efd8d1 100644 --- a/dist/coreprofile/src/main/java/module-info.java +++ b/dist/coreprofile/src/main/java/module-info.java @@ -36,5 +36,6 @@ exports cloud.piranha.dist.coreprofile; opens cloud.piranha.dist.coreprofile; requires cloud.piranha.extension.coreprofile; + requires cloud.piranha.http.grizzly; requires cloud.piranha.single; } diff --git a/test/coreprofile/integration/src/main/java/integration/DependencyInjectionBean.java b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/DependencyInjectionBean.java similarity index 97% rename from test/coreprofile/integration/src/main/java/integration/DependencyInjectionBean.java rename to test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/DependencyInjectionBean.java index 2d0d295ac6..f5e211b52a 100644 --- a/test/coreprofile/integration/src/main/java/integration/DependencyInjectionBean.java +++ b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/DependencyInjectionBean.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; import jakarta.enterprise.context.ApplicationScoped; diff --git a/test/coreprofile/integration/src/main/java/integration/IntegrationApplication.java b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/IntegrationApplication.java similarity index 97% rename from test/coreprofile/integration/src/main/java/integration/IntegrationApplication.java rename to test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/IntegrationApplication.java index 794ba541d4..3f30f0ac37 100644 --- a/test/coreprofile/integration/src/main/java/integration/IntegrationApplication.java +++ b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/IntegrationApplication.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; import jakarta.ws.rs.ApplicationPath; import jakarta.ws.rs.core.Application; diff --git a/test/coreprofile/integration/src/main/java/integration/InterceptInterceptor.java b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/InterceptInterceptor.java similarity index 97% rename from test/coreprofile/integration/src/main/java/integration/InterceptInterceptor.java rename to test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/InterceptInterceptor.java index c65a3fe3e2..c87a065536 100644 --- a/test/coreprofile/integration/src/main/java/integration/InterceptInterceptor.java +++ b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/InterceptInterceptor.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; import jakarta.interceptor.AroundInvoke; import jakarta.interceptor.Interceptor; diff --git a/test/coreprofile/integration/src/main/java/integration/InterceptBean.java b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/InterceptedBean.java similarity index 94% rename from test/coreprofile/integration/src/main/java/integration/InterceptBean.java rename to test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/InterceptedBean.java index 2f7a3d6425..647ce424df 100644 --- a/test/coreprofile/integration/src/main/java/integration/InterceptBean.java +++ b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/InterceptedBean.java @@ -25,19 +25,19 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; import jakarta.enterprise.context.ApplicationScoped; import jakarta.interceptor.Interceptors; /** - * The Intercept bean. + * The Intercepted bean. * * @author Manfred Riem (mriem@manorrock.com) */ @ApplicationScoped @Interceptors(InterceptInterceptor.class) -public class InterceptBean { +public class InterceptedBean { /** * Get the string to validate the interceptor works. diff --git a/test/coreprofile/integration/src/main/java/integration/Jsonb.java b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/Jsonb.java similarity index 97% rename from test/coreprofile/integration/src/main/java/integration/Jsonb.java rename to test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/Jsonb.java index 8aca68e9fb..94ad79e930 100644 --- a/test/coreprofile/integration/src/main/java/integration/Jsonb.java +++ b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/Jsonb.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; /** * The JSON Binding POJO. diff --git a/test/coreprofile/integration/src/main/java/integration/IntegrationBean.java b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/RestBean.java similarity index 95% rename from test/coreprofile/integration/src/main/java/integration/IntegrationBean.java rename to test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/RestBean.java index d574059394..8ed5713039 100644 --- a/test/coreprofile/integration/src/main/java/integration/IntegrationBean.java +++ b/test/coreprofile/integration/src/main/java/cloud/piranha/test/coreprofile/distribution/RestBean.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; import jakarta.enterprise.context.RequestScoped; import jakarta.inject.Inject; @@ -45,7 +45,7 @@ */ @Path("") @RequestScoped -public class IntegrationBean { +public class RestBean { /** * Stores the DependencyInjectionBean. @@ -57,7 +57,7 @@ public class IntegrationBean { * Stores the intercept bean. */ @Inject - private InterceptBean interceptBean; + private InterceptedBean interceptedBean; /** * Validate the correct string is returned using the bean injected using the @@ -79,7 +79,7 @@ public String dependencyInjection() { @GET @Path("/intercept") public String intercept() { - return interceptBean.intercept(); + return interceptedBean.intercept(); } /** diff --git a/test/coreprofile/integration/src/test/java/integration/IntegrationIT.java b/test/coreprofile/integration/src/test/java/cloud/piranha/test/coreprofile/distribution/IntegrationIT.java similarity index 97% rename from test/coreprofile/integration/src/test/java/integration/IntegrationIT.java rename to test/coreprofile/integration/src/test/java/cloud/piranha/test/coreprofile/distribution/IntegrationIT.java index 09bdc7fa8e..0580b01e5e 100644 --- a/test/coreprofile/integration/src/test/java/integration/IntegrationIT.java +++ b/test/coreprofile/integration/src/test/java/cloud/piranha/test/coreprofile/distribution/IntegrationIT.java @@ -25,7 +25,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -package integration; +package cloud.piranha.test.coreprofile.distribution; import java.io.File; import java.net.URI; @@ -68,8 +68,8 @@ public static WebArchive createDeployment() { return create(WebArchive.class) .addClass(DependencyInjectionBean.class) .addClass(IntegrationApplication.class) - .addClass(IntegrationBean.class) - .addClass(InterceptBean.class) + .addClass(RestBean.class) + .addClass(InterceptedBean.class) .addClass(InterceptInterceptor.class) .addClass(Jsonb.class) .addAsWebInfResource(new File("src/main/webapp/WEB-INF/beans.xml"));