Administration Guide › SPS APIs › Filter API Overview › Implement a Filter
Implement a Filter
Filters that use the session key depend on the session scheme to define the key. To make the session key available to a filter, an attribute keyed by SessionScheme.DEFAULT_SESSION_KEY_NAME must be set to hold the value of the key when it is created by the createKeyFromRequest(..) callback and retrieved on subsequent requests by the getKeyFromRequest(..) callback of the Session Scheme API.
Out-of-the-box session schemes that generate the session key are:
- Mini-cookies
- Simple URL rewriting
To implement a filter using the Filter API
- Review the sample code for filters in Filter Examples.
- Write source code for your filter.
- Ensure that your system CLASSPATH includes the following:
- proxyrt.jar which contains the filter API
- JDK version 1.4 or greater jar files
- sps_home/Tomcat/server/lib jar files
- Compile the filter.
- Do one of the following:
- Create a .jar file that contains your filter and copy the file to the directory sps_home/Tomcat/server/lib directory.
- Add the class files for your filter to the sps_home/Tomcat/server/classes directory, in a subdirectory that corresponds to the package name.
- Configure the SPS server.conf file.
- Edit the proxyrules.xml file for the rule that is expected to implement the filter. For example:
<nete:forward filter="your filter name">http://FQDN$0</nete:forward>
- Restart the SPS.