web.xml 中的欢迎页面未执行过滤器
Filter not executing for welcome page in web.xml
我正在尝试关注 these instructions 以使我的 GWT/App 引擎应用程序可抓取。我按照描述构建了一个过滤器,并在我的 web.xml:
中包含了以下内容
<filter>
<filter-name>crawlFilterChain</filter-name>
<filter-class>com.project.name.server.service.CrawlFilterChain</filter-class>
</filter>
<filter-mapping>
<filter-name>crawlFilterChain</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>BaconBits.html</welcome-file>
</welcome-file-list>
然后我尝试通过在浏览器中加载此 URL 来测试配置:
http://127.0.0.1:8888/?gwt.codesvr=127.0.0.1:9997&_escaped_fragment_=page%3DEvent%26eventId%3D1138
过滤器被调用,但不是针对首次加载页面时的初始 "GET /" 请求(returns 欢迎文件)。它仅针对后续 RPC/AJAX 请求调用,其中 none 具有查询字符串。奇怪的是,如果我在 URL 中的 / 之后插入一个不存在的资源(例如 index.html),则会调用过滤器,并返回适当的 HTML。我究竟做错了什么?生产中的行为是相同的。
这看起来与 here and here 描述的问题相同,但使用他们推荐的相同配置不起作用。基本上,"GET /" 请求 returns 欢迎文件不调用过滤器。我究竟做错了什么?
好的,this post 是同样的问题,appengine-web.xml 自我回答对我有用。
我正在尝试关注 these instructions 以使我的 GWT/App 引擎应用程序可抓取。我按照描述构建了一个过滤器,并在我的 web.xml:
中包含了以下内容 <filter>
<filter-name>crawlFilterChain</filter-name>
<filter-class>com.project.name.server.service.CrawlFilterChain</filter-class>
</filter>
<filter-mapping>
<filter-name>crawlFilterChain</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>BaconBits.html</welcome-file>
</welcome-file-list>
然后我尝试通过在浏览器中加载此 URL 来测试配置:
http://127.0.0.1:8888/?gwt.codesvr=127.0.0.1:9997&_escaped_fragment_=page%3DEvent%26eventId%3D1138
过滤器被调用,但不是针对首次加载页面时的初始 "GET /" 请求(returns 欢迎文件)。它仅针对后续 RPC/AJAX 请求调用,其中 none 具有查询字符串。奇怪的是,如果我在 URL 中的 / 之后插入一个不存在的资源(例如 index.html),则会调用过滤器,并返回适当的 HTML。我究竟做错了什么?生产中的行为是相同的。
这看起来与 here and here 描述的问题相同,但使用他们推荐的相同配置不起作用。基本上,"GET /" 请求 returns 欢迎文件不调用过滤器。我究竟做错了什么?
好的,this post 是同样的问题,appengine-web.xml 自我回答对我有用。