The article you link to does much more than just use Guice with GWT-RPC 
(which is in no way different than using Guice with any other servlet).
If all you need is injecting your GWT-RPC servlets, you don't need anything 
special: add @Inject ctor/setters/fields to them and map them in the 
GuiceServletModule using the serve().with() DSL, just like any other 
servlet.

The article goes a step farther: allowing you to configure, via Guice, the 
implementation of the RemoteService used for a given service. The thing is 
that the class you give to with() in a serve().with() binding has to extend 
HttpServlet, so you cannot bind to a RemoteService interface and 
independently configure a bind(MyService.class).to(MyServiceImpl.class).

That being said, I guess you could refactor your servlet to inject the 
ServletContext (in a method or in the constructor) and spawn the thread from 
there (the thread does not seem to require your MyServiceImpl to extend 
RemoteServiceServlet or even Servlet; only to have access to the 
ServletContext)

-- 
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