DefaultFormatHelper Class
Represents the default implementation of FormatHelper The results for GetRequestFormat() and GetResponseFormats() are cached on the HttpContext.Items dictionary: HttpContext.Items["requestFormat"] HttpContext.Items["responseFormat"].
Namespace: Microsoft.Web.Mvc.Resources
Assembly: Microsoft.Web.Mvc (in Microsoft.Web.Mvc.dll)
Inheritance Hierarchy
System.Object
Microsoft.Web.Mvc.Resources.FormatHelper
Microsoft.Web.Mvc.Resources.DefaultFormatHelper
Syntax
public class DefaultFormatHelper : FormatHelper
public ref class DefaultFormatHelper : FormatHelper
type DefaultFormatHelper =
class
inherit FormatHelper
end
Public Class DefaultFormatHelper
Inherits FormatHelper
Constructors
Name | Description | |
---|---|---|
DefaultFormatHelper() | Initializes a new instance of the DefaultFormatHelper class. |
Methods
Name | Description | |
---|---|---|
Equals(Object) | (Inherited from Object.) |
|
Finalize() | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetRequestFormat(RequestContext) | Returns the format of a given request, according to the following rules: 1. If a Content-Type header exists it returns a ContentType for it or fails if one can't be created 2. Otherwise, if a Content-Type header does not exists it provides the default ContentType of "application/octet-stream" (per RFC 2616 7.2.1).(Overrides FormatHelper.GetRequestFormat(RequestContext).) |
|
GetResponseFormats(RequestContext) | Returns the preferred content type to use for the response, based on the request, according to the following rules: 1. If the RouteData contains a value for a key called "format", its value is returned as the content type 2. Otherwise, if the query string contains a key called "format", its value is returned as the content type 3. Otherwise, if the request has an Accepts header, the list of content types in order of preference is returned 4. Otherwise, if the request has a content type, its value is returned (Overrides FormatHelper.GetResponseFormats(RequestContext).) |
|
GetType() | (Inherited from Object.) |
|
IsBrowserRequest(RequestContext) | Determines whether the specified HTTP request was sent by a Browser.(Overrides FormatHelper.IsBrowserRequest(RequestContext).) |
|
MemberwiseClone() | (Inherited from Object.) |
|
ToString() | (Inherited from Object.) |
Fields
Name | Description | |
---|---|---|
RequestFormatKey | Represents the request format key. |
|
ResponseFormatKey | Represents the response format key. |
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also
Microsoft.Web.Mvc.Resources Namespace
Return to top