I think the problem is with websphere, that you need a default servlet to
get the GuiceFilter to fire.

Alen Vrecko knows more about this. But other servlet containers are
generally well behaved and ship with a DefaultServlet that serves files
statically (and typically a JSP servlet too).

Dhanji.

On Fri, Jan 15, 2010 at 3:07 PM, Ken <[email protected]> wrote:

> Am I the only one have this problem? I hope someone can share some
> help.
>
> On Jan 10, 2:22 am, Ken <[email protected]> wrote:
> > I am playing with Guice 2.0 and WebSphere 6.1. My servlet is
> > configured in Guice module.
> >
> > public class ServletConfigListener extends GuiceServletContextListener
> > {
> >         @Override
> >         protected Injector getInjector() {
> >                 return Guice.createInjector(new RpcServerModule());
> >         }
> >
> > }
> >
> > public class RpcServerModule extends ServletModule {
> >         @Override
> >         protected void configureServlets() {
> >                 serve("*.rpc").with(RpcServiceImpl.class);
> >         }
> >
> > }
> >
> > And I have configured GuiceFilter and above listener in my web.xml.
> >         <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>
> >         <listener>
> >                 <listener-class>
> >                         gov.ontario.mnr.irs.ServletConfigListener
> >                 </listener-class>
> >         </listener>
> >
> > However my servlet RpcServiceImpl is never called. I traced Guice and
> > found out in class com.google.inject.servlet.ServletDefinition, method
> > service(), it tries to match the servlet path with my servlet pattern:
> >   public boolean service(ServletRequest servletRequest,
> >       ServletResponse servletResponse) throws IOException,
> > ServletException {
> >     final boolean serve = shouldServe(((HttpServletRequest)
> > servletRequest).getServletPath());
> >
> > But the servlet path always equals to "", then the pattern is not
> > matched. Should Guice use request URI instead of servlet path when try
> > to match servlet pattern?
> >
> > I worked this around by putting following lines in web.xml:
> >         <servlet>
> >                 <servlet-name>RpcServlet</servlet-name>
> >                 <display-name>Gwt-Rpc Servlet</display-name>
> >                 <servlet-class>com.my.RpcServiceImpl</servlet-class>
> >         </servlet>
> >         <servlet-mapping>
> >                 <servlet-name>RpcServlet</servlet-name>
> >                 <url-pattern>*.rpc</url-pattern>
> >         </servlet-mapping>
> >
> > I don't believe this is a Guice bug, as if it is a bug, it should be
> > very easy to be detected. What did I do wrong? Any help is very
> > appreciated. Thank you.
>
> --
> 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]<google-guice%[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.

Reply via email to