pombreda / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 1 forks source link

Unable to serve a javax.servlet.Servlet #371

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm trying to use ServletModule#serve().with() 
javax.faces.webapp.FacesServlet using guice 2.0-r929 but the code doesn't 
compile since FacesServlet implements Servlet, and the method is accepting 
only Class<? extends HttpServlet>.

Any hint?

Original issue reported on code.google.com by davide.angelocola on 10 May 2009 at 9:17

GoogleCodeExporter commented 9 years ago
That appears to be a bug in JSF. You should file with them to get FacesServlet 
to implement HttpServlet.

But in the meantime you can implement a simple wrapper servlet that extends 
HttpServlet and delegates all calls 
to a FacesServlet field (you only need to delegate service(), init() and 
destroy()).

Good luck!

Original comment by dha...@gmail.com on 11 May 2009 at 2:00

GoogleCodeExporter commented 9 years ago
FWIW, delegating to FacesServlet from an HttpServlet will suffice only if your 
web.xml continues to reference javax.faces.webapp.FacesServlet in a 
servlet-mapping. Both Mojarra and MyFaces need to find a mapped servlet that's 
either javax.faces.webapp.FacesServlet or assignable to 
javax.faces.webapp.FacesServlet to instantiate the JSF framework. If they don't 
instantiate the framework, bad things will happen.

Original comment by thatha7777 on 4 Jul 2010 at 12:19

GoogleCodeExporter commented 9 years ago
This sounds like a very poor choice by the relevant JSF teams, why would they 
couple to implementation details like that? =(

I'd still say the correct solution is for Faces Servlet to extend HttpServlet.

Original comment by dha...@gmail.com on 4 Jul 2010 at 11:19