FormatFilter FormatFilter FormatFilter 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
public class FormatFilter : Microsoft.AspNetCore.Mvc.Filters.IResourceFilter, Microsoft.AspNetCore.Mvc.Filters.IResultFilter
type FormatFilter = class
    interface IFilterMetadata
    interface IResourceFilter
    interface IResultFilter
Public Class FormatFilter
Implements IResourceFilter, IResultFilter
Inheritance
FormatFilterFormatFilterFormatFilterFormatFilter
Implements

Constructors

FormatFilter(IOptions<MvcOptions>) FormatFilter(IOptions<MvcOptions>) FormatFilter(IOptions<MvcOptions>) FormatFilter(IOptions<MvcOptions>)

Initializes an instance of FormatFilter.

FormatFilter(IOptions<MvcOptions>, ILoggerFactory) FormatFilter(IOptions<MvcOptions>, ILoggerFactory) FormatFilter(IOptions<MvcOptions>, ILoggerFactory) FormatFilter(IOptions<MvcOptions>, ILoggerFactory)

Initializes an instance of FormatFilter.

Methods

GetFormat(ActionContext) GetFormat(ActionContext) GetFormat(ActionContext) GetFormat(ActionContext)
OnResourceExecuted(ResourceExecutedContext) OnResourceExecuted(ResourceExecutedContext) OnResourceExecuted(ResourceExecutedContext) OnResourceExecuted(ResourceExecutedContext)
OnResourceExecuting(ResourceExecutingContext) OnResourceExecuting(ResourceExecutingContext) OnResourceExecuting(ResourceExecutingContext) 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) OnResultExecuted(ResultExecutedContext) OnResultExecuted(ResultExecutedContext) OnResultExecuted(ResultExecutedContext)
OnResultExecuting(ResultExecutingContext) OnResultExecuting(ResultExecutingContext) OnResultExecuting(ResultExecutingContext) OnResultExecuting(ResultExecutingContext)

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

Applies to