Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions appserver/featuresets/web/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2021, 2025 Contributors to Eclipse Foundation.
Copyright (c) 2021, 2025, 2026 Contributors to Eclipse Foundation.
Copyright (c) 2015, 2025 Oracle and/or its affiliates. All rights reserved.

This program and the accompanying materials are made available under the
Expand Down Expand Up @@ -218,7 +218,9 @@
</exclusions>
</dependency>

<!-- See https://github.com/jakartaee/cdi-tck/issues/474
<!-- Allows using @Inject instead of @Context for injection of REST artifacts.
Was disabled because of https://github.com/jakartaee/cdi-tck/issues/474,
which was resolved by https://github.com/jakartaee/cdi-tck/pull/475 -->
<dependency>
<groupId>org.glassfish.jersey.ext.cdi</groupId>
<artifactId>jersey-cdi-rs-inject</artifactId>
Expand All @@ -229,7 +231,6 @@
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
Expand Down
50 changes: 49 additions & 1 deletion appserver/tests/tck/rest/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2021, 2024 Contributors to the Eclipse Foundation. All rights reserved.
Copyright (c) 2021, 2024, 2026 Contributors to the Eclipse Foundation. All rights reserved.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -74,6 +74,54 @@ mvn clean install -Dgroups=security
<glassfish.home>${glassfish.root}/glassfish8</glassfish.home>
</properties>

<!-- The Jakarta REST TCK 4.0.0 is built for JUnit 5. Pin all JUnit artifacts to JUnit 5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really needed, @dmatej ? Do we use this runner nowadays?

versions here, because the GlassFish parent manages JUnit 6, which fails at test
discovery when mixed with the jupiter-api 5.x required by the TCK. -->
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-engine</artifactId>
<version>1.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.10.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-suite-api</artifactId>
<version>1.10.2</version>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<dependency>
<groupId>jakarta.ws.rs</groupId>
Expand Down
6 changes: 4 additions & 2 deletions appserver/tests/tck/rest_cdi/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Copyright (c) 2023, 2024 Contributors to the Eclipse Foundation.
Copyright (c) 2023, 2024, 2026 Contributors to the Eclipse Foundation.

This program and the accompanying materials are made available under the
terms of the Eclipse Public License v. 2.0, which is available at
Expand Down Expand Up @@ -77,10 +77,12 @@
<artifactId>jakarta.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Makes @Inject work in ExampleResources -->
<!-- Makes @Inject work in ExampleResources.
Provided scope: the module is bundled in GlassFish, the war must use the server one. -->
<dependency>
<groupId>org.glassfish.jersey.ext.cdi</groupId>
<artifactId>jersey-cdi-rs-inject</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
Expand Down
77 changes: 77 additions & 0 deletions docs/application-development-guide/src/main/asciidoc/webapps.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
//

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't add copyright headers to adoc files, please remove this header.

// Copyright (c) 2026 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0, which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the
// Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
// version 2 with the GNU Classpath Exception, which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
//

type=page
status=published
title=Developing Web Applications
Expand Down Expand Up @@ -1362,6 +1378,67 @@ https://docs.cometd.org/current/reference/#_bayeux[Bayeux Protocol]
For more information about the Dojo toolkit, see
`http://dojotoolkit.org/`.

[[using-jakarta-rest]]

=== Using Jakarta REST

{productName} implements https://jakarta.ee/specifications/restful-ws/[Jakarta REST]
with https://eclipse-ee4j.github.io/jersey/[Eclipse Jersey].

[[injecting-jakarta-rest-artifacts-with-cdi]]

==== Injecting Jakarta REST Artifacts with CDI

The Jakarta REST specification requires injection of REST artifacts such as
`UriInfo`, `Sse`, `SecurityContext`, `HttpHeaders`, `Request` or `Providers`
via the `@Context` annotation. The `@Context` annotation is deprecated since
Jakarta REST 3.1 in favor of a future alignment with CDI.

As an extension to the specification, {productName} bundles the Jersey module
`jersey-cdi-rs-inject`, which already allows injecting these artifacts with the
standard CDI `@Inject` annotation:

[source,java]
----
import jakarta.inject.Inject;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.core.UriInfo;
import jakarta.ws.rs.sse.Sse;

@Path("example")
public class ExampleResource {

@Inject
private UriInfo uriInfo;

@Inject
private Sse sse;

// ...
}
----

Unlike `@Context`, which for resources managed by CDI or Enterprise Beans is
only supported on fields and bean properties, `@Inject` also works for
constructor injection, following the usual CDI rules:

[source,java]
----
@Path("example")
@ApplicationScoped
public class ExampleResource {

private final Sse sse;

@Inject
public ExampleResource(Sse sse) {
this.sse = sse;
}

// ...
}
----

[[advanced-web-application-features]]

=== Advanced Web Application Features
Expand Down
17 changes: 17 additions & 0 deletions docs/release-notes/src/main/asciidoc/release-notes.adoc
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
//

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't add copyright headers to adoc files, please remove this header.

// Copyright (c) 2026 Contributors to the Eclipse Foundation
//
// This program and the accompanying materials are made available under the
// terms of the Eclipse Public License v. 2.0, which is available at
// http://www.eclipse.org/legal/epl-2.0.
//
// This Source Code may also be made available under the following Secondary
// Licenses when the conditions for such availability set forth in the
// Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
// version 2 with the GNU Classpath Exception, which is available at
// https://www.gnu.org/software/classpath/license.html.
//
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
//

type=page
status=published
title={productName} {product-majorVersion} Release Notes
Expand Down Expand Up @@ -67,6 +83,7 @@ Key new features in {productName} {product-majorVersion} include:
* xref:embedded-server-guide.adoc#running-from-command-line[Runnable Embedded GlassFish JAR] (since {productName} 7.0.18)
* xref:administration-guide.adoc#log-executed-admin-commands[Admin Command Logger] (since {productName} 7.0.16)
* https://github.com/eclipse-ee4j/glassfish/discussions/25343[SSH nodes on Windows] via the native Windows SSH service (since {productName} 7.0.23)
* xref:application-development-guide.adoc#injecting-jakarta-rest-artifacts-with-cdi[CDI injection of Jakarta REST artifacts] using `@Inject` via the bundled Jersey `jersey-cdi-rs-inject` extension (since {productName} {product-majorVersion}.0.4)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 8.0.4 should never change, while {product-majorVersion} will change when Glassfish 9 is released.

Suggested change
* xref:application-development-guide.adoc#injecting-jakarta-rest-artifacts-with-cdi[CDI injection of Jakarta REST artifacts] using `@Inject` via the bundled Jersey `jersey-cdi-rs-inject` extension (since {productName} {product-majorVersion}.0.4)
* xref:application-development-guide.adoc#injecting-jakarta-rest-artifacts-with-cdi[CDI injection of Jakarta REST artifacts] using `@Inject` via the bundled Jersey `jersey-cdi-rs-inject` extension (since {productName} 8.0.4)


For a complete list of the Jakarta EE technologies included in {productName} {product-currentVersion},
see xref:#jakarta-ee-support[Jakarta EE Standards Support].
Expand Down
Loading