Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Deployment Descriptor web.xml

 
Shailaja Tankala
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have two filters to process a servletrequest called as FirstFilter and SecondFilter.
The request should pass through FirstFilter and than SecondFilter before it can be processed by the encompassing component.
How can I specify that the request should pass through FirstFilter and than SecondFilter in the deployment descriptor file web.xml.


Thanks In advance
Sharmila
 
Daniel Rhoades
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here you go:

<filter>
<filter-name>FirstFilter</filter-name>
<filter-class>filters.FirstFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>FirstFilter</filter-name>
<servlet-name>someservlet</servlet-name>
</filter-mapping>

<filter>
<filter-name>SecondFilter</filter-name>
<filter-class>filters.SecondFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecondFilter</filter-name>
<servlet-name>someservlet</servlet-name>
</filter-mapping>

The order in which your filters are used is the same as the order in the DD
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic