UserPreferences

ContentNegotiation


ContentNegotiation is a feature of HTTP used to supply the user with the "best available" entity corresponding to their request.

ContentNegotiation is also often used to provide alternate representations of an entity depending on how a user agent may wish to process the entity, such as a plain text, XML, or HTML representation.

ContentNegotiation is implemented solely between the agent and the server and is not directly related to the URI used to reference the entity. A URI may refer to only one type of representation, in which case no negotiation is possible, or it may refer to a resource that has multiple representations, in which case the agent must request the specific, or a preference for, which representations it desires.

Generally speaking, the "preferred" representation of a URI is not passed along with the URI when the URI is communicated to other systems (via inter-process communication or file formats). This leads to the most critical issue with using ContentNegotiation for providing different representations of an entity: the representation you want a tool to work with may not be the preferred representation that tool negotiates for.

In Pie/Echo/Atom, the clearest example of this is between the human readable entry in the context and style of the publisher's site, likely HTML or XHTML, and the Atom XML representation of the entry as in EchoExample.

A browser will most likely negotiate for HTML and/or XHTML or accept that as the default. An aggregator will most likely negotiate for the Atom XML format. On the other hand, if you pass the URI of the entry to the most other tools (such as validators, XSLT, metadata parsers), they will accept the default representation which will likely be the X/HTML representation, not the Atom XML format representation.

Links


Original Author: KenMacLeod

CategoryArchitecture, CategoryApi