IBM WebSphere Extended Deployment (XD)TM
Release 6.0

com.ibm.wsspi.filter
FilterLifecycle



This class has been based on the FilterLifeCycle.java picked up from the proxy component. Defines methods that all filters must implement. Filters are Java components that allow "on the fly" transformations of header and payload information in both the request into a resource and the response from a resource. Filters do not generally create a response to a request as servlets do; rather they modify or adapt the requests for a static or dynamic resource, and modify or adapt responses from a resource.

This interface defines methods to initialize a filter, and to remove a filter from the proxy server. These are known as life-cycle methods and are called in the following sequence:

  1. The filter is constructed, then initialized with its #init method. Initialization is provided so that a filter can read persistent configuration data, initialize costly resources (such as JDBC API based connections), and perform other one-time activities. The proxy initializes the filter instance by calling its init method.
  2. After a filter is properly initialized, the proxy may route traffic to it. As traffic flows through each filter point, the proxy invokes the filter's doFilter method. This method is defined by protocol-specific extensions to this interface.

  3. Ordinarily, the proxy will keep properly initialized filters active for the lifetime of the proxy server. When the proxy determines that a filter should be removed from service, its #destroy method is invoked to allow the filter to release any resources it is using and save any persistent state. For example, the proxy may do this when it is being shut down, or when proxy administration indicates that a given filter should be removed from service. Once the destroy method is called on a filter instance, the proxy will not route other events to any instance of the filter. After the destroy method completes, the proxy will release all reference to filter resources so that it is eligible for garbage collection.



Method Summary
public  voidinit()
           Called by the proxy to indicate the filter is being placed into service. .
public  voiddestroy()
           Called by the proxy to indicate the filter is being taken out of service. .

Method Detail

init

public void init()
Called by the proxy to indicate the filter is being placed into service.

The init method must complete successfully before the filter can receive any events.

During initialization, the filter instance can throw an Exception. The filter will not be placed into active service and will be released by the proxy. The filter's destroy method is not invoked as it is considered unsuccessful initialization.



Throws:
    java.lang.Exception


destroy

public void destroy()
Called by the proxy to indicate the filter is being taken out of service.

This method is only called once all threads within the filter's doFilter method have exited or after a timeout period has passed. After the proxy calls this method, it will not call the doFilter method again on this filter.

This method gives the filter an opportunity to clean up any resources that are being held (for example, memory, file handles, threads) and make sure that any persistent state is synchronized with the filter's current state in memory.



IBM WebSphere Extended Deployment (XD)TM
Release 6.0