Perhaps I'm just missing some fundamental piece of knowledge but I can't figure out why servlet filter doesn't catch GET request on .html file of main GWT module.
My filter is defined in web.xml as
<filter>
<filter-name>GaeAuthFilter</filter-name>
<filter-class>com.test.GaeAuthFilter</filter-class>
</filter>
<f开发者_开发知识库ilter-mapping>
<filter-name>GaeAuthFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
When I launch the app in development mode it opens http://127.0.0.1:8888/AdminPanel.html?gwt.codesvr=127.0.0.1:9997 in the browser but nothing get caught in the filter :(
The reason I need this is that I don't want my authentication fail on RequestFactory ajax call since it looks ugly because it loads html first and then redirects to Google Accounts login page. I'd like to catch unauthenticated user at the moment of accessing html page so browser doesn't even load protected area of the web-site.
As alternative I tried to use "security-constraint" section of web.xml but it also ignores calls to .html file.
Please advise.
Thanks!
From the AppEngine documentation:
Note: Static files, files that are served verbatim to users such as images, CSS or JavaScript, are handled separately from paths mentioned in the deployment descriptor. A request for a URL path that matches a path to a file in the WAR that's considered a static file will serve the file, regardless of servlet and filter mappings in the deployment descriptor. You can exclude files from those treated as static files using the appengine-web.xml file.
I don't do AppEngine, but I guess adding an <exclude>
for the files you want the filter to apply to will do (the files will then be served by the default servlet; I guess that they'll be billed differently as a consequence)
I haven't looked in to why yet, but when I ran across this (while in a hurry), what worked was to remove index.html
and make my <welcome-file>
a .jsp
精彩评论