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=4447&dsMessageId=2374334


RE: beginner question about Resource

2009-07-21 Thread Jerome Louvel
Hi Laurent,

Which version of Restlet 2.0 are you using? If it is Restlet 2.0 M3, it has
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.

Best regards,
Jerome Louvel
--
Restlet ~ Founder and Lead developer ~ http://www.restlet.org
Noelios Technologies ~ Co-founder ~ http://www.noelios.com




-Message d'origine-
De : Laurent Rustuel [mailto:laurent.rust...@genesyslab.com] 
Envoyé : vendredi 17 juillet 2009 14:24
À : discuss@restlet.tigris.org
Objet : beginner question about Resource

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=4447&dsMessageId=23720
44

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


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=4447&dsMessageId=2372044