views:

291

answers:

1

Restlet's (2.0M6 on Google App Engine) annotations are actually sensible to the order of a resource's methods. When posting html form data, make sure that the @Post("html") method stays above the @Post("xml") method in the receiving resource. At least Firefox puts both content types into the request's Accept header, so the first matching method will be processed.

The question is, if there is any other way to achieve control over method precedence?

For example I would like the client to accept text/html only.

+1  A: 

As per your comment that you're asking whether there is some kind of client-side html form attribute or JavaScript to modify the accept header, the answer would be, AFAIK: no. Not for links clicked or forms submitted by the user. As you mentioned in your comment, you might be able to use JS to intercept link clicks and form posts, and use XHR instead, but that'd probably be tricky, if possible.

BTW, XmlHttpRequest doesn't really have anything to do with XML. It can handle any sort of content, for both requests and responses. It's very common to return a snippet of HTML to a XHR request and use DOM injection to dynamically update the page.

Avi Flax