|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.web.jsf.DelegatingPhaseListenerMulticaster
public class DelegatingPhaseListenerMulticaster
JSF PhaseListener implementation that delegates to one or more Spring-managed PhaseListener beans coming from the Spring root WebApplicationContext.
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 Summary | |
---|---|
DelegatingPhaseListenerMulticaster()
|
Method Summary | |
---|---|
void |
afterPhase(javax.faces.event.PhaseEvent event)
|
void |
beforePhase(javax.faces.event.PhaseEvent event)
|
protected ListableBeanFactory |
getBeanFactory(javax.faces.context.FacesContext facesContext)
Retrieve the Spring BeanFactory to delegate bean name resolution to. |
protected Collection<javax.faces.event.PhaseListener> |
getDelegates(javax.faces.context.FacesContext facesContext)
Obtain the delegate PhaseListener beans from the Spring root WebApplicationContext. |
javax.faces.event.PhaseId |
getPhaseId()
|
protected WebApplicationContext |
getWebApplicationContext(javax.faces.context.FacesContext facesContext)
Retrieve the web application context to delegate bean name resolution to. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DelegatingPhaseListenerMulticaster()
Method Detail |
---|
public javax.faces.event.PhaseId getPhaseId()
getPhaseId
in interface javax.faces.event.PhaseListener
public void beforePhase(javax.faces.event.PhaseEvent event)
beforePhase
in interface javax.faces.event.PhaseListener
public void afterPhase(javax.faces.event.PhaseEvent event)
afterPhase
in interface javax.faces.event.PhaseListener
protected Collection<javax.faces.event.PhaseListener> getDelegates(javax.faces.context.FacesContext facesContext)
facesContext
- the current JSF context
getBeanFactory(javax.faces.context.FacesContext)
,
ListableBeanFactory.getBeansOfType(Class)
protected ListableBeanFactory getBeanFactory(javax.faces.context.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 context
null
)getWebApplicationContext(javax.faces.context.FacesContext)
protected WebApplicationContext getWebApplicationContext(javax.faces.context.FacesContext facesContext)
The default implementation delegates to FacesContextUtils.
facesContext
- the current JSF context
null
)FacesContextUtils.getRequiredWebApplicationContext(javax.faces.context.FacesContext)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |