Re: Guice and RpcServlet

2010-06-11 Thread hbf
Googling for DeRPC (and not Direct-Eval RPC) got me what I needed.
Here it is, for the sake of completeness:

  
http://groups.google.com/group/google-guice/browse_thread/thread/d958f5a82d45706a/bc6bca85513d9cb3

On May 27, 2:35 pm, hbf kaspar.fisc...@dreizak.com wrote:
 Hi,

 I would like to use the new and experimental [1] Direct-Eval RPC of
 GWT 2 with server-side Guice. However, I could only find information
 on configuring Guice and GWT for the old RPC, see [2]. To inject the
 service, the latter blog suggests:

 @Singleton
 public class GuiceRemoteServiceServlet extends RemoteServiceServlet {
   @Inject
   private Injector injector;

   @Override
   public String processCall(String payload) throws
 SerializationException {
     try {
       RPCRequest req = RPC.decodeRequest(payload, null, this);

       RemoteService service = getServiceInstance(
             req.getMethod().getDeclaringClass());

       return RPC.invokeAndEncodeResponse(service, req.getMethod(),
         req.getParameters(), req.getSerializationPolicy());
     } catch (IncompatibleRemoteServiceException ex) {
       log(IncompatibleRemoteServiceException in the
 processCall(String) method.,
           ex);
       return RPC.encodeResponseForFailure(null, ex);
     }
   }

   @SuppressWarnings({unchecked})
   private RemoteService getServiceInstance(Class serviceClass) {
     return (RemoteService) injector.getInstance(serviceClass);
   }

 }

 What is the recommended way to do this with the new RpcServlet instead
 of RemoteServiceServlet?

 Many thanks,Kaspar

 [1]http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunicat...
 [2]http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/

-- 
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: Guice and RpcServlet

2010-06-11 Thread hbf
Any ideas?

Best,
Kaspar

On May 27, 2:35 pm, hbf kaspar.fisc...@dreizak.com wrote:
 Hi,

 I would like to use the new and experimental [1] Direct-Eval RPC of
 GWT 2 with server-side Guice. However, I could only find information
 on configuring Guice and GWT for the old RPC, see [2]. To inject the
 service, the latter blog suggests:

 @Singleton
 public class GuiceRemoteServiceServlet extends RemoteServiceServlet {
   @Inject
   private Injector injector;

   @Override
   public String processCall(String payload) throws
 SerializationException {
     try {
       RPCRequest req = RPC.decodeRequest(payload, null, this);

       RemoteService service = getServiceInstance(
             req.getMethod().getDeclaringClass());

       return RPC.invokeAndEncodeResponse(service, req.getMethod(),
         req.getParameters(), req.getSerializationPolicy());
     } catch (IncompatibleRemoteServiceException ex) {
       log(IncompatibleRemoteServiceException in the
 processCall(String) method.,
           ex);
       return RPC.encodeResponseForFailure(null, ex);
     }
   }

   @SuppressWarnings({unchecked})
   private RemoteService getServiceInstance(Class serviceClass) {
     return (RemoteService) injector.getInstance(serviceClass);
   }

 }

 What is the recommended way to do this with the new RpcServlet instead
 of RemoteServiceServlet?

 Many thanks,Kaspar

 [1]http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunicat...
 [2]http://stuffthathappens.com/blog/2009/09/14/guice-with-gwt/

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