虽然我在实际运用中并未遇到过或者发现过对于过滤器配置中的dispatcher使用相关的问题,但是对于它的使用必须了解,不然会吃亏的。至于为什么我就没有发现或者遇到过,还是因为这个是一个细节上的问题,如果不知道真的是很难意识到。
对于dispatcher这个配置,更多的应该是给我们开发人员带来了灵活的控制吧。即可以选择对那种类型的请求进行拦截过滤。要了解见下文,要了解更多地请自己Google。
一下摘录自:http://hintcnuie.iteye.com/blog/226251/
web.xml里<filter-mapping>中的<dispatcher>作用
2.4版本的servlet规范在部属描述符中新增加了一个<dispatcher>元素,这个元素有四个可能的值:即 REQUEST,FORWARD,INCLUDE和ERROR,可以在一个<filter-mapping>元素中加入任意数目 的<dispatcher>,使得filter将会作用于直接从客户端过来的request,通过forward过来的request,通过 include过来的request和通过<error-page>过来的request。如果没有指定任何< dispatcher >元素,默认值是REQUEST。可以通过下面几个例子来辅助理解。
例1:
Xml代码
- <filter-mapping>
- <filter-name>Logging Filter</filter-name>
- <url-pattern>/products/*</url-pattern>
- </filter-mapping>
这种情况下,过滤器将会作用于直接从客户端发过来的以/products/…开始的请求。因为这里没有制定任何的< dispatcher >元素,默认值是REQUEST。
例2:
Xml代码
- <filter-mapping>
- <filter-name>Logging Filter</filter-name>
- <servlet-name>ProductServlet</servlet-name>
- <dispatcher>INCLUDE</dispatcher>
- </filter-mapping>
这种情况下,如果请求是通过request dispatcher的include方法传递过来的对ProductServlet的请求,则要经过这个过滤器的过滤。其它的诸如从客户端直接过来的对ProductServlet的请求等都不需要经过这个过滤器。
指定filter的匹配方式有两种方法:直接指定url-pattern和指定servlet,后者相当于把指定的servlet对应的url-pattern作为filter的匹配模式
filter的路径匹配和servlet是一样的,都遵循servlet规范中《SRV.11.2 Specification of Mappings》一节的说明
例3:
Xml代码
- <filter-mapping>
- <filter-name>Logging Filter</filter-name>
- <url-pattern>/products/*</url-pattern>
- <dispatcher>FORWARD</dispatcher>
- <dispatcher>REQUEST</dispatcher>
- </filter-mapping>
在这种情况下,如果请求是以/products/…开头的,并且是通过request dispatcher的forward方法传递过来或者直接从客户端传递过来的,则必须经过这个过滤器。
2021年5月11日 16:58
It’s appropriate time to make some plans for the future and it is time to be happy. I have read this post and if I could I wish to suggest you few interesting things or advice. Perhaps you could write next articles referring to this article. I desire to read even more things about it! 123 movies
2021年5月21日 13:34
Hi there! Nice material, do keep me posted when you post something like this again! I will visit this blog leaps and bounds for more quality posts like it. Thanks... 먹튀검증커뮤니티
2021年5月21日 18:04 I think this is one of the most significant information for me. And i’m glad reading your article. But should remark on some general things, The web site style is perfect, the articles is really great : D. Good job, cheers Lovecraft cat name
2021年5月21日 23:32
Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post.
2021年5月24日 15:37
I was exactly searching for. Thanks for such post and please keep it up. Doing business in indonesia
2021年5月25日 23:07
A good blog always comes-up with new and exciting information and while reading I have feel that this blog is really have all those quality that qualify a blog to be a one.
2021年5月27日 18:52
China Non Woven Bags Co., Ltd Is a professional recycle bags manufacturer in China, our main products including non woven bags series, PP woven bags series, PET/RPET bags series, cotton & canvas bags series, nylon & polyester bags series, etc. Our products already well received in Europe, America, Japan, Malaysia, HK, Taiwan and China since 2003.
We have more than 300 employees with modern standard workshop, advanced imported equipment as well as high quality management and technical researchers. All of our products aim to be perfect from design, choice of material, production, packaging, and after-sales service. Based on our principle of "Quality defines existence and management is the key for development", we continually strive to exceed our customers' expectation.
We sincerely hope to cooperate with customers from all over the world to build long-term business relationships,If you have any question of our products, Just feel free to contact us. We will provide you professional advises and are looking forward to receiving your inquiry.
The tenet of our company: Same product, we compare with quality; Same quality we compare with price; Same price, we compare with service; Same service, we compare with speed.
2021年6月11日 19:56
Truly, this article is really one of the very best in the history of articles. I am a antique ’Article’ collector and I sometimes read some new articles if I find them interesting. And I found this one pretty fascinating and it should go into my collection. Very good work!
2021年6月14日 01:41 I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. I thank you to help making people more aware of possible issues. agen slot online 2021
2021年6月25日 19:02
I high appreciate this post. It’s hard to find the good from the bad sometimes, but I think you’ve nailed it! would you mind updating your blog with more information? bandar togel online
2021年6月29日 21:25
Thanks for sharing the post.. parents are worlds best person in each lives of individual..they need or must succeed to sustain needs of the family. lottery sambad
2021年7月01日 21:41
This was really an interesting topic and I kinda agree with what you have mentioned here! สล็อต
2021年7月03日 16:17
Thank you so much as you have been willing to share information with us. We will forever admire all you have done here because you have made my work as easy as ABC. arby's specials
2021年7月04日 18:46 Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts. slot404
2021年7月06日 18:34
I admit, I have not been on this web page in a long time... however it was another joy to see It is such an important topic and ignored by so many, even professionals. I thank you to help making people more aware of possible issues. winslot303
2021年7月07日 16:06
Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!! SBI Careers
2021年7月08日 19:22
This was really an interesting topic and I kinda agree with what you have mentioned here! Decatur Texas Web Design
2021年7月08日 21:36
Pretty good post. I have just stumbled upon your blog and enjoyed reading your blog posts very much. I am looking for new posts to get more precious info. Big thanks for the useful info. https://multinutri.shop/
2021年7月10日 19:38
Efficiently written information. It will be profitable to anybody who utilizes it, counting me. Keep up the good work. For certain I will review out more posts day in and day out. เซรั่มหน้าใส
2021年7月10日 20:44
Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info. โฟมล้างหน้าสำหรับผิวแพ้ง่าย
2021年7月11日 18:00
I really appreciate the kind of topics you post here. Thanks for sharing us a great information that is actually helpful. Good day! GTA 6 release date
2021年7月11日 18:25
What a sensational blog! This blog is too much amazing in all aspects. Especially, it looks awesome and the content available on it is utmost qualitative. slotxo auto
2021年7月11日 20:26
Your work is truly appreciated round the clock and the globe. It is incredibly a comprehensive and helpful blog. สมัครlive22
2021年7月11日 21:18
Thanks for sharing this information. I really like your blog post very much. You have really shared a informative and interesting blog post with people.. Why did Kakashi kill Rin?
2021年7月11日 23:32
You understand your projects stand out of the crowd. There is something unique about them. It seems to me all of them are brilliant. https://multinutri.shop/
2021年7月13日 14:09
I found that site very usefull and this survey is very cirious, I ' ve never seen a blog that demand a survey for this actions, very curious... pgslot
2021年7月15日 18:59
This article gives the light in which we can observe the reality. This is very nice one and gives indepth information. Thanks for this nice article. Top 10 Richest Person in the World
2021年7月17日 19:01
Nice to read your article! I am looking forward to sharing your adventures and experiences. voyance gratuite
2021年7月18日 00:03
Wow i can say that this is another great article as expected of this blog.Bookmarked this site.. Love Paragraphs For Him
2021年7月18日 16:51
I havent any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. Print In London
2021年7月20日 18:45
Thanks for another wonderful post. Where else could anybody get that type of info in such an ideal way of writing? decoupe legume moulinex
2021年7月29日 17:53
I recently found some useful posts in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing. Virtual Assistant For Online Store
2021年8月01日 20:56 I appreciated your work very thanks sermon transcription
2021年8月03日 18:07
You know your projects stand out of the herd. There is something special about them. It seems to me all of them are really brilliant! Animeflix
2021年8月04日 22:06
Yes, I am entirely agreed with this article, and I just want say that this article is very helpful and enlightening. I also have some precious piece of concerned info !!!!!!Thanks. more
2021年8月05日 22:09 I have read your article, it is very informative and helpful for me.I admire the valuable information you offer in your articles. Thanks for posting it.. minecraft smite command
2021年8月07日 21:51
Thank you for helping people get the information they need. Great stuff as usual. Keep up the great work!!! Dallas Criminal Defense Appellate Lawyer
2021年8月15日 19:06
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. Biofit probiotic review
2021年8月20日 18:30
Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! situs slot online
2021年8月20日 19:12
I'm glad I found this web site, I couldn't find any knowledge on this matter prior to.Also operate a site and if you are ever interested in doing some visitor writing for me if possible feel free to let me know, im always look for people to check out my web site. situs judi slot online
2021年8月21日 04:29
We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up. Great work. daftar slot online
2021年8月21日 17:15
I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here! keep up the good work... situs slot online
2021年8月22日 16:02
This is a smart blog. I mean it. You have so much knowledge about this issue, and so much passion. You also know how to make people rally behind it, obviously from the responses. Dallas homicide defense lawyer
2021年8月22日 22:59
This is a truly good site post. Not too many people would actually, the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best, with so much class. If wanted to know more about green smoke reviews, than by all means come in and check our stuff. Dentitox Pro Reviews
2021年8月31日 01:27
This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your articles, I guess I am not the only one having all the enjoyment here keep up the good work https://www.reddit.com/r/CryptoMars/comments/pbrjj1/polyrollorg_roll_top_gambling_dapp_on_polygon/
2021年9月01日 20:55
Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. fb88
2021年9月02日 19:38
Awesome article, it was exceptionally helpful! I simply began in this and I'm becoming more acquainted with it better! Cheers, keep doing awesome! situs judi online
2021年9月02日 20:07
I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. situs slot online
2021年9月02日 22:20
Thanks for an interesting blog. What else may I get that sort of info written in such a perfect approach? I have an undertaking that I am just now operating on, and I have been on the lookout for such info. W88
2021年9月04日 15:53
I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often. 188bet
2021年9月04日 19:08
I exactly got what you mean, thanks for posting. And, I am too much happy to find this website on the world of Google. 토토사이트
2021年9月08日 17:05
You make so many great points here that I read your article a couple of times. Your views are in accordance with my own for the most part. This is great content for your readers. 250 dofollow blog comments
2021年9月08日 18:48
You there, this is really good post here. Thanks for taking the time to post such valuable information. Quality content is what always gets the visitors coming. 250 dofollow blog comments
2021年9月09日 21:45
Within this webpage, you'll see the page, you need to understand this data. Uniques Christmas gifts
2021年9月13日 18:00
If you are looking for more information about flat rate locksmith Las Vegas check that right away. 온라인바둑이
2021年9月13日 23:29
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. sitio web
2021年9月14日 17:27
Your website is really cool and this is a great inspiring article. Best gift ideas for husband
2021年9月16日 18:46
Hey what a brilliant post I have come across and believe me I have been searching out for this similar kind of post for past a week and hardly came across this. Thank you very much and will look for more postings from you. 1500 blog comment
2021年9月18日 16:07
Thanks for a wonderful share. Your article has proved your hard work and experience you have got in this field. Brilliant .i love it reading. Bong88
2021年10月07日 20:42
Nice knowledge gaining article. This post is really the best on this valuable topic. 검증사이트
2021年10月12日 01:20 Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! jasa pembuatan website
2021年12月09日 22:23
I wish more authors of this type of content would take the time you did to research and write so well. I am very impressed with your vision and insight. lottery sambad
2021年12月15日 18:13
Excellent post. I was always checking this blog, and I’m impressed! Extremely useful info specially the last part, I care for such information a lot. I was exploring this particular info for a long time. Thanks to this blog my exploration has ended. 먹튀
2022年8月24日 12:55
Uttarakhand Board 12th Question Paper 2023 Download, Uttarakhand Board Intermediate Latest Question Bit Bank Paper 2023 Download, Uttarakhand Board 12th Question Paper 2023 Uttarakhand Board of Secondary Education is the board of UBSE which works to provide the education in 10th and 12th class in all the affiliated schools of Uttarakhand.Uttarakhand Board 12th Question Paper 2023 Download, Uttarakhand Board Intermediate Latest Question Bit Bank Paper 2023 Download
2022年11月21日 23:25
Thanks for the nice blog. It was very useful for me. I am happy I found this blog. Thank you for sharing with us. <a href="https://zopicloneinuk.com/product/zopiclone-7-5-mg-by-intas/">Order Zopiclone For Anxiety</a>
2022年11月21日 23:27
Thanks for the nice blog. It was very useful for me. I am happy I found this blog. Thank you for sharing with us. <url>https://zopicloneinuk.com/product/zopiclone-7-5-mg-by-intas/">Order Zopiclone For Anxiety</url>
2023年3月11日 02:00
A fantastic blog article. We are very appreciative of your blog article. After visiting your article, there are many other options available.
Best Pharmacy In Uk Online
Buy Zopiclone 7.5mg Tablets UK
Buy Zopisign 7.5 mg tablets Online UK
Zopisign 10 Mg At Best Price Online
Zopfresh Tablets For Short-term Treatment
Tapsmart 100 Mg Herbal Medicine
Tapentadol Short-term Pain Drug 100 Mg
Order Tapaday 200 Mg At Best Price
Soma 500 Mg Painkiller Tablet
2023年3月11日 20:59
Excellent information. I hope to write more soon!
kurti dresses for women
trendy top & tunics
leheriya salwar suit online
traditional kurtis for ladies
new arrival ethnic wear 2023
new arrival kurtis online shopping
Latest Bottom Wear for Ladies