Skip to Content
RESTful Web Services Cookbook
book

RESTful Web Services Cookbook

by Subbu Allamaraju
March 2010
Intermediate to advanced
312 pages
7h 31m
English
O'Reilly Media, Inc.
Content preview from RESTful Web Services Cookbook

Chapter 7. Content Negotiation

Content negotiation, or conneg as it is sometimes called, is the process of selecting the best representation of a resource for a client when there are multiple representations (or variants) available. Although content negotiation is often associated with the practice of indicating media type preferences, content negotiation is also used to indicate preferences for localizing by language, character encoding, and compression.

HTTP specifies two types of content negotiation. These are server-driven negotiation and agent-driven negotiation. Server-driven negotiation uses request headers to select a variant, and agent-driven negotiation uses a distinct URI for each variant.

This chapter discusses the following recipes that deal with content negotiation:

Recipe 7.1

Use this recipe to decide which Accept-* headers to include when requesting a resource and with what values.

Recipe 7.2

Use this recipe to learn how to implement servers that correctly interpret the Accept request header for media type negotiation.

Recipe 7.3

Use this recipe to learn how to implement language negotiation using the Accept-Language header.

Recipe 7.4

Use this recipe to learn how to determine the requested character encoding for a representation.

Recipe 7.5

HTTP allows clients to indicate their preference for compressed representations via the Accept-Encoding request header. Use this recipe to decide how to process this header on the server.

Recipe 7.6

Use this recipe to learn how to use the ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

RESTful Web Services

RESTful Web Services

Leonard Richardson, Sam Ruby
RESTful Web Clients

RESTful Web Clients

Mike Amundsen

Publisher Resources

ISBN: 9780596809140Errata Page