I am using Google AppEngine with java. I have configured for manual scaling by adding the following in appengine-web.xml
<manual-scaling>
<instances>1</instances>
</manual-scaling>
But after I add this, I am not able to use servlet filters with the following mapping in web.xml.
<filter>
<filter-name>testFilter</filter-name>
<filter-class>com.fms.test.TestFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>testFilter</filter-name>
<url-pattern>/_ah/api/*</url-pattern>
<url-pattern>/_ah/spi/*</url-pattern>
</filter-mapping>
The filters will work if I give * as url-pattern, but that is not my requirement. Without the manual scaling, it is working as expected.
Can anybody tell me why I cant use it?
PS: I am in development environment and using AppEngine SDK version 1.9.42
Here is my filter code:
public class TestFilter implements Filter {
private static final AdvocacyUtils utils = AdvocacyUtils.getInstance();
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
System.out.println("Request filtered.");
}
@Override
public void destroy() {
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
}
I've found some workaround (here) Solution is to add into the "filter-mapping" aditional section - "dispatcher" like in this snippet: