Enhancements in Jakarta RESTful Web Services 4.0 and more in 24.0.0.7-beta
The 24.0.0.7-beta release introduces enhancements to Jakarta RESTful Web Services 4.0, including new API methods and media type values. It also includes enhanced HTTP request tracking and the beta release of the Audit 2.0 feature, which creates REST Handler records only when a REST Handler application is configured.
The Open Liberty 24.0.0.7-beta includes the following beta features (along with all GA features):
See also previous Open Liberty beta blog posts.
Jakarta Restful Web Services 4.0 (EE11)
Jakarta RESTful Web Services provides a foundational API to develop web services based on the REST architectural pattern. The Jakarta Restful Web Services 4.0 update introduces several enhancements to make web service development more efficient and effective.
The new features, restfulWS-4.0
and restfulWSClient-4.0
, are primarily aimed at application developers. This release brings incremental improvements to Jakarta RESTful Web Services. It provides the following new convenience API methods:
-
The
containsHeaderString()
method is added toContainerRequestContext
,ContainerResponseContext
, andHttpHeaders
to help determine whether a header contains a specified value. -
The
UriInfo.getMatchedResourceTemplate()
method is a new addition that returns a full template for a request. -
New
MediaType
values to handle specific media types are introduced, includingAPPLICATION_JSON_PATCH_JSON
andAPPLICATION_MERGE_PATCH_JSON
.
These updates streamline the process of developing RESTful services. To implement these new features, add the following code to your server.xml
file.
For the RESTful web services feature:
<featureManager>
<feature>restfulWS-4.0</feature>
</featureManager>
For the RESTful web services client feature:
<featureManager>
<feature>restfulWSClient-4.0</feature>
</featureManager>
For more information, see the Jakarta RESTful Web Services 4.0 specification and the Javadoc.
Enhanced HTTP Request Monitoring with Monitor 1.0
Open Liberty introduces a significant update that enhances the tracking of HTTP connections that are made to the server. With the Monitor-1.0 feature (monitor-1.0
) and any Jakarta EE 10 feature that uses the servlet engine, Open Liberty can now record detailed information about HTTP requests into an HttpStatsMXBean
. This includes the request method, response status, duration, HTTP route, and other attributes that align with the Open Telemetry HTTP metric semantic convention.
If the mpMetrics-5.0
or mpMetrics-5.1
feature is also active, Open Liberty creates corresponding HTTP metrics, such as http.server.request.duration
, using a Timer
type metric. To use these metrics effectively, configure histogram buckets explicitly for Timer
and Histogram
type metrics by using the MicroProfile Metrics feature. For more details, see the mp.metrics.distribution.timer.buckets
property on the MicroProfile Config Properties page.
This update ensures that operations teams responsible for monitoring can now have a detailed and comprehensive view of HTTP requests, enhancing the monitoring and management capabilities within Open Liberty environments.
Previously, Open Liberty tracked servlet and JAX-RS/RESTful resource requests to the server as separate MBeans (servlet MBeans and REST MBeans). This data might then be forwarded to the mpMetrics feature to create corresponding metrics. Monitoring tools like Prometheus and Grafana could visualize this metric data to showcase server performance and responsiveness.
With the new update, HTTP connections are now tracked more comprehensively, combining request details into a unified HttpStatsMXBean
. This approach simplifies monitoring and provides a more cohesive view of server performance, making it easier for operations teams to ensure optimal server responsiveness.
This enhancement is an auto-feature that activates with monitor-1.0
and any feature that uses the servlet engine currently supporting Jakarta EE 10 features like servlet-6.0
, pages-3.1
, and restfulWS-3.1
. It also supports registering HTTP metrics with mpMetrics-5.x
features. To enable this function, add the following to your server.xml
file:
<featureManager>
<feature>monitor-1.0</feature>
<feature>servlet-6.0</feature>
<feature>mpMetrics-5.0</feature>
</featureManager>
For detailed configuration, see the MicroProfile Config Properties page.
For more information about the HTTP semantic convention used, see the Open Telemetry HTTP semantic convention page.
Jakarta EE11 Faces 4.1
Jakarta Faces is a Model-View-Controller (MVC) framework for building web applications, offering many convenient features, such as state management and input validation. The Jakarta Faces 4.1 (faces-4.1
) update introduces a range of incremental improvements to enhance the developer experience. These enhancements include increased use of generics in FacesMessages
and other locations, as well as improved CDI integration by requiring events for @Initialized
, @BeforeDestroyed
, and @Destroyed
for built-in scopes like FlowScoped
and ViewScoped
. The current Flow
can also now be injected into a backing bean. Finally, a new UUIDConverter
is added to the API, which simplifies the handling of UUIDs.
This update also includes some deprecations and removals. The composite:extension
tag and references to the Security Manager are removed, and the full state saving mechanism is deprecated. To enable the Jakarta Faces 4.1 feature in your application, add the following to your server.xml
file:
<featureManager>
<feature>faces-4.1</feature>
</featureManager>
For more information, see the Jakarta Faces 4.1 specification and the Javadoc.
Use the Audit 2.0 feature to avoid generating unnecessary REST Handler records
The Audit 2.0 feature (audit-2.0
) is now in beta release. The feature is designed for users that are not using REST Handler applications.
It provides the same audit records as the Audit 1.0 feature (audit-1.0
) but it does not generate records for REST Handler applications.
Customers that need to keep audit records for REST Handler applications must continue to use the Audit 1.0 feature.
To enable the Audit 2.0 feature in your application, add the following to your server.xml
file:
<featureManager>
<feature>audit-2.0</feature>
</featureManager>
Try it now
To try out these features, update your build tools to pull the Open Liberty All Beta Features package instead of the main release. The beta works with Java SE 21, Java SE 17, Java SE 11, and Java SE 8.
If you’re using Maven, you can install the All Beta Features package using:
<plugin>
<groupId>io.openliberty.tools</groupId>
<artifactId>liberty-maven-plugin</artifactId>
<version>3.10.3</version>
<configuration>
<runtimeArtifact>
<groupId>io.openliberty.beta</groupId>
<artifactId>openliberty-runtime</artifactId>
<version>24.0.0.7-beta</version>
<type>zip</type>
</runtimeArtifact>
</configuration>
</plugin>
You must also add dependencies to your pom.xml file for the beta version of the APIs that are associated with the beta features that you want to try. For example, the following block adds dependencies for two example beta APIs:
<dependency>
<groupId>org.example.spec</groupId>
<artifactId>exampleApi</artifactId>
<version>7.0</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>example.platform</groupId>
<artifactId>example.example-api</artifactId>
<version>11.0.0</version>
<scope>provided</scope>
</dependency>
Or for Gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'io.openliberty.tools:liberty-gradle-plugin:3.8.3'
}
}
apply plugin: 'liberty'
dependencies {
libertyRuntime group: 'io.openliberty.beta', name: 'openliberty-runtime', version: '[24.0.0.7-beta,)'
}
Or if you’re using container images:
FROM icr.io/appcafe/open-liberty:beta
Or take a look at our Downloads page.
If you’re using IntelliJ IDEA, Visual Studio Code or Eclipse IDE, you can also take advantage of our open source Liberty developer tools to enable effective development, testing, debugging and application management all from within your IDE.
For more information on using a beta release, refer to the Installing Open Liberty beta releases documentation.
We welcome your feedback
Let us know what you think on our mailing list. If you hit a problem, post a question on StackOverflow. If you hit a bug, please raise an issue.