Skip to content

Commit

Permalink
Fixes #4303 - Move Piranha Core Profile to use Grizzly for HTTP engine
Browse files Browse the repository at this point in the history
  • Loading branch information
mnriem committed Nov 30, 2024
1 parent 3a95fff commit d25d3cd
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 16 deletions.
6 changes: 6 additions & 0 deletions dist/coreprofile/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cloud.piranha.http</groupId>
<artifactId>piranha-http-grizzly</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,21 @@
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;

/**
* The Main for Piranha Core Profile.
*
* <p>
* 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:
* </p>
* <ol>
* <li>extensionClass - set to CoreProfileExtension (unless it was overridden)</li>
* <li>httpServerClass - set to GrizzlyHttpServer (unless it was overridden)</li>
* <li>httpsServerClass - set to GrizzlyHttpServer (unless it was overridden)</li>
* </ol>
*
* @author Manfred Riem ([email protected])
*/
Expand All @@ -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();
Expand Down
1 change: 1 addition & 0 deletions dist/coreprofile/src/main/java/module-info.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 ([email protected])
*/
@ApplicationScoped
@Interceptors(InterceptInterceptor.class)
public class InterceptBean {
public class InterceptedBean {

/**
* Get the string to validate the interceptor works.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -45,7 +45,7 @@
*/
@Path("")
@RequestScoped
public class IntegrationBean {
public class RestBean {

/**
* Stores the DependencyInjectionBean.
Expand All @@ -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
Expand All @@ -79,7 +79,7 @@ public String dependencyInjection() {
@GET
@Path("/intercept")
public String intercept() {
return interceptBean.intercept();
return interceptedBean.intercept();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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"));
Expand Down

0 comments on commit d25d3cd

Please sign in to comment.