jakartaee / faces

Jakarta Faces
Other
99 stars 55 forks source link

CDI: Allow listing to PhaseEvents via @Observes #1443

Open eclipse-faces-bot opened 7 years ago

eclipse-faces-bot commented 7 years ago

DeltaSpike has a way to catch PhaseEvents via @Observes: https://deltaspike.apache.org/documentation/jsf.html#Eventbroadcasting See AfterPhase / BeforePhase

It would be great to have this, however this requires that PhaseId values are Enums.

Example:

public void onPhaseStart(@Observes @BeforePhase(PhaseId.ANY_PHASE) PhaseEvent event) {
    //...
}

public void onPhaseEnd(@Observes @AfterPhase(PhaseId.RENDER_VIEW) PhaseEvent event) {
    //...
eclipse-faces-bot commented 5 years ago
eclipse-faces-bot commented 7 years ago

@glassfishrobot Commented Reported by tandraschko

eclipse-faces-bot commented 7 years ago

@glassfishrobot Commented This issue was imported from java.net JIRA JAVASERVERFACES_SPEC_PUBLIC-1443

eclipse-faces-bot commented 7 years ago

@arjantijms Commented Absolutely agree with this issue, big +1 from me.

This was conceptually on the table for 2.3 already, although there was some discussion about whether events are still needed if you can apply decorators to the life-cycle etc.

tandraschko commented 1 month ago

Easy implemented prototype here: https://github.com/tandraschko/myfaces/commit/63a3fe86a726f9f19efc88444b2f304f98c1fcb7

please review @BalusC @arjantijms @pizzi80 @melloware

melloware commented 1 month ago

This looks good I have used my own custom one for years!

BalusC commented 1 month ago

Oh cool. Let's do it for 5.0. I like you took the opportunity to finally turn the PhaseId into an enum.

tandraschko commented 4 weeks ago

done in myfaces: https://github.com/apache/myfaces/commit/c30922c9decfa43f89bcd1dddff8ffcdf077ddf5

tandraschko commented 4 weeks ago

i really like how easy those both CDI enhancements was to implement and its a great benefit for users