Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

filter chain

 
ruijin yang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I can understand what is a filter.But I am really confused about
filter chain.Please give me some explanation.Thank you!
ruijin yang
 
Win Yu
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Yang:
You can try the examples from Chapter 14 of Professional JSP.
Basically, it goes through the filter class from one to another , just like a chain. At the end of the chain, if you call dofilter(), it will excute the servlet or JSP or HTML that you specified in the URL. It is more clear if you download the example form Professional JSP.
http://www.wrox.com/Books/Book_down.asp?sub_section=1&isbn=1861003625&subject=Java&subject_id=13
[This message has been edited by Win Yu (edited November 11, 2001).]
 
ruijin yang
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I am still in confusion about filter chain.The following is quoted from Servlet Specification 2.3.
<filter-mapping>
<filter-name>Image Filter</filter-name>
<servlet-name>ImageServlet</servlet-name>
</filter-mapping>
<filter-mapping>
<filter-name>Logging Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
** If there are filters matched by servlet name and the web resource has a servlet-
name, the container builds the chain of filters matching in the order declared
in the deployment descriptor. The last filter in this chain corresponds to
the last servlet-name matching filter and is the filter that invokes the target
web resource.
����My confusion:Does each filter in the chain correspond same servlet-name?Or each
filter in the chain correspond different servlet-name?If several filters applyied to
one servlet-name,are several filters all in filter chain?
** If there are filters using url-pattern matching and the url-pattern matches
the request URI according to the rules of SRV.11.2, the container builds the
chain of url-pattern matched filters in the same order as declared in the deployment
descriptor. The last filter in this chain is the last url-pattern matching
filter in the deployment descriptor for this request URI.
The last filter in
this chain is the filter that invokes the first filter in the servlet-name matching
chain, or invokes the target web resource if there are none.
����My confusion:What does it mean?The last filter in this chain is the last url-pattern matching
filter in the deployment descriptor for this request URI.
Please help.
ruijin yang

[This message has been edited by ruijin yang (edited November 12, 2001).]
[This message has been edited by ruijin yang (edited November 12, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic