Search code examples
javaweb.xmlcontext-param

Context-params use inside the web.xml


Is there a way to use the context-params inside the web.xml

example

<context-param>
    <param-name>AUTH_SERVER</param-name>
    <param-value>10.126.35.10</param-value>
</context-param>
...

<filter>
    <filter-name>NtlmHttpFilter</filter-name>
    <filter-class>jcifs.http.NtlmHttpFilter</filter-class>
    <init-param>
        AUTH_SERVER
    </init-param>
...

Solution

  • When you implement the filter probably you have to read the <init-param> parameter of the filter. There, instead of reading the parameter of the filter, you can read directly the context param, using:

    filterConfig.getServletContext().getInitParameter("paramName");
    

    Does that solve your matter?