Class EventDispatcher
java.lang.Object
fr.paris.lutece.portal.web.cdi.mvc.event.EventDispatcher
Central dispatcher for firing CDI MVC-related events during the request lifecycle.
This class allows external components to observe and react to different moments in the MVC controller flow, such as before the controller is executed, after the view is processed, or just before a redirection occurs.
Events dispatched include:
BeforeControllerEvent– fired before the controller view and action has been processed.AfterProcessViewEvent– fired after the view has been processed.ControllerRedirectEvent– fired just before a redirect operation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFires anAfterProcessViewEventafter the view has been processed.fireBeforeControllerEvent(Method invokedMethod, boolean isBackOffice, MvcEvent.ControllerInvocationType controllerInvocationType, boolean isSecurityTokenEnabled) Fires aBeforeControllerEventbefore the controller view and action has been processed.Fires aControllerRedirectEventjust before a redirect is performed.
-
Constructor Details
-
EventDispatcher
public EventDispatcher()
-
-
Method Details
-
fireBeforeControllerEvent
public BeforeControllerEvent fireBeforeControllerEvent(Method invokedMethod, boolean isBackOffice, MvcEvent.ControllerInvocationType controllerInvocationType, boolean isSecurityTokenEnabled) Fires aBeforeControllerEventbefore the controller view and action has been processed.This allows observers to modify request context, set attributes, or perform validation before the controller method runs.
- Parameters:
invokedMethod- controller method that is about to be invokedstIsBackOffice- Indicates whether the current request is in the back-office (BO) context or in the FO- Returns:
- the dispatched
BeforeControllerEventinstance
-
fireAfterProcessViewEvent
Fires anAfterProcessViewEventafter the view has been processed.Observers may use this hook to inject additional content, perform logging, or clean up temporary data.
- Returns:
- the dispatched
AfterProcessViewEventinstance
-
fireControllerRedirectEvent
Fires aControllerRedirectEventjust before a redirect is performed.This allows observers to modify the redirect target URL or perform logic based on the target destination.
- Parameters:
uri- theUrlItemrepresenting the redirect destination- Returns:
- the dispatched
ControllerRedirectEventinstance
-