WebApiContrib/WebAPIContrib — pull request #50 by tugberkugurlu (2012-04-07 18:47:32+00:00)
Title: added RouteDataMapping MediaTypeMapping

Implemented `RouteDataMapping` `MediaTypeMapping`.

Sample usage:

Add a route which satisfy our needs:

GlobalConfiguration.Configuration.Routes.MapHttpRoute(
"defaultHttpRoute",
routeTemplate: "api/{controller}.{extension}",
defaults: new { },
constraints: new { extension = "json|xml" }
);

Add the `RouteDataMapping` instance to formatters:

GlobalConfiguration.Configuration.Formatters.JsonFormatter.
MediaTypeMappings.Add(
new RouteDataMapping(
"extension", "json", "application/json"
)
);

GlobalConfiguration.Configuration.Formatters.XmlFormatter.
MediaTypeMappings.Add(
new RouteDataMapping(
"extension", "xml", "application/xml"
)
);

For more information on `RouteDataMapping`:

[ASP.NET Web API Custom RouteDataMapping (MediaTypeMapping)](http://www.tugberkugurlu.com/archive/asp-net-web-api-custom-routedatamapping-mediatypemapping)