web.xml过滤器不会在静态内容上运行 [英] web.xml filter won't run on static content

查看:153
本文介绍了web.xml过滤器不会在静态内容上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道为什么在提供欢迎文件或任何静态内容时不会运行web.xml筛选器?它似乎只运行在映射到servlet的URL上。

Does anyone know why a web.xml filter wouldn't be run when serving a welcome file, or any static content? It seems to only run on URLs that are mapped to a servlet. How can I get the filter functionality on static content?

以下是我正在使用的内容:

Here's what I'm using:

  <filter>
     <filter-name>myFilter</filter-name>
     <filter-class>com.domain.project.server.service.MyFilter</filter-class>
  </filter>

 <filter-mapping>
    <filter-name>myFilter</filter-name>
    <url-pattern>/*</url-pattern>
 </filter-mapping>

<filter>
    <filter-name>springSecurityFilterChain</filter-name>
    <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>

 <filter-mapping>
    <filter-name>springSecurityFilterChain</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

  <welcome-file-list>
    <welcome-file>WelcomeFile.html</welcome-file>
  </welcome-file-list>


推荐答案

这是。愚蠢的应用程序引擎配置需要被告知不要为了优化而绕过你的配置。我添加了WelcomeFile.html这一行到appengine-web.xml以使其正常工作:

Yay! This was it. Silly app engine config needs to be told not to circumvent your config in the interest of optimization. I added the WelcomeFile.html line to appengine-web.xml to get it working:

  <!-- Configure serving/caching of GWT files -->
  <static-files>
    <include path="**" />

    <!-- The following line requires App Engine 1.3.2 SDK -->
    <include path="**.nocache.*" expiration="0s" />

    <include path="**.cache.*" expiration="365d" />
    <exclude path="**.gwt.rpc" />
    <exclude path="**WelcomeFile.html" />
  </static-files>

这篇关于web.xml过滤器不会在静态内容上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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