^Hello,

I want to access a web service with a GWT client. My idea is to implement a web 
service that could still be used if I change or add a new client.

I see 3 solutions :
1/ GWT RPC
2/ a json web service
3/ GWT edition of restlet

My analysis :
1/ GWT RPC : if I change of client, I would have to re write also server side 
=> eliminated
2/ a json web service : possible, restlet on the server side would be perfect, 
but serialization must be done and on the client side I would have to deal with 
overlay types.
3/ GWT edition of restlet : hum, very seducing, BUT the condition is that I 
manage to retrieve json from any other client than GWT. And so far I was not 
able to do this. It should be possible since it is mentionned in two places in 
the documentation :
 - a comment in the restlet wiki : 
http://wiki.restlet.org/docs_2.0/13-restlet/21-restlet/318-restlet/303-restlet.html
 - a scheme (4th in the page) : 
http://wiki.restlet.org/docs_2.0/13-restlet/275-restlet/144-restlet/185-restlet.html

=> does anyone knows how to retrieve json from a ServerRessource without having 
to manualy serialize the object ?

Hereby what I managed to obtain (it works but the serialization is done by 
me...)

public class OperationServerRessource extends ServerResource implements 
OperationRessource {
    
        private Operation ope;
        
        @Override
        protected void doInit() {
                super.doInit();
                this.ope = new Operation(); // the object to send
        }

        
        @Get
    public Object retrieve() {
                return ope;
        }

        @Get("json") 
        // is retrieved when on the client side with this request : 
        // (new 
ClientResource("/restlet/testGwtOperationRessource")).get(MediaType.APPLICATION_JSON)
        // but I wish I would not have to make the serialization myself...
    public String retrieveJson() {
                String st = "{\"key2\":\"value2\", \"key1\":\"value1\"}";
                return st;
        }
        
}

thank's 

Ben

ps : a forum instead of a mailing list could be a good way to facilitate the 
community get bigger (in a forum you can ad nice links, blocs of code, mail 
triggered when there is a new reply on the post you follow etc ...) That's just 
a suggestion, there may be some good reasons for keeping a mailing list...

------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2649959

Reply via email to