문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top