On Mon, Jan 16, 2012 at 12:58 PM, martin <[email protected]> wrote:

> Thanks for the suggestion, I'll read more on using annotations or not.
>

If you want automatic conversion, you will almost certainly want to use
annotations, so you can write

// In the AccountsResource interface:
    @Get AccountList accounts();

and

// In AccountsServerResource extends ServerResource implements
AccountsResource:
    @Override public AccountList accounts() { ... }

and

// In client code:
    AccountsResource accountsResource =
ClientResource.create("/path/to/accounts", AccountsResource.class);
    AccountList accounts = accountsResource.accounts(); // transparently
serializes/deserializes response

where

public class AccountList {
    private final List<String> accounts;

    public List<String> getAccounts() { return accounts; }

    ... standard bean impl ...
}


Can you suggest the name of a converter helper implementation that would
> deal with serialization of Collections?
>

Yes. The Restlet extension for Jackson is ideal for this -- it uses JSON as
its serialization format. See this conversation if you end up using it:

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

That explains why you might have to use an AccountList type rather than
List<String>. Another conversation that might be useful:

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

Good luck!

--tim

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

Reply via email to