I have two modules in application. First module is producing tasks for second module via Push Queue. Both modules use manual scaling.
Queue queue = QueueFactory.getQueue("update-job");
ModulesService ms = ModulesServiceFactory.getModulesService();
queue.add(TaskOptions.Builder.withUrl("/update-job").header("Host", ms.getVersionHostname("batch", ms.getCurrentVersion())));
I use "Host" header to route tasks to second app because of this bug https://code.google.com/p/googleappengine/issues/detail?id=10954
If I use plain old web.xml for servlet to url mapping everything works fine, all requests to version host will be successfully routed to instance and executed. But if I switch to GuiceFilter the same requests will produce 404 on version url. They are still available on instance url, but there will be no automatic routing from version url. Both configurations works fine on production, only devserver is affected.
I'm obviously missing something, because I can't find anything about this problem.
I tried different guice and guice-servlet versions: 3.0, 3.0.1-SNAPSHOT, 3.1.0-SNAPSHOT, 4.0-beta4 - no result
Also tried this approach https://stackoverflow.com/a/9706953/4070223 - no result
This is what web.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee" version="2.5">
<filter> <!-- does not work -->
<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>
<!--<servlet>--> <!-- works fine -->
<!--<servlet-name>update-job</servlet-name>-->
<!--<servlet-class>com.company.UpdateJobServlet</servlet-class>-->
<!--</servlet>-->
<!--<servlet-mapping>-->
<!--<servlet-name>update-job</servlet-name>-->
<!--<url-pattern>/update-job</url-pattern>-->
<!--</servlet-mapping>-->
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>com.company.BatchContextListener</listener-class>
</listener>
</web-app>
ContextListener:
public class BatchContextListener extends com.google.inject.servlet.GuiceServletContextListener {
@Override
protected Injector getInjector() {
return Guice.createInjector(new BatchModule());
}
}
And module:
public class BatchModule extends ServletModule {
@Override
protected void configureServlets() {
serve("/update-job").with(UpdateJobServlet.class);
}
}