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

Reply via email to