Previous Topic: ProxyFilter Interface

Next Topic: ProxyFilterConfig Interface


BaseProxyFilter Abstract Implementation

The Filter API includes BaseProxyFilter, an abstract implementation of a proxy filter that can be implemented as a subclass to create ProxyFilters.

Note: It is recommended that you extend the BaseProxyFilter Abstract Implementation, rather than implementing the ProxyFilter interface.

A subclass of BaseProxyFilter must override at least one of the following methods:

The BaseProxyFilter includes filter initialization and separates pre-processing and post-processing hooks for inserting your own filters into SPS transactions, as listed in the following table.

Return Value

Method

Void

doFilter(ProxyRequest prequest,
ProxyResponse presponse) throws
ProxyFilterException

This implementation determines the state of the request processing and calls doPreFilter if it's in an inbound state otherwise it calls doPostFilter for outbound state. At the time the filters get called processing can only be in one of these states.

Specified by:

doFilter in interface ProxyFilter

Parameters:

request - the proxy request data

response - the proxy response data

Throws:

ProxyFilterException - thrown if failure processing filtering

Void

doPreFilter(ProxyRequest prequest,
ProxyResponse presponse) throws
ProxyFilterException

Performs pre-filtering. Override this method to perform filtering tasks before the request is sent to the target server.

Parameters:

request - the proxy request data

response - the proxy response data

Throws:

ProxyFilterException - thrown if failure processing filtering

Void

doPostFilter(ProxyRequest prequest,
ProxyResponse presponse) throws
ProxyFilterException

Performs post-filtering. Override this method to perform filtering tasks after the response is received from the target server.

Parameters:

request - the proxy request data

response - the proxy response data

Throws:

ProxyFilterException - thrown if failure processing filtering

ProxyFilterConfig

getFilterConfig()

Returns this filter's ProxyFilterConfig object.

Specified by:

getFilterConfig in interface ProxyFilter

Returns:

ProxyFilterConfig the ProxyFilterConfig object that initialized this filter.

Void

init(ProxyFilterConfig config) throws
ProxyFilterException

Called when the filter is created to perform any required initialization.

Note: When overriding this method, the first statement should call the parent init method "super.init(config);".

Specified by:

init in interface ProxyFilter

Parameters:

config - a ProxyFilterConfig object containing the filters's configuration and initialization parameters

Throws:

ProxyFilterException - thrown if failure initializing this filter.