简体   繁体   中英

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>
...

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM