Issue Details (XML | Word | Printable)

Key: SHALE-197
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Craig McClanahan
Reporter: Adam Brod
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Shale

Allow PhaseListeners to be defined with Annotations

Created: 20/Jun/06 08:25 PM   Updated: 21/Aug/06 11:28 PM
Return to search
Component/s: Tiger
Affects Version/s: 1.0.3-SNAPSHOT
Fix Version/s: 1.0.3


 Description  « Hide
Now that I can configure components and managed beans with annotations, I'm hooked. It would be great if we could also configure PhaseListeners with annotations.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Craig McClanahan added a comment - 30/Jun/06 12:51 PM
How quickly we can get spoiled :-)

I've got the runtime code that implements this suggestion completed, but need to build some unit tests for it before it's committed. Basically, I'm adding a @FacesPhaseListener annotation on a class to declare that any instance of that class is interested in being a phase listener, plus @BeforePhase and @AfterPhase methods to specify the actual methods to be invoked. At webapp startup time, any class marked with @FacesPhaseListener will cause an instance to be created, and then a PhaseListener registered with the JSF implementation (via an adapter class if PhaseListener is not implemented directly).

Craig McClanahan added a comment - 01/Jul/06 05:28 AM
Fixed in nightly build 20060701 (and in the 1.0.3-SNAPSHOT that will be pushed tonight). Use the new @FacesPhaseListener annotation to declare your listener class (which may, but need not, actually implement PhaseListener). If it does not, you can declare your own handler methods with the @BeforePhase and @AfterPhase annotations -- both of which must mark a public void method that takes a PhaseEvent.