How to set a Tomcat Filter in WSO2 Servers

Create your filter Jar and update the Carbon Tomcat web.xml to pick then new filter.

$CARBON_HOME/repository/conf/tomcat/carbon/WEB-INF/web.xml

<!-- Filter implementation -->
    <filter>
        <filter-name>SetCustomCookie</filter-name>
        <filter-class>com.piedpiper.CustomCookie</filter-class>
        <init-param>
            <param-name>mode</param-name>
            <param-value>DENY</param-value>
        </init-param>
    </filter>
<!-- Filter maping --> 
    <filter-mapping>
       <filter-name>SetCustomCookie</filter-name>
       <url-pattern>/*</url-pattern>
    </filter-mapping>
Advertisements