Research Log of Web Science Students

Computer Science is not simply programming

Everyone, the power of polymorphism.

leave a comment »

remoteServiceServlet

I was able to implement a tutorial that exposes GWT RPC as a Spring Bean! Now I can make use of Dependency Injection to give the the GWT-RPC services its dependencies such as Data Access Objects and other service classes. Don’t I just love POJO based development? Most probably I can unit test this as well. Now that makes it sweeter!

The GWT community has come up with a solution to integrate GWT RPC into a Spring container. The key here is simply to find a way for RPCs to get into the Spring container and be forwarded to the server POJO. This was done by implementing the controller interface and then making use of GWT’s RemoteServletService and what have you to process the call.

This was done by

1. implementing Spring’s controller interface
2. inheriting GWT’s RemoteServletService

I understand a bit what’s going on in there and I have to say that was a really smart thing to do!

But I do have my comment

I think it’s too “heavy” for each service to be implemented as a controller. Maybe the GWTRPC controller can have a list of services which can be wired in Spring and the GWTRPC controller can figure out from the payload which class it will use.

Something like this

@Override
public String processCall(String payload) throws SerializationException {
RPCRequest rpcRequest = RPC.decodeRequest(payload,
            this.remoteServiceClass);

// delegate work to the spring injected service
return RPC.invokeAndEncodeResponse(this.remoteService, rpcRequest
        getMethod(), rpcRequest.getParameters());
}

instead of using this.remoteService, do something like getRemoteService(String payload) which returns the appropriate
service class.

Another job for another day I guess.

Advertisements

Written by Jose Asuncion

November 2, 2009 at 6:12 pm

Posted in Hardwire

Tagged with , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: