Re: RequestFactory don't play nice with guice?

2010-12-05 Thread Thomas Broyer

On 5 déc, 01:06, Simon Majou  wrote:
> When creating an object with RequestFactory the @inject fields are not
> injected. I guess RequestFactory don't use guice to create the
> objects. How can I delegate objects creation to Guice?

"Just" wait for the 2.1.1 release and then implement a
ServiceLayerDecorator.
See http://code.google.com/p/google-web-toolkit/wiki/RequestFactory_2_1_1
and
http://code.google.com/p/google-web-toolkit/source/browse/releases/2.1/user/src/com/google/gwt/requestfactory/server/ServiceLayerDecorator.java
Javadoc for each method can be find in the ServiceLayer class:
http://code.google.com/p/google-web-toolkit/source/browse/releases/2.1/user/src/com/google/gwt/requestfactory/server/ServiceLayer.java

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: RequestFactory don't play nice with guice?

2010-12-06 Thread Simon Majou
Thanks for the info.

On Dec 5, 10:48 pm, Thomas Broyer  wrote:
> On 5 déc, 01:06, Simon Majou  wrote:
>
> > When creating an object with RequestFactory the @inject fields are not
> > injected. I guess RequestFactory don't use guice to create the
> > objects. How can I delegate objects creation to Guice?
>
> "Just" wait for the 2.1.1 release and then implement a
> ServiceLayerDecorator.
> Seehttp://code.google.com/p/google-web-toolkit/wiki/RequestFactory_2_1_1
> andhttp://code.google.com/p/google-web-toolkit/source/browse/releases/2
> Javadoc for each method can be find in the ServiceLayer 
> class:http://code.google.com/p/google-web-toolkit/source/browse/releases/2

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: RequestFactory don't play nice with guice?

2010-12-26 Thread Henrik Schmidt
Since GWT 2.1.1 is here:

Another way of doing it would be to just use a normal ServletModule as
per the Guice user guide: 
http://code.google.com/docreader/#p=google-guice&s=google-guice&t=ServletModule

Then bind the RequestFactoryServlet;

bind(RequestFactoryServlet.class).in(Singleton.class);
serve("/gwtRequest").with(RequestFactoryServlet.class);

Otherwise following the RequestFactory documentation you can use:

requestStaticInjection(MyDomainClass.class)

in your module to inject the PersistenceManager (or EntityManager)
statically.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: RequestFactory don't play nice with guice?

2010-12-27 Thread Thomas Broyer
For information:

   - I use Guice's ServletModule to bind my RequestFactory servlet
   - to benefit from Guice in Service-s and Locator-s, I use a very simple 
   ServiceLayerDecorator, that I inject into a RequestFactoryServlet subclass 
   (so I can pass it to the super() constructor). The ServiceLayerDecorator is 
   being injected the Injector, and overrides createServiceInstance and 
   createLocator
   - createLocator is implemented by directly calling the Injector's 
   getInstance
   - because of the way it's done, createServiceInstance first calls 
   getTop().resolveServiceLocator. If it's not null, then it get's an instance 
   from the Injector and calls getInstance on it (with the 
   domainMethod.getDeclaringClass() as argument, to mimic the default 
   behavior). That way, the ServiceLocator is dependency-injected.
   - Because I want my services to be dependency-injected (and not 
   necessarily my ServiceLocator-s), I created an InjectingServiceLocator that 
   get's injected the Injector and then uses injector.getInstance to implement 
   the ServiceLocator#getInstance. You the just have to use that ServiceLocator 
   for your service for it to be dependency-injected by Guice.

It all fits in approx. 20 LoC.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: RequestFactory don't play nice with guice?

2011-08-31 Thread Daniel Dietrich
Wow, that works fine for me. Thanks a lot!


-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.