Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Filter Chain: Standard Filter Strategy

 
Glenio Alexandre Nogueira
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
I�m trying to use this configuration in my web.xml (Tomcat), but it doesn�t work. Could you help me, please?

.
.
.
<filter>
<filter-name>FilterOne</filter-name>
<display-name>FilterOne</display-name>
<description></description>
<filter-class>br.com.FilterOne</filter-class>
</filter>
<filter>
<filter-name>FilterTwo</filter-name>
<display-name>FilterTwo</display-name>
<description></description>
<filter-class>br.com.FilterTwo</filter-class>
</filter>
.
.
.
<filter-mapping>
<filter-name>FilterOne</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
.
.
.

Gl�nio Alexandre
Brasilia/DF, Brazil
 
gudla Dathathreya Reddy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error you are getting?
 
Glenio Alexandre Nogueira
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by gudla Dathathreya Reddy:
What is the error you are getting?


Hi. There isn�t a error message. I can�t get the second filter. I looked for a solution that It could use 2 or more filters,
but I found just one that used a class implementing Filter + a servlet

<filter-mapping>
<filter-name>FilterOne</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FilterTwo</filter-name>
<servlet-name>ServletClass</url-pattern>
</filter-mapping>

and not a class implementing Filter + another class implementing Filter

<filter-mapping>
<filter-name>FilterOne</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FilterTwo</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>

Did you understand me?

Thank you very much.
Gl�nio Alexandre
 
sawan parihar
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Alexandre,
To call the next filter in the chain you need to give a call to FilterChain.doFilter(request,response). This will call the next filter in the chain.

Hope that helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic