Table of Contents

ConfigurableResponseNegotiator<TOptions> Class

Definition

Provides an abstract, configurable base class for Carter response negotiators that serialize models using a StreamFormatter<TOptions>.

public abstract class ConfigurableResponseNegotiator<TOptions> : Configurable<TOptions>, IConfigurable<TOptions>, IResponseNegotiator where TOptions : class, IExceptionDescriptorOptions, IContentNegotiation, IValidatableParameterObject, new()

Type Parameters

TOptions

The type of the configured options.

Inheritance
Configurable<TOptions>
ConfigurableResponseNegotiator<TOptions>
Implements
IConfigurable<TOptions>
Derived
Inherited Members

Constructors

Name Description
ConfigurableResponseNegotiator(TOptions)

Initializes a new instance of the ConfigurableResponseNegotiator<TOptions> class.

Properties

Name Description
ContentType

Gets the matched content type determined by the most recent successful call to CanHandle(MediaTypeHeaderValue).

Methods

Name Description
CanHandle(MediaTypeHeaderValue)

Determines whether this negotiator can handle the specified accept media type.

GetDefaultEncoding()

When overridden in a derived class, returns the default character encoding for this negotiator. This encoding is used as the fallback by GetEncoding(HttpRequest) when the HTTP request does not specify a resolvable Accept-Charset preference.

GetEncoding(HttpRequest)

Resolves the character encoding for the HTTP response by inspecting the Accept-Charset header of the request, falling back to GetDefaultEncoding() when no valid charset is indicated.

GetFormatter()

When overridden in a derived class, returns the StreamFormatter<TOptions> used to serialize the response model.

Handle<T>(HttpRequest, HttpResponse, T, CancellationToken)

Serializes the specified model and writes it to the HTTP response body.

See Also