spring-framework / org.springframework.web.jsf

Package org.springframework.web.jsf

Types

DecoratingNavigationHandler

abstract class DecoratingNavigationHandler : NavigationHandler

Base class for JSF NavigationHandler implementations that want to be capable of decorating an original NavigationHandler.

Supports the standard JSF style of decoration (through a constructor argument) as well as an overloaded handleNavigation method with explicit NavigationHandler argument (passing in the original NavigationHandler). Subclasses are forced to implement this overloaded handleNavigation method. Standard JSF invocations will automatically delegate to the overloaded method, with the constructor-injected NavigationHandler as argument.

DelegatingNavigationHandlerProxy

open class DelegatingNavigationHandlerProxy : NavigationHandler

JSF NavigationHandler implementation that delegates to a NavigationHandler bean obtained from the Spring root WebApplicationContext.

Configure this handler proxy in your faces-config.xml file as follows:

 <application> ... <navigation-handler> org.springframework.web.jsf.DelegatingNavigationHandlerProxy </navigation-handler> ... </application>
By default, the Spring ApplicationContext will be searched for the NavigationHandler under the bean name "jsfNavigationHandler". In the simplest case, this is a plain Spring bean definition like the following. However, all of Spring's bean configuration power can be applied to such a bean, in particular all flavors of dependency injection.
 <bean name="jsfNavigationHandler" class="mypackage.MyNavigationHandler"> <property name="myProperty" ref="myOtherBean"/> </bean>
The target NavigationHandler bean will typically extend the standard JSF NavigationHandler class. However, note that decorating the original NavigationHandler (the JSF provider's default handler) is not supported in such a scenario, since we can't inject the original handler in standard JSF style (that is, as constructor argument).

For decorating the original NavigationHandler, make sure that your target bean extends Spring's DecoratingNavigationHandler class. This allows to pass in the original handler as method argument, which this proxy automatically detects. Note that a DecoratingNavigationHandler subclass will still work as standard JSF NavigationHandler as well!

This proxy may be subclassed to change the bean name used to search for the navigation handler, change the strategy used to obtain the target handler, or change the strategy used to access the ApplicationContext (normally obtained via FacesContextUtils#getWebApplicationContext(FacesContext)).

DelegatingPhaseListenerMulticaster

open class DelegatingPhaseListenerMulticaster : PhaseListener

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)).