Hello,

Basically, this is as simple as replacing the type "Contact" by another type.

On server side, create a ContactsResource interface that with this annotated 
method:
    @Get
    public ArrayList<Contact> retrieve();

It should be better with this return type: List<Contact>, but the converter 
will fail as "List" does not implements the "Serializable" interface.

Then implements this interface with a subclass of ServerResource and attach it 
to your application, as usual.

Then, on GWT client side, create the corresponding proxy interface then wrap 
this interface and let the proxy retrieve the list of contacts:

ContactsResourceProxy contactsResource = 
GWT.create(ContactsResourceProxy.class);

// Set up the contacts resource
contactsResource.getClientResource().setReference("/contacts");
contactsResource.getClientResource().getClientInfo().getAcceptedMediaTypes().add(new
Preference<MediaType>(MediaType.APPLICATION_JAVA_OBJECT_GWT));

// Retrieve the list of contacts
contactsResource.retrieve(new Result<ArrayList<Contact>>() {
    public void onFailure(Throwable caught) {
        // Handle the error
    }

    public void onSuccess(ArrayList<Contact> contacts) {
// handle the list.
});

I think it should also work with an array of contacts.

Best regards,
Thierry Boileau

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

Reply via email to