views:

116

answers:

1

First off, I'm using Google AppEngine and Guice, but I suspect my problem is not related to these.

When the user connect to my (GWT) webapp, the URL is a direct html page. For example, in development mode, it is: http://127.0.0.1:8888/Puzzlebazar.html?gwt.codesvr=127.0.0.1:9997. Now, I setup my web.xml in the following way:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
 version="2.5">
 <display-name>PuzzleBazar</display-name>

 <!-- Default page to serve -->
 <welcome-file-list>
  <welcome-file>Puzzlebazar.html</welcome-file>
 </welcome-file-list>


 <filter>
  <filter-name>guiceFilter</filter-name>
  <filter-class>com.google.inject.servlet.GuiceFilter</filter-class>
 </filter>

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

 <!--
  This Guice listener hijacks all further filters and servlets. Extra
  filters and servlets have to be configured in your
  ServletModule#configureServlets() by calling
  serve(String).with(Class<? extends HttpServlet>) and
  filter(String).through(Class<? extends Filter)
 -->
 <listener>
  <listener-class>com.puzzlebazar.server.guice.MyGuiceServletContextListener
  </listener-class>
 </listener>

</web-app>

And my appengine-web.xml is:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0"&gt;
    <application>puzzlebazaar</application>
    <version>1</version>
    <sessions-enabled>true</sessions-enabled>

    <!-- Configure java.util.logging -->
    <system-properties>
        <property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>     
    </system-properties>

</appengine-web-app>

Since I'm using Guice, I have to configure extra filters in my ServletModule, where I do this:

filter("*.html").through( SecurityCookieFilter.class );

But my SecurityCookieFilter.doFilter is never called. I tried things like "*.html*" or <url-pattern>*</url-pattern> but to no avail. Any idea how I should do this?

+1  A: 

You've probably configured html files to be served up as static content in your appengine-web.xml. Static file serving doesn't involve your app at all, so you can't filter the output.

Nick Johnson
Thanks. I've added the appengine-web.xml up there. Anything missing?
Philippe Beaudoin
It looks like your html is being served as a static file, and as I say, that means that it doesn't touch your code at all. You need to create a servlet that serves up your files if you want them to be post-processable.
Nick Johnson