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/DevGuideServerCommunication.html#DevGuideDeRPC
[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 [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-web-toolkit?hl=en.