Use the force!

On Sat, Jan 16, 2010 at 6:21 AM, Alen Vrečko <[email protected]> wrote:

> Hi, Guys.
>
> I haven't worked much with WebSphere. It is a horrible piece of
> software. I don't consider it a servlet spec compatible container (at
> least not out of the box).
>
> What I think is happening: When you request /foo/bar/baz.rpc the
> server computes the target servlet, it doesn't match any declared
> servlet therefore it defaults to default servlet after which the
> filter chain is computed and invoked. Something along those lines if I
> understand how servlet containers work.
>
> I think the problem is that WS in the case of default servlet sets
> Servlet Path to "" even if you requested "/foo/bar/baz.rpc".
>
> Definitely take a look at
>
> http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/rweb_custom_props.html
> .
>
> More specifically look for
>
> com.ibm.ws.webcontainer.enabledefaultservletrequestpathelements
>
> In general on WS 6.1 I'd try setting
>
> com.ibm.ws.webcontainer.enabledefaultservletrequestpathelements=true
> com.ibm.ws.webcontainer.invokeFiltersCompatibility=true
> prependSlashToResource=true
>
> The guys I work with say you have to go with your "instinct" when
> configuring WS. Hardly an engineering approach.
>
> HTH.
>
> Cheers,
> Alen
>
> On Jan 15, 5:16 am, "Dhanji R. Prasanna" <[email protected]> wrote:
> > 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]>
> <google-guice%[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]<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