I have a filter that looks like this:
<filter>
<filter-name>TestFilter</filter-name>
<filter-class>org.TestFilter</filter-class>
<init-param>
<param-name>timeout</param-name>
<param-value>30</param-value>
</init-param>
</filter>
As we say ServletFilter and Servlets. In fact, I'm already in my servlet and executed the first part of doFilter. Therefore, the container must know the init parameter. I do not have access to change the Filter class.
Is it possible to get the value of the initialization parameter using the HttpServletRequest object?
The only solution I can think of is to read web.xml as a resource and try to find the value manually. But there seems to be a better solution.
source
share