concept ActionInvocation in category java

appears as: ActionInvocation, ActionInvocation, The ActionInvocation
Struts 2 in Action

This is an excerpt from Manning's book Struts 2 in Action.

No matter whether we call the task cross-cutting or preprocessing, the conceptual mechanics of interceptors are clear. Instead of having a simple controller invoking an action directly, we now have a component that sits between the controller and the action. In Struts 2, no action is invoked in isolation. The invocation of an action is a layered process that always includes the execution of a stack of interceptors prior to and after the actual execution of the action itself. Rather than invoke the action’s execute() method directly, the framework creates an object called an ActionInvocation that encapsulates the action and all of the interceptors that have been configured to fire before and after that action executes. Figure 4.1 illustrates the encapsulation of the entire action execution process in the ActionInvocation class.

Figure 4.1. ActionInvocation encapsulates the execution of an action with its associated interceptors and results.

Now that the ActionInvocation has been created and populated with all the objects and information it needs, we can start the invocation. The ActionInvocation exposes the invoke() method, which is called by the framework to start the execution of the action. When the framework calls this method, the ActionInvocation starts the invocation process by executing the first interceptor in the stack. Note that the invoke() method doesn’t always map to the first interceptor; it’s the responsibility of the ActionInvocation itself to keep track of what stage the invocation process has reached and pass control to the appropriate interceptor in the stack. It does this by calling that interceptor’s intercept() method.

sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest