Thanks.
Sure, that would be possible to do. Are you looking to run standard
GWT RPC over a cross-domain transport, or replace it entirely with
Thrift? I can focus tutorial efforts on whichever is most needed.
On Wed, Jan 6, 2010 at 1:46 AM, Matt Mastracci (DotSpots) <mat...@dotspots.com> wrote:Hi Yesudeep,
Sure, that would be possible to do. Are you looking to run standard
GWT RPC over a cross-domain transport, or replace it entirely with
Thrift? I can focus tutorial efforts on whichever is most needed.
We have backends other than Java in production and GWT RPCseems to be limited to Java on both ends (client and server).We'd personally like to be able to use something that doesn't tie usto Java on the server even when we're using GWT for the client.A tutorial on replacing GWT RPC entirely with Thrift would, I hope,help those of us who cannot use GWT RPC.
I'm interested in this same type of tutorial. ave you had a chance to
put this together?
I'd be interested in seeing how to replace the GWT RPC mechanism with
Thrift using gwt-rpc-plus,
Also, what version of GWT is supported?
Thanks.
On Jan 5, 4:25 pm, Matt Mastracci <matt...@dotspots.com> wrote:
> On 2010-01-05, at 1:23 PM, Yesudeep wrote:
>
> > On Wed, Jan 6, 2010 at 1:46 AM, Matt Mastracci (DotSpots) <matt...@dotspots.com> wrote:
> > Hi Yesudeep,
>
> > Sure, that would be possible to do. Are you looking to run standard
> > GWT RPC over a cross-domain transport, or replace it entirely with
> > Thrift? I can focus tutorial efforts on whichever is most needed.
>
> > We have backends other than Java in production and GWT RPC
> > seems to be limited to Java on both ends (client and server).
> > We'd personally like to be able to use something that doesn't tie us
> > to Java on the server even when we're using GWT for the client.
> > A tutorial on replacing GWT RPC entirely with Thrift would, I hope,
> > help those of us who cannot use GWT RPC.
>
> OK, great. I'll put that on my to-do list and ping you when I've had a chance to whip it up.
>
> Thanks for the feedback,
>
> Matt Mastracci
Unfortunately things have been pretty hectic and I haven't had a chance to put this together. I'll try to quickly braindump some documentation here and eventually get it into Wiki form. We're currently using this framework in production, but there are definitely places we'd like to improve the API and experience.
There's some preliminary information on compiling the Thrift interfaces here: http://code.google.com/p/gwt-rpc-plus/wiki/GettingStartedWithThrift
The server-side Thrift APIs requires three pieces:
1. an API implementation that implements the server-side piece of the Thrift interface (see com.dotspots.rpcplus.example.jsonrpc.thrift.ExampleService)
2. a set of JSON-processing stubs that convert the incoming JSON into equivalent Thrift calls (autogenerated from the Thrift IDL for you)
3. a thin servlet that dispatches events to the JSON-processing stubs. This is kept separate from the API implementation to more easily integrate with frameworks like Spring/Guice/etc.
Here's an example of the dispatching servlet, written using Spring-style web handlers. Note that we're just passing the incoming request directly into the ThriftRequestProcessor. This class extracts the JSON payload from the request and passes it into the JSON-processing stub. The stub then determines the correct method to call, dispatches the call and re-serializes the return value.
public class MyApiHandler implements HttpRequestHandler {
private ThriftRequestProcessor thriftRequestProcessor;
private MyApiJson myApiJson;
@Autowired
MyApiImpl myApiImpl;
@PostConstruct
public void postConstruct() {
thriftRequestProcessor = new ThriftRequestProcessor();
myApiJson = new MyApiJson();
myApiJson.setService(myApiImpl);
}
@Override
public void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
thriftRequestProcessor.handleRequest(myApiJson, req, resp);
}
}
Matt Mastracci
mat...@dotspots.com
With this framework, is it possible to have a GWT client stand-alone?
For example, start a Python Thrift server on some port, and have my
GWT client make requests to it. I don't want to have to go through a
servlet that sits in between the GWT client and the Python Thrift
server.
--
Mike
Bog standard Thrift JSON embeds Thrift types in the JSON data that make it difficult to use efficiently on the client. I'm not familiar with the Python version of Thrift, but it's likely you might have to write a shim to read/write this form of JSON if you want to use this library.
Matt Mastracci
mat...@dotspots.com