As a reaction to the latest experimental proposal for supporting hypermedia in Jersey, Markus chimed in, saying:
If you want to gain all the benefits of REST, you need to apply all four constraints but not just three of them.
I whole-heartedly agree with that.
However, I disagree with his analysis that only the response body (and not the headers) carries the hypermedia that represents the next application state. From a hypermedia constraint point of view it is irrelevant whether the hypermedia controls (that is links, link templates or forms) are placed inside the body or inside the HTTP headers.
Placing the controls into the HTTP header can, for example, be a viable solution when you want to (or have to) use existing document formats for the body that do not provide the ability to place the controls in the body.
My blog entry was about the dissertation, not about my opinion of usefulness. In fact, it is Fielding’s dissertation that mandates that the state change links must be taken from the hypermedia. But frankly spoken, when thinking Fielding’s idea to the end, I must agree with him, that it is always the correct solution: If your client is unable to get the links out of the document itself, the obviously the document format is either an improper choice for use in a hypermedia context (which REST is about), or the client seems to be badly coded (it seems to be Accept:-ing a data format that it actually cannot interpret correctly). See, if your browser is unable to understand links in PDFs, then it should not send Accept: text/pdf, obviously. No need to tweak around that by putting the links in the header — fix it! ;-)
Markus,
see your point and its a good one. Out of interest: can you quote the part of the dissertation that you refer to?
What you sometimes run into with regard to in-header vs. in-document is what happens when you store the document without it’s response context. While the media type remains detectable (given proper rules/suffixes) headers are lost. I have had occasions where people wanted to put links in the document, too for that very reason.
Jan
[...] and HATEOAS mean and the importance of embracing all four REST constraints. (by Markus Jarg) Markus Karg on the Hypermedia Constraint – A response to the previous article concerning the placement of hypermedia data. (By Jan [...]
In terms of HTTP, headers can be used for hypermedia purposes, since they’re a part of the representation – that’s what Link headers are for