I don't have any specific insight in your problem, but for what it's worth, when I transitioned to a Guice model, I didn't have any issues with having servlet mappings in both web.xml and in the Guice servlet config. I transitioned them one at a time over a few days until all the mappings were gone from web.xml.
-- Cédric On Thu, Sep 13, 2012 at 6:56 PM, Sonny Heer <[email protected]> wrote: > We have an existing system that uses DispatcherServlet. For new services, > we'd like to port over services one at a time. I can't seem to get both to > work in conjunction. > > Here is my web.xml > > <filter> > <filter-name>Guice Filter</filter-name> > <filter-class>com.google.inject.servlet.GuiceFilter</filter-class> > </filter> > <filter-mapping> > <filter-name>Guice Filter</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > <listener> > <listener-class>com.me.GuiceServletConfig</listener-class> > </listener> > > <servlet> > <servlet-name>springMVCServlet</servlet-name> > > <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> > <init-param> > <param-name>contextConfigLocation</param-name> > > <param-value>WEB-INF/serviceApplicationContext.xml</param-value> > </init-param> > <load-on-startup>1</load-on-startup> > </servlet> > <servlet-mapping> > <servlet-name>springMVCServlet</servlet-name> > <url-pattern>/</url-pattern> > </servlet-mapping> > > > <security-constraint> > <display-name>authorizedUsers</display-name> > <web-resource-collection> > <web-resource-name>ALL URLs</web-resource-name> > <url-pattern>/*</url-pattern> > </web-resource-collection> > <auth-constraint> > <role-name>admin</role-name> > </auth-constraint> > </security-constraint> > <login-config> > <auth-method>BASIC</auth-method> > <realm-name>foo</realm-name> > </login-config> > <security-role> > <description>administrator access</description> > <role-name>admin</role-name> > </security-role> > > > in the GuiceServletConfig class fires up the following module: > > public class NewServletMod extends JerseyServletModule { > > @Override > protected void configureServlets() { > bind(RESTClass.class); > serve("/new-rest").with(GuiceContainer.class); > > } > } > > GuiceServletConfig: > public class GuiceServletConfig extends GuiceServletContextListener { > > @Override > protected Injector getInjector() { > return Guice.createInjector(new NewServletMod()); > > } > } > > The simple RESTClass returns "foo" with root jsr311 mapping to /new-rest. > Response is 404 when hitting the URL. In fact when taking the other > servlet mapping out it still produces a 404 response. But when I change > from serve("/new-rest") to serve("/*"), then things are good from the Guice > side, but 404s for the old services. Since everything is going to the > GuiceContainer in that case. > > Can anyone show how to configure these two together, or if it's even > possible? > > Thanks, > -Sonny > > -- > You received this message because you are subscribed to the Google Groups > "google-guice" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/google-guice/-/B-gVfO7vyvYJ. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-guice?hl=en. > -- You received this message because you are subscribed to the Google Groups "google-guice" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.
