ryber
ryber

Reputation: 4555

Use environment specific variable as dynamic init param of servlet filters

I have some external library Filters I want to include in my Java/Spring webapp. So I don't have access to change the source of the Filters themselves. The Filters have configurable options based on the FilterConfig. Normally these can be set in the web.xml as

<filter>
    <filter-name>foo</filter-name>
    <filter-class>com.acme.FooFilter</filter-class>
    <init-param>
        <param-name>fooParam</param-name>
        <param-value>bar</param-value>
    </init-param>
 </filter>

However, I don't want a static value for the param. Rather I want to use a environment specific variable. Normally in Spring I would use environmental specific property files to supply these kinds of values. How do I get that into the web.xml without having separate web.xml files? Can I provide a custom FilterConfig?

Upvotes: 1

Views: 1536

Answers (0)

Related Questions