What is chain.doFilter doing in Filter.doFilter method?

后端 未结 6 1926
予麋鹿
予麋鹿 2020-12-08 06:51

In a Filter.doFilter method I made this call chain.doFilter.

What is doFilter doing inside a doFilter? Isn\'t it a recursive call?

6条回答
  •  难免孤独
    2020-12-08 07:05

    Servlet Filters are an implementation of the Chain of responsibility design pattern.

    All filters are chained (in the order of their definition in web.xml). The chain.doFilter() is proceeding to the next element in the chain. The last element of the chain is the target resource/servlet.

提交回复
热议问题