`
guoyanhonghit
  • 浏览: 18700 次
  • 性别: Icon_minigender_2
  • 来自: 北京
社区版块
存档分类
最新评论

exclude certain paths in <url-pattern> for filters

    博客分类:
  • web
阅读更多
在Web.xml中配置Filter的过滤路径时,可否exclude某些路径?
不可以。there isn't an exclude pattern in the servlet spec.
You would need to do it from within your Filter code.在doFilter中对路径进行判断处理。例如
 doFilter(ServletRequest req, ServletResponse res, FilterChain chain) {
    if(req instanceof HttpServletRequest) { 
             HttpServletRequest hreq = (HttpServletRequest)req; 
             if(hreq.getRequestURI().endsWith("aaa.do"){
                // do something
             }
     } 
      chain.doFilter(req, res); 
}
分享到:
评论

相关推荐

    Struts2整合SiteMesh技巧

    &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;sitemesh&lt;/filter-name&gt; &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;struts2&lt;/filter-...

    maven3配置文档

    --&gt; &lt;developers&gt; &lt;developer&gt; &lt;id&gt;dev1&lt;/id&gt; &lt;name&gt;Developer One&lt;/name&gt; &lt;email&gt;dev1@example.com&lt;/email&gt; &lt;roles&gt; &lt;role&gt;Developer&lt;/role&gt; &lt;/roles&gt; &lt;timezone&gt;-8&lt;/timezone&gt; &lt;/developer&gt; &lt;/developers&gt; &lt;!...

    JSTL配置文件

    &lt;exclude-prelude&gt;*&lt;/exclude-prelude&gt; &lt;include-coda&gt;/WEB-INF/jspf/coda.jspf&lt;/include-coda&gt; &lt;exclude-coda&gt;*&lt;/exclude-coda&gt; &lt;/jsp-property-group&gt; &lt;/jsp-config&gt; ``` **总结**,JSTL通过提供一系列预...

    拦截器与冲突解决

    每个拦截器应该是一个`&lt;mvc:interceptor&gt;`子元素,并指定其作用范围(如`&lt;mvc:mapping&gt;`和`&lt;mvc:exclude-mapping&gt;`)。 4. **AOP切面问题**:如果同时使用了基于注解的切面(@Aspect),可能会与拦截器产生竞争。...

    SSM项目 拦截器(csdn)————程序.pdf

    &lt;mvc:exclude-mapping path="/regist.jsp" /&gt; &lt;mvc:exclude-mapping path="/login.jsp" /&gt; &lt;mvc:exclude-mapping path="/account/" /&gt; &lt;bean class="com.hc.interceptor.LoginInterceptor"/&gt; &lt;/mvc:interceptor...

    DWR基础应用教程direct.ppt

    &lt;url-pattern&gt;/dwr/*&lt;/url-pattern&gt; &lt;/servlet-mapping&gt; ``` 接着,创建dwr.xml文件,该文件位于与web.xml相同的目录下,用于配置DWR允许的远程调用。例如: ```xml &lt;dwr&gt; &lt;allow&gt; &lt;create creator="new" ...

    Sitemesh 3 的使用及配置

    &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; &lt;/web-app&gt; ``` 这段配置表示所有的请求都会经过Sitemesh Filter的处理,从而使得所有页面都能够应用指定的装饰器。 #### 四、准备两个页面 为了演示Sitemesh...

    详解Vue中组件的缓存

    3. &lt;keep-alive&gt;的include和exclude属性:有时候我们不希望所有的组件都被缓存,这时可以通过&lt;keep-alive&gt;组件的include和exclude属性来有选择地缓存组件。include属性允许我们指定一个白名单,只有列表中的组件会被...

    SpringBoot开发环境、测试环境、部署环境切换.pdf

    &lt;exclude&gt;prod/*&lt;/exclude&gt; &lt;/excludes&gt; &lt;filtering&gt;true&lt;/filtering&gt; &lt;/resource&gt; &lt;!-- 其他资源配置 --&gt; &lt;/resources&gt; &lt;!-- 插件配置 --&gt; ... &lt;/build&gt; ``` 4. **SpringBoot Maven插件配置** 使用...

    20云计算1班-网络组建A卷.docx

    相关命令可能包含`dhcp server ip-pool net-172`、`network &lt;address&gt; &lt;mask&gt;`、`exclude-ip-address &lt;start-ip&gt; &lt;end-ip&gt;`、`dns-server address &lt;dns-ip&gt;`以及`lease day &lt;days&gt;`。 试题6要求在AR2220路由器上...

    字节跳动&lt;Git学习手册&gt;

    34. **修改远程仓库的url**:`git remote set-url origin &lt;new-url&gt;`。 35. **增加远程仓库**:`git remote add &lt;name&gt; &lt;url&gt;`。 36. **列出所有远程仓库**:`git remote`。 37. **查看两个星期内的改动**:`git log...

    前端大厂最新面试题-keepalive.docx

    &lt;component :is="view"&gt;&lt;/component&gt; &lt;/keep-alive&gt; ``` Keep-alive 可以设置以下 props 属性: * include:字符串或正则表达式。只有名称匹配的组件会被缓存。 * exclude:字符串或正则表达式。任何名称匹配的...

    SpringMVC 拦截器不拦截静态资源的三种处理方式方法

    在`spring-mvc.xml`配置文件中,可以通过`&lt;mvc:exclude-mapping&gt;`标签明确指定不被拦截的路径。例如: ```xml &lt;mvc:interceptors&gt; &lt;mvc:interceptor&gt; &lt;mvc:mapping path="/**/*"/&gt; &lt;mvc:exclude-mapping path="/...

    第二十一课 路由元信息与组件缓存1

    &lt;keep-alive :include="['userWork', 'userHobbies']" :exclude="['userIncome']"&gt; &lt;component :is="tabIndex"&gt;&lt;/component&gt; &lt;/keep-alive&gt; ``` 此外,我们还可以结合路由元信息来决定哪些路由对应的组件需要缓存...

    DWR+JPA DWR直接访问SERVICE层,并直接处理DAO返回的BEAN.doc

    &lt;url-pattern&gt;/*&lt;/url-pattern&gt; &lt;/filter-mapping&gt; ``` 接下来,我们需要在DWR配置中设置调用SERVICE层的MANAGER方法。由于MANAGER是通过Spring IoC容器创建的BEAN,因此DWR的creator应配置为'spring'。例如,如果...

    Vue keep-alive组件页面缓存控制示例

    在Vue中,`&lt;keep-alive&gt;`组件是一个特殊的组件,用于缓存子组件的状态,防止页面在切换时重新渲染,从而提高用户体验。本示例主要探讨如何使用`&lt;keep-alive&gt;`组件进行页面缓存控制。 `&lt;keep-alive&gt;`的基本用法是在...

    vue.js内置组件之keep-alive组件使用

    &lt;keep-alive exclude="a"&gt; &lt;component&gt;&lt;/component&gt; &lt;/keep-alive&gt; ``` 这会缓存所有非名为'a'的组件。 **生命周期钩子** `keep-alive`组件提供了两个特殊的生命周期钩子: 1. `activated`: 当组件被激活(进入...

    动易SF通用信息列表解释版

    &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pe="labelproc" exclude-result-prefixes="pe"&gt; &lt;!-- 定义样式表的根元素、规定样式表的 XSLT 版本、w3c命名空间、动易命名...

    cmake之file命令:文件处理命令

    file(READ &lt;filename&gt; &lt;out-var&gt; [OFFSET &lt;offset&gt;] [LIMIT &lt;max-in&gt;] [HEX]) ``` **描述**: - 读取文件 `&lt;filename&gt;` 的内容,并将其保存到变量 `&lt;out-var&gt;` 中。 - `OFFSET` 和 `LIMIT` 参数可选,分别指定从...

    springboot工程(单个maven工程)利用proguard实现代码混淆

    &lt;exclude&gt;META-INF/*.RSA&lt;/exclude&gt; &lt;/excludes&gt; &lt;/filter&gt; &lt;/filters&gt; &lt;relocations&gt; &lt;!-- 将你的包名重定位 --&gt; &lt;relocation&gt; &lt;pattern&gt;com.yourcompany.yourapp&lt;/pattern&gt; &lt;shadedPattern&gt;...

Global site tag (gtag.js) - Google Analytics