Suppose I have a resource with multiple representations
@Get("json") Representation getJsonRepresentation();
@Get("xml") Representation getXmlRepresentation();
When I issue a Get request, restlet seems to route to the method correct method
using the Accept headder! The client says I want Xml returned and thats what he
gets!
In the case of a Post, routing is dictated by Content-Type (i.e. the type of
content being posted)
So:
Content-Type: application/xml -> @Post("xml")
Content-Type: application/json -> @Post("json")
Now, suppose I wanted to post xml content to a resource and have a json
representation returned?
Request:
POST /blah/myResource HTTP/1.1
Accept: "application/json"
Content-Type: "application/xml"
Rather than doing some if/switch within my @Post("xml") method, would it be
nicer if I could annotate post methods as follows, with a separate content-type
and accept type:
@Post(value="xml", return="json") Represntation
handleXmlAndReturnJson(Represnetation rep);
@Post(value="xml", return="xml") Represntation
handleXmlAndReturnXml(Represnetation rep); //This would be the default
behaviour if no 2nd attribute was specified i.e. same as @Post("xml")
Just wondering what other think...(I haven't looked at the http spec)
cheers
Conor
------------------------------------------------------
http://restlet.tigris.org/ds/viewMessage.do?dsForumId=4447&dsMessageId=2583447