Reputation:
I have various modules in my Application such as Authentication , Tickets , Reports ---etc . I want to apply Filters only to the Authentication Module and not to any other Modules . I have written a Authentication filter , My question is that , how can i apply this Authentication Filter applicable only to Authentication Module .
<filter>
<filter-name>AuthenFilter</filter-name>
<filter-class>AuthenFilter</filter-class>
<init-param>
<param-name>test-param</param-name>
<param-value>Initialization Paramter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>AuthenFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
What should be under the url-pattern tag so that its applicable only to the AuthenFilter Module
Upvotes: 0
Views: 150
Reputation: 440
You should map your filter to particular URI, like this:
<filter-mapping>
<filter-name>AuthenFilter</filter-name>
<url-pattern>/modules/login</url-pattern>
</filter-mapping>
or
<filter-mapping>
<filter-name>AuthenFilter</filter-name>
<url-pattern>/modules/authentication/*</url-pattern>
</filter-mapping>
Upvotes: 1