Method | Description | |
---|---|---|
DefaultContentNegotiator ( ) : System | ||
DefaultContentNegotiator ( bool excludeMatchOnTypeOnly ) : System |
Initializes a new instance of the DefaultContentNegotiator with the given setting for excludeMatchOnTypeOnly.
|
|
Negotiate ( |
Performs content negotiating by selecting the most appropriate MediaTypeFormatter out of the passed in formatters for the given request that can serialize an object of the given type.
|
Method | Description | |
---|---|---|
ComputeFormatterMatches ( |
Determine how well each formatter matches by associating a MediaTypeFormatterMatchRanking value with the formatter. Then associate the quality of the match based on q-factors and other parameters. The result of this method is a collection of the matches found categorized and assigned a quality value.
|
|
MatchAcceptHeader ( IEnumerable |
Match the request accept header field values against the formatter's registered supported media types.
|
|
MatchMediaTypeMapping ( |
Match a request against the MediaTypeMappings registered with the formatter.
|
|
MatchRequestMediaType ( |
Match any request media type (in case there is a request entity body) against the formatter's registered media types.
|
|
MatchType ( |
Pick the first supported media type and indicate we've matched only on type If ExcludeMatchOnTypeOnly is true then we don't match on type only which means that we return null if we can't match on anything in the request. This is useful for generating 406 (Not Acceptable) status codes.
|
|
SelectResponseCharacterEncoding ( |
Determine the best character encoding for writing the response. First we look for accept-charset headers and if not found then we try to match any charset encoding in the request (in case of PUT, POST, etc.) If no encoding is found then we use the default for the formatter.
|
|
SelectResponseMediaTypeFormatter ( ICollection |
Select the best match among the candidate matches found.
|
|
SortMediaTypeWithQualityHeaderValuesByQFactor ( ICollection |
Sort Accept header values and related header field values with similar syntax rules (if more than 1) in descending order based on q-factor.
|
|
SortStringWithQualityHeaderValuesByQFactor ( ICollection |
Sort Accept-Charset, Accept-Encoding, Accept-Language and related header field values with similar syntax rules (if more than 1) in descending order based on q-factor.
|
|
UpdateBestMatch ( |
Evaluates whether a match is better than the current match and if so returns the replacement; otherwise returns the current match.
|
protected ComputeFormatterMatches ( |
||
type | The type to be serialized. | |
request | The request. | |
formatters | IEnumerable |
The set of |
return | Collection |
public DefaultContentNegotiator ( bool excludeMatchOnTypeOnly ) : System | ||
excludeMatchOnTypeOnly | bool | /// If ExcludeMatchOnTypeOnly is true then we don't match on type only which means /// that we return null if we can't match on anything in the request. This is useful /// for generating 406 (Not Acceptable) status codes. /// |
return | System |
protected MatchAcceptHeader ( IEnumerable |
||
sortedAcceptValues | IEnumerable |
The sorted accept header values to match. |
formatter | The formatter to match against. | |
return |
protected MatchMediaTypeMapping ( |
||
request | The request to match. | |
formatter | The formatter to match against. | |
return |
protected MatchRequestMediaType ( |
||
request | The request to match. | |
formatter | The formatter to match against. | |
return |
protected MatchType ( |
||
type | The type to be serialized. | |
formatter | The formatter we are matching against. | |
return |
public Negotiate ( |
||
type | The type to be serialized. | |
request | The request. | |
formatters | IEnumerable |
The set of |
return |
protected SelectResponseCharacterEncoding ( |
||
request | ||
formatter | ||
return |
protected SelectResponseMediaTypeFormatter ( ICollection |
||
matches | ICollection |
The collection of matches. |
return |
protected SortMediaTypeWithQualityHeaderValuesByQFactor ( ICollection |
||
headerValues | ICollection |
The header values to sort. |
return | IEnumerable |
protected SortStringWithQualityHeaderValuesByQFactor ( ICollection |
||
headerValues | ICollection |
The header values to sort. |
return | IEnumerable |
protected UpdateBestMatch ( |
||
current | ||
potentialReplacement | ||
return |