Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have found a more elegant solution :</p> <p>Instead of using the GuiceFilter, subclass it to intercept _ah/* calls and let the servlet container do its regular job instead of letting Guice intercepting it. Here I prevent Guice from intercepting /_ah/* but /_ah/warmup because /_ah/warmup is supposed to be handled by the programmer.</p> <pre><code>package com.kya.guice.mvc; import java.io.IOException; import java.util.regex.Pattern; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import com.google.inject.servlet.GuiceFilter; public class GaeSafeGuiceFilter extends GuiceFilter { private static final Pattern p = Pattern.compile("/_ah/.*"); @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest)request; if (p.matcher(req.getRequestURI()).matches() &amp;&amp; !req.getRequestURI().equals("/_ah/warmup")) { chain.doFilter(request, response); return ; } super.doFilter(request, response, chain); } } </code></pre> <p>You then just have to change your web.xml with :</p> <pre><code>&lt;filter&gt; &lt;filter-name&gt;guiceFilter&lt;/filter-name&gt; &lt;filter-class&gt;com.kya.guice.mvc.GaeSafeGuiceFilter&lt;/filter-class&gt; &lt;/filter&gt; </code></pre> <p>instead of com.google.inject.servlet.GuiceFilter</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload