Class DelegatingPhaseListenerMulticaster
- All Implemented Interfaces:
PhaseListener
,Serializable
,EventListener
Configure this listener multicaster in your faces-config.xml
file
as follows:
<application> ... <phase-listener> org.springframework.web.jsf.DelegatingPhaseListenerMulticaster </phase-listener> ... </application>The multicaster will delegate all
beforePhase
and afterPhase
events to all target PhaseListener beans. By default, those will simply be obtained
by type: All beans in the Spring root WebApplicationContext that implement the
PhaseListener interface will be fetched and invoked.
Note: This multicaster's getPhaseId()
method will always return
ANY_PHASE
. The phase id exposed by the target listener beans
will be ignored; all events will be propagated to all listeners.
This multicaster may be subclassed to change the strategy used to obtain
the listener beans, or to change the strategy used to access the ApplicationContext
(normally obtained via FacesContextUtils.getWebApplicationContext(FacesContext)
).
- Since:
- 1.2.7
- Author:
- Juergen Hoeller, Colin Sampaleanu
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterPhase
(PhaseEvent event) void
beforePhase
(PhaseEvent event) protected ListableBeanFactory
getBeanFactory
(FacesContext facesContext) Retrieve the Spring BeanFactory to delegate bean name resolution to.protected Collection<PhaseListener>
getDelegates
(FacesContext facesContext) Obtain the delegate PhaseListener beans from the Spring root WebApplicationContext.protected WebApplicationContext
getWebApplicationContext
(FacesContext facesContext) Retrieve the web application context to delegate bean name resolution to.
-
Constructor Details
-
DelegatingPhaseListenerMulticaster
public DelegatingPhaseListenerMulticaster()
-
-
Method Details
-
getPhaseId
- Specified by:
getPhaseId
in interfacePhaseListener
-
beforePhase
- Specified by:
beforePhase
in interfacePhaseListener
-
afterPhase
- Specified by:
afterPhase
in interfacePhaseListener
-
getDelegates
Obtain the delegate PhaseListener beans from the Spring root WebApplicationContext.- Parameters:
facesContext
- the current JSF context- Returns:
- a Collection of PhaseListener objects
- See Also:
-
getBeanFactory
Retrieve the Spring BeanFactory to delegate bean name resolution to.The default implementation delegates to
getWebApplicationContext
. Can be overridden to provide an arbitrary ListableBeanFactory reference to resolve against; usually, this will be a full Spring ApplicationContext.- Parameters:
facesContext
- the current JSF context- Returns:
- the Spring ListableBeanFactory (never
null
) - See Also:
-
getWebApplicationContext
Retrieve the web application context to delegate bean name resolution to.The default implementation delegates to FacesContextUtils.
- Parameters:
facesContext
- the current JSF context- Returns:
- the Spring web application context (never
null
) - See Also:
-