Re: beginner question about Resource

2009-07-22 Thread Laurent Rustuel
Hello Jérôme,
Jerome Louvel a écrit :
 Which version of Restlet 2.0 are you using? If it is Restlet 2.0 M3, it has
Yes, it is Restlet 2.0 M3.
 a few annoying issues in this exact area. In this case, I suggest upgrading
 to a recent snapshot (unstable release) until we release 2.0 M4 later this
 month.
I will try using a snapshot soon, and see if it's working. Thanks for 
your reply.

Regards,
Laurent.

-- 
Laurent Rustuel,
Alten contractor for Genesys, an Alcatel-Lucent Company

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


beginner question about Resource

2009-07-17 Thread Laurent Rustuel
Hello,
I'm new to rest and restlet, and I'm a trying to make a demo/sample to 
help management to choose between rest framework.
I have read restlet faq and wiki to find some info, and it has been a 
great help, but now I'm stuck with a problem for a beginner.
I need to handle several GET and POST in a /ServerResource/ child class.

I have declared variants in /doInit/ method, such as 
TEXT_HTML,TEXT_PLAIN,APPLICATION_JSON.
I have method returning a /Representation/ with annoted GET such as :
@Get(json) public Representation toJson() {}
@Get(html) public Representation toHtml() {}
@Get(text) public Representation toText() {}

and I have also a method
@Override public Representation get(Variant variant)

where I build a representation suitable for the specified variant 
MediaType (using variant.getMediaType() )

When I test, using cURL or a junit test case :
If a specify in my /Request/ object (or in cURL using  -H Accept: 
text/html) a MediaType.TEXT_HTML,
this is handle through /get(Variant)/ method.
If the MediaType is APPLICATION_JSON, this go through /toHtml()/ method.

What am I doing wrong ? any clue ?

Thanks,
Laurent.
-- 
Laurent Rustuel,
Alten contractor for Genesys, an Alcatel-Lucent Company

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