jakartaee / faces

Jakarta Faces
Other
99 stars 55 forks source link

CDI: Allow non-component Faces events observeable by CDI #1501

Open tandraschko opened 4 years ago

tandraschko commented 4 years ago

i general it would be great to catch system events like PostConstructApplicationEvent

See: https://deltaspike.apache.org/documentation/jsf.html#Eventbroadcasting

I currently see following categories and events:

System

         <system-event-class>jakarta.faces.event.ExceptionQueuedEvent</system-event-class>
         <system-event-class>jakarta.faces.event.PostConstructApplicationEvent</system-event-class>
         <system-event-class>jakarta.faces.event.PreDestroyApplicationEvent</system-event-class>

This can be observed by:

public void listen(@Observes PostConstructApplicationEvent event) {...}

View

         <system-event-class>jakarta.faces.event.PreRenderViewEvent</system-event-class>
         <system-event-class>jakarta.faces.event.PostConstructViewMapEvent</system-event-class>
         <system-event-class>jakarta.faces.event.PreDestroyViewMapEvent</system-event-class>

This can be observed by:

public void listen(@Observes PreRenderViewEvent event) {...}

public void listen(@Observes @View("/myview.xhtml") PreRenderViewEvent event) {...}
tandraschko commented 1 year ago

@arjantijms @BalusC what are your ideas about this? IMO i would just port that feature of DS to the JSF specs, easy way to propagate JSF internals events to CDI for @AfterPhase(PhaseId....), we would need to switch PhaseId to enum like discussed in #1592

i think such a refactoring better fits 5.0

tandraschko commented 1 month ago

Thats it actually: https://github.com/tandraschko/myfaces/commit/36895806bf7d2145f183af0ca9eb16ea58f9cf58

please review @arjantijms @pizzi80 @BalusC @melloware

BalusC commented 1 month ago

This is great. Let's do it for 5.0.

tandraschko commented 1 month ago

https://github.com/apache/myfaces/commit/60ae7eba0004d0b93391445197c7daafa8340f13