OmniFaces 5.4 has been released! This is the first OmniFaces version which is compatible with Jakarta Faces 5.0, while still keeping the Faces 4.1 minimum of the whole 5.x line. In other words, one and the same JAR runs on Jakarta EE 11 (Faces 4.1) as well as on the upcoming Faces 5.0. Next to that there are a few new features, two deprecations and two notable fixes.
New: Jakarta Faces 5.0 compatibility
Until now the whole OmniFaces 5.x line required Jakarta Faces 4.1 as minimum and was not verified against Faces 5.0. As of 5.4 the integration test suite also runs against both Mojarra 5.0.0-SNAPSHOT and MyFaces 5.0.0-SNAPSHOT on Tomcat, next to the existing Faces 4.1 runs. Note that these are still snapshots; Jakarta Faces 5.0 has not been finalized yet, so consider this a first compatibility milestone rather than a guarantee against the final release. The changes needed to span both generations turned out to be small; OmniFaces only had to catch up with the in Faces 5.0 renamed implementation packages and with a changed rendering of the on* attributes. The minimum stays at Faces 4.1, so upgrading to 5.4 is safe on Jakarta EE 11 while you have the opportunity to move to Faces 5.0 whenever you want.
New: OmniFaces.Ajax.validationFailed
Ever needed to know at the client side whether a Faces ajax request failed on validation? Until now you had to inspect the returned partial response or add a hidden component whose changed value acted as a flag. As of 5.4, each OmniFaces ajax response exposes FacesContext#isValidationFailed() to the client side as a boolean OmniFaces.Ajax.validationFailed. So your JavaScript can react to a validation failure without any server or DOM round-trip.
if (OmniFaces.Ajax.validationFailed) {
// Do your thing.
}
This works out of the box; there is nothing to configure. See also Ajax in the showcase. (#955)
New: org.omnifaces.CDN_RESOURCE_HANDLER_EXCLUDED_RESOURCES
The CDNResourceHandler rewrites resource URLs to a CDN host. When you use a wildcard mapping for a whole library, it may happen that a specific resource of that library is not actually hosted on the CDN (a typical example is PrimeFaces dynamiccontent.properties). As of 5.4 you can exclude such resources from rewriting via the new context parameter org.omnifaces.CDN_RESOURCE_HANDLER_EXCLUDED_RESOURCES. It takes a comma separated list of libraryName:resourceName identifiers which are then served as-is by the default Faces resource handler. The match is exact; wildcards are not supported here.
<context-param>
<param-name>org.omnifaces.CDN_RESOURCE_HANDLER_EXCLUDED_RESOURCES</param-name>
<param-value>primefaces:dynamiccontent.properties</param-value>
</context-param>
See also CDNResourceHandler in the showcase. (#954)
New: query params in FullAjaxExceptionHandler error pages
The FullAjaxExceptionHandler forwards to the error page declared in web.xml. Until now the declared <location> could only be a plain path. As of 5.4 you can add query params to it and they are honored on the forward.
<error-page>
<exception-type>java.lang.Throwable</exception-type>
<location>/WEB-INF/errorpages/500.xhtml?foo=bar</location>
</error-page>
See also FullAjaxExceptionHandler in the showcase. (#962)
Improved: OnDemandResponseBufferFilter
The OnDemandResponseBufferFilter, which backs <o:cache>, previously buffered only responses written via the Writer. It now also buffers responses written via the OutputStream. This was never a problem in practice; it was a long-standing TODO, addressed so the filter is reusable for binary or streamed responses too. (#959)
Deprecated: <o:selectItemGroups>
The <o:selectItemGroups> component has been deprecated. Faces 4.0 introduced a standard <f:selectItemGroups> which is functionally equivalent, so the OmniFaces one is not needed anymore. As of 5.4 a warning is logged once at runtime, and the component is marked for removal in a future version. Replace it with the standard <f:selectItemGroups>. (#958)
Deprecated: @Param without @Inject
Using @Param without @Inject on the same field has been deprecated. As of 5.4 a warning is logged at deployment time for each affected field. Add @Inject next to @Param to get rid of the warning. (#960)
Fixes
<o:inputFile> would duplicate the client side validation script in its onchange when the component was re-rendered. This has been fixed; the script is now added only once. (#963)
@ViewScoped could lose an active bean under concurrent requests. When the LRU eviction of the view scope bean storage kicked in, it could destroy a bean storage that was still actively used by a concurrent request. This has been fixed; a storage in active use is never anymore destroyed. (#966)
Installation
Non-Maven users: download OmniFaces 5.4 JAR and drop it in /WEB-INF/lib the usual way, replacing the older version if any.
Maven users: use the following coordinates.
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>5.4</version>
</dependency>
The <o:inputFile> and @ViewScoped fixes (#963 and #966) have also been backported to 4.x and 3.x, so OmniFaces 4.7.11 and OmniFaces 3.14.22 have been released as well. The Jakarta Faces 5.0 compatibility, the new features and the deprecations are exclusive to 5.4.
For the complete list of additions, changes and fixes, see What's new in OmniFaces 5.4? in the showcase.

No comments:
Post a Comment