On 14 Jan., 02:44, zhouxing fang <[email protected]> wrote: > hi,Harald,can you give more detail of your project? Is it possible to use > RESTful service with Ext-GWT?
We're using the following architecture / frameworks: 1. Server: Restlet & Spring 2. Client: Restlet-GWT module & GXT (http://extjs.com/products/gxt/) A typical request / response could be something like that (assuming that we're using XML): Client / UserService.java: public class UserService { public void getUsers() { new Client(Protocol.HTTP).get("http://server/users" new Callback() { public void onEvent(Request request, Response response) { XmlRepresentation xmlRepresentation = response.getEntityAsXml(); Document doc = xmlRepresentation.getDocument(); [parse XML] } }); } } Server / UsersResource.java (registered to handle "http://server/ users"): public class UsersResource extends Resource { public void UsersResource(Context context, Request request, Response response) { super(context, request, response); getVariants().add(new Variant(MediaType.TEXT_XML)); } public Representation represent(Variant variant) throws ResourceException { Representation result = new DomRepresentation (diaType.TEXT_XML); Document doc = rep.getDocument(); [Populate doc with users...] return result; } At the client side we parse the XML and turn it into ModelData instances so we can use them in the GXT widgets. In case of POST or PUT requests, we use forms at the client side and the Spring validation framework on the server side to validate and convert the form into POJOs. I'm not that familiar with GWT-EXT, but as they are very similiar in turn of classes / concepts, you should be able to use a similar approach. There's a preety good example of the Restlet-GWT module available at: http://wiki.restlet.org/docs_1.1/13-restlet/144-restlet/188-restlet.html Hope that helps! Greetings Harald --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
