FormatFilter Class

Definition

A filter that will use the format value in the route data or query string to set the content type on an ObjectResult returned from an action.

public ref class FormatFilter : Microsoft::AspNetCore::Mvc::Filters::IResourceFilter, Microsoft::AspNetCore::Mvc::Filters::IResultFilter, Microsoft::AspNetCore::Mvc::Formatters::Internal::IFormatFilter
public ref class FormatFilter : Microsoft::AspNetCore::Mvc::Filters::IResourceFilter, Microsoft::AspNetCore::Mvc::Filters::IResultFilter
public class FormatFilter : Microsoft.AspNetCore.Mvc.Filters.IResourceFilter, Microsoft.AspNetCore.Mvc.Filters.IResultFilter, Microsoft.AspNetCore.Mvc.Formatters.Internal.IFormatFilter
public class FormatFilter : Microsoft.AspNetCore.Mvc.Filters.IResourceFilter, Microsoft.AspNetCore.Mvc.Filters.IResultFilter
type FormatFilter = class
    interface IFormatFilter
    interface IFilterMetadata
    interface IResourceFilter
    interface IResultFilter
type FormatFilter = class
    interface IFilterMetadata
    interface IResourceFilter
    interface IResultFilter
Public Class FormatFilter
Implements IFormatFilter, IResourceFilter, IResultFilter
Public Class FormatFilter
Implements IResourceFilter, IResultFilter
Inheritance
FormatFilter
Implements
IFilterMetadata IResourceFilter IResultFilter Microsoft.AspNetCore.Mvc.Formatters.Internal.IFormatFilter

Constructors

FormatFilter(IOptions<MvcOptions>)
Obsolete.

Initializes an instance of FormatFilter.

FormatFilter(IOptions<MvcOptions>, ILoggerFactory)

Initializes an instance of FormatFilter.

Methods

GetFormat(ActionContext) Microsoft.AspNetCore.Mvc.Formatters.Internal.IFormatFilter.GetFormat(Microsoft.AspNetCore.Mvc.ActionContext)
OnResourceExecuted(ResourceExecutedContext)

Executes the resource filter. Called after execution of the remainder of the pipeline.

OnResourceExecuting(ResourceExecutingContext)

As a IResourceFilter, this filter looks at the request and rejects it before going ahead if

  1. The format in the request does not match any format in the map.
  2. If there is a conflicting producesFilter.
OnResultExecuted(ResultExecutedContext)

Called after the action result executes.

OnResultExecuting(ResultExecutingContext)

Sets a Content Type on an ObjectResult using a format value from the request.

Applies to