If we need to invoke a Filter when calling a particular servlet the following is the snippet for doing as such
<filter>
<filter-name>ViewerFilter</filter-name>
<filter-class>org.xxx.ViewerFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ViewerFilter</filter-name>
<servlet-name>ViewerServlet</servlet-name>
</filter-mapping>
<servlet>
<servlet-name>ViewerServlet</servlet-name>
<servlet-class>org.xxx.ViewerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ViewerServlet</servlet-name>
<url-pattern>/frameset</url-pattern>
</servlet-mapping>
So with the above snippet in “web.xml” if we call the “ViewerServlet” the “ViewerFilter” is automatically executed.
No comments:
Post a Comment