Category: 

What is Content Negotiation?

Article Details
  • Written By: S.A. Keel
  • Edited By: Lauren Fritsky
  • Last Modified Date: 30 August 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
People tend to blink less frequently when they are lying; they blink faster than normal after the lie.  more...

September 24 ,  1996 :  Major nuclear powers around the world signed the Comprehensive Nuclear-Test-Ban Treaty.  more...

Content negotiation is a technique described in the hyptertext transfer protocol (HTTP) specification that allows a remote client to make a more specific request of a web server. The method gives the server the ability to host multiple types of files, documents in different languages, and more, each with varying quality levels. These separate selections are hosted as a single reference, denoted by its uniform resource identifier (URI), and are meant to provide more applicable content when it's available on the server.

Where a uniform resource locator (URL) is a reference to a file in a specific location, such as within a folder on the server, a URI can reference anything, virtually anywhere. The specifics of the URI, such as the location of the file to be delivered, the name of the file, and its type, are worked out after the content is negotiated. This allows for the various pieces of content to sit in different locations, such as all of the files for a certain language organized under that language's folder on the server.

The idea behind content negotiation is for the web server to deliver the best possible content for any given user agent or web browser. It can deliver certain image file types or other content to clients that are capable of supporting them. This is useful when hosting multiple versions of a file to support multiple browsing platforms, such as mobile devices.

Ad

To do all this, the HTTP describes two methods of content negotiation, as well as suggests the ability to combine the two. One method is server-driven negotiation. With this method, the server makes the best possible decision on what to deliver, based on whatever logic it is given, and what content is available. .

There are some difficulties with server-driven content negotiation, however. The server doesn't know how to respond to every possible request, so it has to make guesses based on the logic it was given for making those decisions. It cannot know whether the web browser is running on a mobile device, or if the requested document is intended to be sent directly to a printer unless it is told. There are also privacy issues, in that the server-driven method expects the request to send it information about the user making the request.

The second method is known as agent-driven content negotiation. Here, the user makes a request of the server, and the server sends back a list of available alternatives, if any exist. The selection is either made automatically, based on available browser or platform preferences, or manually in the form of options presented in the HTML. The primary drawback to the agent-driven option is the multiple requests to the server for the best possible content. When a proxy server is caching requests to a server that is using agent-driven negotiation, however, it will be able to deliver the appropriate content to any users behind the proxy through a single request to the cache.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email