google-app-engine - 奇怪的 Java Servlet 过滤器映射行为

标签 google-app-engine servlet-filters web.xml

我正在使用带有 Google App Engine 插件的 Eclipse IDE 和 Guice。在开发服务器上运行时,我在 web.xml 和 guice MyServletModule extends ServletModule 中尝试了这两种方法:

<url-pattern>/user/*</url-pattern>

filter("/user/*").through(LoginFilter.class); 

两者似乎都适用

http://www.domain.com/user/

但是...两者似乎都不起作用:

http://www.domain.com/user/myaccount.html

知道为什么吗?根据文档, /user/* 应该适用于两者,对吗?

...我怀疑它与文件本身有关,因为我似乎也无法过滤 "*.html"

编辑:已解决。叹息...我在 GAE/J 文档中发现了这个花絮: “注意:即使路径与过滤器映射模式匹配,也不会在静态资源上调用过滤器。静态文件直接提供给浏览器。”

最佳答案

我在 GAE/J 文档中找到了这个花絮:

Note: Filters are not invoked on static assets, even if the path matches a filter-mapping pattern. Static files are served directly to the browser.

尽管所有 Java Servlet 文档都说您可以做到这一点,但在 GAE/J 中却做不到。

关于google-app-engine - 奇怪的 Java Servlet 过滤器映射行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9469032/

相关文章:

google-app-engine - 如何在 Google 应用引擎数据库中过滤具有空引用的行

java - Servlet 过滤器给出 NullPointerException

java - <jsp :include> with @WebServlet and web. xml 中的页面属性

java - Jax-WS 和 Spring-security 冲突

java - 如何在 web.xml 中添加类?

php - 在内存中运行 PHP

javascript - channel Google App Engine Channel.open() 不起作用

osgi - Cq5.5 将 servlet 过滤器应用于特定路径

google-app-engine - Blobstore URL 是否过期?收到 500 错误

java - 包含来自 Java EE Filter 的 JSP 文件