Package org.springframework.web.jsf

# Class DecoratingNavigationHandler

java.lang.Object
jakarta.faces.application.NavigationHandler
org.springframework.web.jsf.DecoratingNavigationHandler

public abstract class DecoratingNavigationHandler extends 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.

Since:
  1.2.7
Author:
  Juergen Hoeller
See Also:
  - `handleNavigation(jakarta.faces.context.FacesContext, String, String, NavigationHandler)`
  - `DelegatingNavigationHandlerProxy`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`DecoratingNavigationHandler()`
Create a DecoratingNavigationHandler without fixed original NavigationHandler.
`protected`
`DecoratingNavigationHandler(NavigationHandler originalNavigationHandler)`
Create a DecoratingNavigationHandler with fixed original NavigationHandler.

## Method Summary

Modifier and Type
Method
Description
`protected final void`
`callNextHandlerInChain(FacesContext facesContext, String fromAction, String outcome, NavigationHandler originalNavigationHandler)`
Method to be called by subclasses when intending to delegate to the next handler in the NavigationHandler chain.
`final NavigationHandler`
`getDecoratedNavigationHandler()`
Return the fixed original NavigationHandler decorated by this handler, if any (that is, if passed in through the constructor).
`final void`
`handleNavigation(FacesContext facesContext, String fromAction, String outcome)`
This implementation of the standard JSF `handleNavigation` method delegates to the overloaded variant, passing in constructor-injected NavigationHandler as argument.
`abstract void`
`handleNavigation(FacesContext facesContext, String fromAction, String outcome, NavigationHandler originalNavigationHandler)`
Special `handleNavigation` variant with explicit NavigationHandler argument.

### Methods inherited from class jakarta.faces.application.NavigationHandler

`handleNavigation`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DecoratingNavigationHandler

protected DecoratingNavigationHandler()
Create a DecoratingNavigationHandler without fixed original NavigationHandler.

### DecoratingNavigationHandler

protected DecoratingNavigationHandler(NavigationHandler originalNavigationHandler)
Create a DecoratingNavigationHandler with fixed original NavigationHandler.

Parameters:
  `originalNavigationHandler` - the original NavigationHandler to decorate

## Method Details

### getDecoratedNavigationHandler

@Nullable public final NavigationHandler getDecoratedNavigationHandler()
Return the fixed original NavigationHandler decorated by this handler, if any (that is, if passed in through the constructor).

### handleNavigation

public final void handleNavigation(FacesContext facesContext, String fromAction, String outcome)
This implementation of the standard JSF `handleNavigation` method delegates to the overloaded variant, passing in constructor-injected NavigationHandler as argument.

Specified by:
  `handleNavigation` in class `NavigationHandler`
See Also:
  - `handleNavigation(jakarta.faces.context.FacesContext, String, String, jakarta.faces.application.NavigationHandler)`

### handleNavigation

public abstract void handleNavigation(FacesContext facesContext, @Nullable String fromAction, @Nullable String outcome, @Nullable NavigationHandler originalNavigationHandler)
Special `handleNavigation` variant with explicit NavigationHandler argument. Either called directly, by code with an explicit original handler, or called from the standard `handleNavigation` method, as plain JSF-defined NavigationHandler.

Implementations should invoke `callNextHandlerInChain` to delegate to the next handler in the chain. This will always call the most appropriate next handler (see `callNextHandlerInChain` javadoc). Alternatively, the decorated NavigationHandler or the passed-in original NavigationHandler can also be called directly; however, this is not as flexible in terms of reacting to potential positions in the chain.

Parameters:
  `facesContext` - the current JSF context
  `fromAction` - the action binding expression that was evaluated to retrieve the specified outcome, or `null` if the outcome was acquired by some other means
  `outcome` - the logical outcome returned by a previous invoked application action (which may be `null`)
  `originalNavigationHandler` - the original NavigationHandler, or `null` if none
See Also:
  - `callNextHandlerInChain(jakarta.faces.context.FacesContext, java.lang.String, java.lang.String, jakarta.faces.application.NavigationHandler)`

### callNextHandlerInChain

protected final void callNextHandlerInChain(FacesContext facesContext, @Nullable String fromAction, @Nullable String outcome, @Nullable NavigationHandler originalNavigationHandler)
Method to be called by subclasses when intending to delegate to the next handler in the NavigationHandler chain. Will always call the most appropriate next handler, either the decorated NavigationHandler passed in as constructor argument or the original NavigationHandler as passed into this method - according to the position of this instance in the chain.

Will call the decorated NavigationHandler specified as constructor argument, if any. In case of a DecoratingNavigationHandler as target, the original NavigationHandler as passed into this method will be passed on to the next element in the chain: This ensures propagation of the original handler that the last element in the handler chain might delegate back to. In case of a standard NavigationHandler as target, the original handler will simply not get passed on; no delegating back to the original is possible further down the chain in that scenario.

If no decorated NavigationHandler specified as constructor argument, this instance is the last element in the chain. Hence, this method will call the original NavigationHandler as passed into this method. If no original NavigationHandler has been passed in (for example if this instance is the last element in a chain with standard NavigationHandlers as earlier elements), this method corresponds to a no-op.

Parameters:
  `facesContext` - the current JSF context
  `fromAction` - the action binding expression that was evaluated to retrieve the specified outcome, or `null` if the outcome was acquired by some other means
  `outcome` - the logical outcome returned by a previous invoked application action (which may be `null`)
  `originalNavigationHandler` - the original NavigationHandler, or `null` if none