Ich Du,
It can work, but I would advice you to try something less intrusive and full
of tweaks as it is. I use a ServletModule of Guice to serve my servlets and
filters.
The GWT servlets responsible for proccessing the requests incoming from the
RPC framework are just servlets. You map them in the servlet module, using
the same context name as the module created in GWT (e.g.: if your module
call myModule your context will also be myModule) following this pattern:
The mapping in the servlet module will be: /<module name>/<url pattern>
The servlet that you bind to the above url pattern must
extends RemoteServiceServlet and implements the interface below
The service interface that you create altogether with the async one must
have the annotation @RemoteServiceRelativePath("<url pattern>")
Once everything is "wired" you must add the servlet module to your injector
and that's it, you'll be able to call this service from you GWT application
and also use @Inject as any other class mapped to use DI. :)
Here is an exemple of it:
// This is the service interface that is created with the async version.
This is a requirement of the RPC framework.
@RemoteServiceRelativePath("prototype")
public interface PrototypeService extends RemoteService {
....
}
// This is the GWT servlet that will proccess my RPC calls!
@Singleton
public class PrototypeServiceImpl extends RemoteServiceServlet implements
PrototypeService {
private Objectify objectify;
@Inject
public PrototypeServiceImpl(Objectify objectify) {
this.objectify = objectify;
}
...
}
// This is the servlet module that will map my url patterns to my servlets.
Note that the web.xml will not be used to map
// it anymore. If you want your servlets and filters to be DI-aware then you
must map them here.
public class ServletModule extends com.google.inject.servlet.ServletModule {
@Override
protected void configureServlets() {
serve("/bus/prototype").with(PrototypeServiceImpl.class);
}
}
I hope it helps you. :)
*Jayr Motta*
Software Developer
*
*
I'm on
BlackBeltFactory.com<http://www.blackbeltfactory.com/ui#!User/jmotta/ref=jmotta>
!
On Fri, Jul 1, 2011 at 8:53 AM, ich du <[email protected]> wrote:
> i have one short question: is thi
> s<http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/>the current
> (gwt 2.3, guice 3.0) way to integrate guice and gwt on server
> side? (don't know why but i have bad feeling about overriding processCall)?!
> If not is there a current tutorial how to integrate both?
>
> thx in advance
>
> --
> 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/-/4oKrvRpW9X0J.
> 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.