public class DelegatingPhaseListenerMulticaster
extends java.lang.Object
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)
).
Constructor and Description |
---|
DelegatingPhaseListenerMulticaster() |
Modifier and Type | Method and Description |
---|---|
void |
afterPhase(PhaseEvent event) |
void |
beforePhase(PhaseEvent event) |
protected ListableBeanFactory |
getBeanFactory(FacesContext facesContext)
Retrieve the Spring BeanFactory to delegate bean name resolution to.
|
protected java.util.Collection<PhaseListener> |
getDelegates(FacesContext facesContext)
Obtain the delegate PhaseListener beans from the Spring root WebApplicationContext.
|
PhaseId |
getPhaseId() |
protected WebApplicationContext |
getWebApplicationContext(FacesContext facesContext)
Retrieve the web application context to delegate bean name resolution to.
|
public PhaseId getPhaseId()
public void beforePhase(PhaseEvent event)
public void afterPhase(PhaseEvent event)
protected java.util.Collection<PhaseListener> getDelegates(FacesContext facesContext)
facesContext
- the current JSF contextgetBeanFactory(FacesContext)
,
ListableBeanFactory.getBeansOfType(Class)
protected ListableBeanFactory getBeanFactory(FacesContext facesContext)
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.
facesContext
- the current JSF contextnull
)getWebApplicationContext(FacesContext)
protected WebApplicationContext getWebApplicationContext(FacesContext facesContext)
The default implementation delegates to FacesContextUtils.
facesContext
- the current JSF contextnull
)FacesContextUtils.getRequiredWebApplicationContext(FacesContext)