Login | Register
My pages Projects Community openCollabNet

Discussions > discuss > CRUD Operation for Calling ServerResouce with ClientProxy

restlet
Discussion topic

2020-04-07: This site is going to be decommissioned and shut down on 2020-07-01. Please copy and archive any data you wish to keep before that date.

Back to topic list

CRUD Operation for Calling ServerResouce with ClientProxy

Author xybrek
Full name Xybrek
Date 2015-01-13 16:45:20 PST
Message I have this ServerResource that is called by a ClientProxy:

public class GaeThingServerResource extends SelfInjectingServerResource
         implements ThingResource {
     private static final Logger LOG
             = Logger.getLogger(Gae​ThingServerResource.​class.getName());
     @Override
     public ThingItem createThing(ThingItem Thing) {
         store().put(Thing);
         return Thing;
     }
     @Override
     public ThingItem readThing(Long id) {
         LOG.info("Read Thing id=" + id);
         ThingItem result = store().get(ThingItem.class, id);
         return result;
     }
     @Override
     public ThingItem updateThing(ThingItem Thing) {
         LOG.info("Updating Thing=" + Thing.toString());
         store().put(Thing);
         return Thing;
     }
     @Override
     public void deleteThing(Long id) {
         LOG.info("Delete Thing id=" + id);
         store().delete(ThingItem.class, id);
     }
}

This is called by:

public interface ThingResourceProxy extends ClientProxy {
     @Get
     public void readThing(Long id, Result<ThingItem> callback);
     @Delete
     public void deleteThing(Long id, Result<Void> callback);
     @Post
     public void createThing(ThingItem thing, Result<ThingItem> callback);
     @Put
     public void updateThing(ThingItem thing, Result<ThingItem> callback);
     @Get
     public void list(Result<Thing​ResultItem> callback);
}

With this code:

                 ThingResourceProxy thingResource =
GWT.create(ThingReso​urceProxy.class);
 
thingResource.getCli​entResource().setRef​erence("/rest/thing/​" + id);
                 thingResource.readThing(id, new Result<ThingItem>() {
                    //...
                 };


However readThing method the Long id is always null, when is called,
what could be the problem?

« Previous message in topic | 1 of 3 | Next message in topic »

Messages

Show all messages in topic

CRUD Operation for Calling ServerResouce with ClientProxy xybrek Xybrek 2015-01-13 16:45:20 PST
     RE: CRUD Operation for Calling ServerResouce with ClientProxy thboileau Thierry Boileau 2015-01-16 02:20:04 PST
         Re: CRUD Operation for Calling ServerResouce with ClientProxy tpeierls Tim Peierls 2015-01-16 03:46:25 PST
Messages per page: