Interface Interceptor in Struts2.2.1
Posted on: January 29, 2011 at 12:00 AM
The Interface Interceptor (com.opensymphony.xwork2.interceptor ) extends Serializable interface and is a stateless class.

Interface Interceptor in Struts2.2.1

The Interface Interceptor (com.opensymphony.xwork2.interceptor ) extends Serializable interface and is a stateless class.

Interceptors are one of the most powerful features of struts2.2.1. the introduction of interceptors into struts2.2.1 framework is set it apart from other frameworks. An interceptor, as the name implies, intercepts the request and provides some additional processing before and after the execution of  action and result. An interceptor is a stateless class that follows the interceptor pattern, as found in Filter and in AOP languages.

The parameters of the interceptor's could be overriden in the following ways- ADS_TO_REPLACE_1

In the first method, The whole default stack is used in the struts.xml file. and in the second method we refer to the external stack defined by the user in the example.

The Interceptor Interface have three methods are as follows-

void destroy( ) - This method is used to clean up resources allocated by the interceptor. ADS_TO_REPLACE_2

void init( ) - This method is called at the time of intercept creation but before the request processing using intercept, and to initialize any resource needed by the Interceptor.

String intercept(ActionInvocation invocation ) - This method allows the Interceptor to intercept processing and to do some processing before and/or after the processing ActionInvocation.

Related Tags for Interface Interceptor in Struts2.2.1:

Advertisements

Ads

 
Advertisement null

Ads