Almost five years since its previous major release, OmniFaces 4.0 has been released after a long series of milestones that included a "Jakartified version of 3.14 with a couple of breaking changes" following the release of Jakarta EE 10. Besides the minimum requirements and breaking changes, new utility methods have been added and omnifaces.js
is now sourced by Typescript rather than vanilla JavaScript.
The biggest considered advantage of the change to TypeScript is its ability to transpile the exact same source code to an older EcmaScript version, such as ES5 or even ES3 for ancient web browsers. The intent is to do the same for Jakarta Faces’ own faces.js
. Targeted at ES5, omnifaces.js
is compatible with all major web browsers.
OmniFaces 4.0 is compatible with the Jakarta Faces 4.0 and Jakarta Faces 3.0 specifications from Jakarta EE 10 and Jakarta EE 9.1, respectively, with the minimum required version of Java 11. The Components#addFacesScriptResource()
method was added for component library authors who'd like to be compatible with both Faces 3.0 and 4.0. It will allow the component developer to support both Faces 3.0 jakarta.faces:jsf.js
and Faces 4.0 jakarta.faces:faces.js
as resource dependencies. The method exists because it is technically not possible to use a variable as an attribute of an annotation, such as @ResourceDependency
.
Besides the increase in the minimal version of Java, other minimum dependencies have changed as well: Java 11, Jakarta Server Faces 3.0, Jakarta Expression Language 4.0, Jakarta Servlet 5.0, Jakarta Contexts and Dependency Injection 3.0, Jakarta RESTful Web Services 2.0 and Jakarta Bean Validation 3.0. In other words, OmniFaces 4.0 is not backward compatible with previous versions of these dependencies because of the compiler-incompatible rename of the javax.*
package to the jakarta.
* package.
In the current version, everything that has been marked under the @Deprecated
annotation in version 3.x has been physically removed. For instance: the tag <o: form includeViewParams="true">
; and the WebXml.INSTANCE
enumeration has been replaced with the WebXml.instance()
and FacesConfigXml.instance()
methods.
The built-in managed beans, #{now}
and #{startup}
, will now return an instance of the Temporal
interface rather than the Java Date
class. The framework still supports the time property, as in #{now.time}
and #{startup.time}
, in a backward-compatible manner. Additionally, it provides two new convenience properties: instant
and zonedDateTime
as in #{now.instant}
, #{now.zonedDateTime}
, #{startup.instant}
and #{startup.zonedDateTime}.
The Callback
interfaces, dating back to Java 1.7, which had replacements available in Java 1.8, are now annotated under @Deprecated
. For example, Callback.Void
has been replaced by Runnable
, Callback.Returning
has been replaced by Supplier
, Callback.WithArgument
has been replaced by Consumer
and Callback.ReturningWithArgument
has been replaced by Function
. Utility methods in Components
and Events
have been adjusted to use the new types.
Even if the changes in OmniFaces 4.0 are not that revolutionary, this has been a long-awaited version after the stretched milestone releases. Having a more current minimum dependency and changing to TypeScript might provide interesting options to component builders relying on it.