过滤除一个以外的所有网址 [英] Filter all urls except one

查看:128
本文介绍了过滤除一个以外的所有网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了一个网址(页面),有人能告诉我如何编写过滤器吗?我的过滤器正在运行,但它也适用于索引页面。需要避免过滤器的索引页面。我使用jsp,servlet和java作为web应用程序。

Can anyone tell me how to write a filter except for one url (page)? my filter is working but it applies to index page also. need to avoid index page from the filter. Im using jsp, servlet and java for a web app.

推荐答案

1。在过滤器中获取请求的uri

1. In filter grab the requested uri
HttpServletRequest.getRequestURI()



2.创建一个do-not-filter列表。

3.将uri与列表进行比较。


2. Create a list of do-not-filter .
3. compare the uri with the list.


试试这个,



http://stackoverflow.com/questions/3180929 / guice-servlet-dsl-filter-all-but-one-url [ ^ ]


这篇关于过滤除一个以外的所有网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆