GWT RPC Service Proxy/Wrapper

186 views
Skip to first unread message

andreas_b

unread,
Jul 1, 2011, 3:11:46 AM7/1/11
to Google Web Toolkit
Hi all.

I'm currently working on a project that has both client side and
server side components. The server side code and the RPC services have
already been defined and implemented by one party and my team is now
about to develop the client side GWT app.

I have previously worked on projects where we used gwt-presenter and
gwt-dispatch using a Command pattern style for RPC. However, in this
project the services have been implemented more as an API with named
methods that each maps to underlying DAOs.

We are now looking at how to implement client side caching and other
centralized request/response handling around the RPC services. The
problem we're having is that there are a large number of service
methods defined, as opposed to one execute() method that you typically
find when using dispatch/Command pattern. Hence, it is not straight
forward as to how we would hook into these services and implement
caching and other generic handlers without re-writing the services and
it's server side implementation.

We have something like 3 services each looking like this.
Service
methodA(...)
methodB(...)
methodC(...)
...

What is the best or preferred way to wrap or hook into these calls to
provide caching and any other generic handling we may want to provide?
It doesn't seem very efficient to wrap the services and hook into each
separate method. We are looking to solve this client side rather than
re-writing the server-side implementation.
Note that the server-side component was implemented without our
involvement.

Thanks in advance.

Andreas



David Chandler

unread,
Jul 1, 2011, 8:47:36 AM7/1/11
to google-we...@googlegroups.com
Hi Andreas,

This is exactly why using the Command pattern a la gwt-dispatch is recommended :-) You can use a servlet filter for basic centralized handling such as authentication or have all your service impls extend a base class that extends RemoteServiceServlet, but those are the only ways I know of to get the low-hanging fruit.

/dmc




--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
David Chandler
Developer Programs Engineer, GWT+GAE
w: http://code.google.com/
b: http://googlewebtoolkit.blogspot.com/
t: @googledevtools

Jens

unread,
Jul 1, 2011, 10:31:44 AM7/1/11
to google-we...@googlegroups.com
Am Freitag, 1. Juli 2011 14:47:36 UTC+2 schrieb David Chandler (Google):
Hi Andreas,

This is exactly why using the Command pattern a la gwt-dispatch is recommended :-) 

But a Command pattern gets really annoying if you start using code splitting. GWT will load every serializer for every command (generic command interface) on startup because the generated RPC service has a reference to them.

Currently we load about 500-600kb of serializers we do not need on app startup just because of the amount of commands we have. Only solution so far would be to have multiple dispatch services each with a more specific execute method (one command interface per "application module" that has been code splitted). If you then want client side caching you would have similar issues as Andreas.

-- J.


Reply all
Reply to author
Forward
0 new messages