• cdi
  • components
  • contexts
  • converters
  • el
  • eventlisteners
  • exceptionhandlers
  • facesviews
  • filters
  • functions
  • managedbeans
  • push
  • resourcehandlers
  • scripts
  • servlets
  • taghandlers
  • utils
  • validators
  • viewhandlers
 - 
  • Ajax
  • Beans
  • BeansLocal
  • Components
  • Events
  • Exceptions
  • Faces
  • FacesConfigXml
  • FacesLocal
  • JNDI
  • Messages
  • Servlets
  • WebXml

Available since OmniFaces 1.0

Collection of utility methods for the JSF API with respect to working with system and phase events.

Usage

Some examples:

// Add a callback to the current view which should run during every after phase of the render response on same view.
Events.subscribeToViewAfterPhase(PhaseId.RENDER_RESPONSE, new Callback.Void() {
   @Override
   public void invoke() {
       // ...
   }
});
// Add a callback to the current request which should run during before phase of the render response on current request.
Events.subscribeToRequestBeforePhase(PhaseId.RENDER_RESPONSE, new Callback.Void() {
    @Override
    public void invoke() {
        // ...
    }
});
// Add a callback to the current view which should run during the pre render view event.
Events.subscribeToViewEvent(PreRenderViewEvent.class, new Callback.SerializableVoid() {
    @Override
    public void invoke() {
        // ...
    }
});

Note that you can specify any phase ID or system event to your choice.

Feature request

If you know more useful methods/functions which you think should be added to this OmniFaces utility class so that everyone can benefit from a "standard" JSF utility library, feel free to post a feature request.