Content negotiation

Content negotiation
HTTP
Persistence · Compression · HTTPS
Request methods
OPTIONS · GET · HEAD · POST · PUT · DELETE · TRACE · CONNECT
Header fields
Cookie · ETag · Location · Referer
DNT · X-Forwarded-For
Status codes
301 Moved permanently
302 Found
303 See Other
403 Forbidden
404 Not Found
This box: view · talk · edit

Content negotiation is a mechanism defined in the HTTP specification that makes it possible to serve different versions of a document (or more generally, a resource representation) at the same URI, so that user agents can specify which version fit their capabilities the best. One classical use of this mechanism is to serve an image in GIF or PNG format, so that a browser that cannot display PNG images (e.g. MS Internet Explorer 4) will be served the GIF version. To summarize how this works, when a user agent submits a request to a server, the user agent informs the server what media types it understands with ratings of how well it understands them. More precisely, the user agent provides an Accept HTTP header that lists acceptable media types and associated quality factors. The server is then able to supply the version of the resource that best fits the user agent's needs.

So, a resource may be available in several different representations. For example, it might be available in different languages or different media types, or a combination. One way of selecting the most appropriate choice is to give the user an index page, and let them select. However it is often possible for the server to choose automatically. This works because browsers can send information as part of each request about the representations they prefer. For example, a browser could indicate that it would like to see information in German, if possible, else English will do. Browsers indicate their preferences by headers in the request. To request only German representations, the browser would send:

Accept-Language: de

Note that this preference will only be applied when there is a choice of representations and they vary by language.

As an example of a more complex request, this browser has been configured to accept German and English, but prefer German, and to accept various media types, preferring HTML over plain text or other text types, and preferring GIF or JPEG over other media types, but also allowing any other media type as a last resort:

Accept-Language: de; q=1.0, en; q=0.5
         Accept: text/html; q=1.0, text/*; q=0.8, image/gif; q=0.6, image/jpeg; q=0.6, image/*; q=0.5, */*; q=0.1

See also

External links

References

  • This article is based in part on this page, which is copyrighted by the Apache Foundation but released under a free license.

Wikimedia Foundation. 2010.

Игры ⚽ Поможем сделать НИР

Look at other dictionaries:

  • Content Negotiation — La négociation de contenu est un processus défini dans la spécification HTTP qui permet de fournir différentes versions d un document électronique (ou plus généralement, une ressource informatique) à la même URL. La négociation de contenu est… …   Wikipédia en Français

  • Content Negotiation — Unter Content Negotiation (Inhaltsvereinbarung[1]) versteht man eine Technik im Hypertext Transfer Protocol, die eine Abstimmung der Inhalte der angefragten Ressource aufgrund der Möglichkeiten und Vorzüge des Clients ermöglicht.… …   Deutsch Wikipedia

  • Content-based instruction — (CBI) is a significant approach in second language acquisition (Brinton, Snow, Wesche, 1989). CBI is designed to provide second language learners instruction in content and language. Historically, the word content has changed its meaning in… …   Wikipedia

  • Face Negotiation Theory — is a theory first postulated by Stella Ting Toomey in 1985 to explain how different cultures manage conflict and communicate. The theory has gone through multiple iterations since that time, and has been updated most recently in 2005.1 In essence …   Wikipedia

  • Bit (content company) — Infobox Company company name = bit company company type = Limited foundation = 2004 country = Israel location = Giv atayim, Israel key people = Guy Behar CO, CEO, Amir Golan CO, CEO homepage = [http://www.bit i.co.il/ www.bit i.co.il] bit is a… …   Wikipedia

  • Négociation du contenu — Content Negotiation La négociation de contenu est un processus défini dans la spécification HTTP qui permet de fournir différentes versions d un document électronique (ou plus généralement, une ressource informatique) à la même URL. La… …   Wikipédia en Français

  • Liste der HTTP-Headerfelder — HTTP Header bzw. HTTP Header Felder (oft synonym genutzt; HTTP Header besitzt allerdings die Mehrdeutigkeit zwischen einem einzelnen Feld des Headerblocks und dem ganzen Headerblock. Hier wird für die Gesamtheit der Headerfelder der Begriff… …   Deutsch Wikipedia

  • HTTP — Название: Hypertext Transfer Protocol Уровень (по модели OSI): Прикладной Семейство: TCP/IP Создан в: 1992 г. Порт/ID: 80/TCP Спецификация …   Википедия

  • Протокол передачи гипертекста — HTTP Название: Hypertext Transfer Protocol Уровень (по модели OSI): Прикладной Семейство: TCP/IP Создан в: 1990 г. Порт/ID: 80/TCP Назначение протокола: Доступ к гипертексту, ныне стал универсальным Спецификация: RFC 1945 …   Википедия

  • Negociation de contenu — Négociation de contenu La Négociation de contenu est un mécanisme défini dans la spécification HTTP qui rend possible de servir différentes versions d un document (ou plus généralement, une resource) à la même URL, ainsi les User Agent peuvent… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”