public JsonV1OutputFormatter(JsonSerializerSettings serializerSettings, ArrayPool <char> charPool) : base(serializerSettings, charPool) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypes.JsonV1)); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypes.Problem)); }
/// <summary> /// Create a new ExcelMediaTypeFormatter. /// </summary> /// <param name="autoFit">True if the formatter should autofit columns after writing the data. (Default /// true.)</param> /// <param name="autoFilter">True if an autofilter should be applied to the worksheet. (Default false.)</param> /// <param name="freezeHeader">True if the header row should be frozen. (Default false.)</param> /// <param name="headerHeight">Height of the header row.</param> /// <param name="cellHeight">Height of each row of data.</param> /// <param name="cellStyle">An action method that modifies the worksheet cell style.</param> /// <param name="headerStyle">An action method that modifies the cell style of the first (header) row in the /// worksheet.</param> public XlsxMediaTypeFormatter(bool autoFit = true, bool autoFilter = false, bool freezeHeader = false, double?headerHeight = null, Action <ExcelStyle> cellStyle = null, Action <ExcelStyle> headerStyle = null) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.ms-excel")); AutoFit = autoFit; AutoFilter = autoFilter; FreezeHeader = freezeHeader; HeaderHeight = headerHeight; CellStyle = cellStyle; HeaderStyle = headerStyle; // Initialise serialisers. Serialisers = new List <IXlsxSerialiser> { new ExpandoSerialiser(), new SimpleTypeXlsxSerialiser() }; DefaultSerializer = new DefaultXlsxSerialiser(); }
public HalFormatter(JsonSerializerSettings settings, ArrayPool <char> charPool) : base(settings, charPool) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(InternetMediaTypes.HalJson)); SupportedEncodings.Add(Encoding.UTF8); SupportedEncodings.Add(Encoding.Unicode); }
/// <summary> /// Initializes a new instance of the <see cref="PascalCaseJsonProfileFormatter"/> class. /// </summary> public PascalCaseJsonProfileFormatter() : base(JsonDefaults.PascalCaseOptions) { SupportedMediaTypes.Clear(); // Add application/json for default formatter SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(MediaTypeNames.Application.Json)); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(JsonDefaults.PascalCaseMediaType)); }
public GZippedJsonInputFormatter() { SupportedMediaTypes.Clear(); // Add the supported media type. SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("gzip/json")); }
/// <summary> /// Initializes a new instance of <see cref="HalJsonOutputFormatter"/> /// </summary> /// <param name="serializerOptions"><see cref="JsonSerializerOptions"/></param> public HalJsonOutputFormatter(JsonSerializerOptions serializerOptions) : base(serializerOptions) { SupportedEncodings.Add(Encoding.UTF8); SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/hal+json")); }
public CollectionJsonMediaTypeFormatter(ICollectionSettings <T> collectionSettings, MappingEngine mappingEngine) { _collectionSettings = collectionSettings; _mappingEngine = mappingEngine; SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.collection+json")); }
public JsonApiOutputFormatter(JsonSerializerSettings serializerSettings, ArrayPool <char> charPool) : base(serializerSettings, charPool) { SupportedMediaTypes.Clear(); SupportedEncodings.Add(Encoding.UTF8); SupportedMediaTypes.Add(MediaTypeHeaderValues.ApplicationSiren); }
public LineItemFormatter() { // Accept LineItem and LineItemResults JSON-LD SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue(LtiConstants.LineItemMediaType)); SupportedMediaTypes.Add(new MediaTypeHeaderValue(LtiConstants.LineItemResultsMediaType)); }
public JsonApiOutputFormatter(JsonSerializerOptions options) : base(options) { const string jsonApiMediaTypeName = "application/vnd.api+json"; SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue(jsonApiMediaTypeName)); }
/// <summary> /// Create a new ExcelMediaTypeFormatter. /// </summary> /// <param name="autoFit">True if the formatter should autofit columns after writing the data. (Default /// true.)</param> /// <param name="autoFilter">True if an autofilter should be applied to the worksheet. (Default false.)</param> /// <param name="freezeHeader">True if the header row should be frozen. (Default false.)</param> /// <param name="headerHeight">Height of the header row.</param> /// <param name="cellHeight">Height of each row of data.</param> /// <param name="cellStyle">An action method that modifies the worksheet cell style.</param> /// <param name="headerStyle">An action method that modifies the cell style of the first (header) row in the /// worksheet.</param> public XlsxMediaTypeFormatter( IHttpContextAccessor httpContextAccessor, IModelMetadataProvider modelMetadataProvider, bool autoFit = true, bool autoFilter = false, bool freezeHeader = false, double?headerHeight = null, Action <ExcelStyle> cellStyle = null, Action <ExcelStyle> headerStyle = null, SerializerType serializerType = SerializerType.Default, bool isExportJsonToXls = false, string fileExtension = null ) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/vnd.ms-excel")); AutoFit = autoFit; AutoFilter = autoFilter; FreezeHeader = freezeHeader; HeaderHeight = headerHeight; CellStyle = cellStyle; HeaderStyle = headerStyle; _serializerType = serializerType; _isExportJsonToXls = isExportJsonToXls; _fileExtension = fileExtension; _httpContextAccessor = httpContextAccessor; }
/// <summary> /// Initializes a new instance of the <see cref="PascalCaseJsonProfileFormatter"/> class. /// </summary> public PascalCaseJsonProfileFormatter() : base(JsonDefaults.GetPascalCaseOptions()) { SupportedMediaTypes.Clear(); // Add application/json for default formatter SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json")); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"PascalCase\"")); }
public JsonPatchInputFormatter() { // Clear all values and only include json-patch+json value. SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json-patch+json")); }
public ProtobufJsonInputFormatter() { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json")); SupportedEncodings.Add(Encoding.UTF8); SupportedEncodings.Add(Encoding.Unicode); }
public PascalCaseJsonProfileFormatter() : base(new JsonSerializerSettings { ContractResolver = new DefaultContractResolver() }, ArrayPool <char> .Shared) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"https://en.wikipedia.org/wiki/PascalCase\"")); }
public XmlInputFormatter(XmlPrefix xmlPrefix, TypeRepository typeCollections) { this.xmlPrefix = xmlPrefix; this.typeCollections = typeCollections; SupportedMediaTypes.Clear(); SupportedEncodings.Clear(); }
public CamelCaseJsonFormatter() : base( new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(), }, ArrayPool <char> .Shared) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json;profile=\"https://en.wikipedia.org/wiki/Camel_case\"")); }
/// <summary> /// Initializes a new instance of the <see cref="XmlOutputFormatter"/> class. /// </summary> public XmlOutputFormatter() { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeNames.Text.Xml); SupportedEncodings.Add(Encoding.UTF8); SupportedEncodings.Add(Encoding.Unicode); }
public JsonPatchInputFormatter([NotNull] JsonSerializerSettings serializerSettings) : base(serializerSettings) { // Clear all values and only include json-patch+json value. SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/json-patch+json")); }
/// <summary> /// 构造函数 /// </summary> /// <param name="func">对读取的JSON文本格式进行操作</param> /// <returns></returns> public JsonApplicationInputFormatter(Func <IServiceProvider, string, Type, Task <InputFormatterResult> > func) : base() { _func = func; SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); SupportedEncodings.Clear(); SupportedEncodings.Add(Encoding.UTF8); }
/// <summary> /// 构造函数 /// </summary> /// <param name="func">对响应的JSON文本格式进行操作</param> /// <returns></returns> public JsonApplicationOutputFormatter(Func <IServiceProvider, object, Type, JObject> func = null) : base() { _func = func; SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue("application/json")); SupportedEncodings.Clear(); SupportedEncodings.Add(Encoding.UTF8); }
public LrpOutputFormatter(ISupportedMedia lrpSupportedMedia, JsonSerializerSettings serializerSettings, ArrayPool <char> charPool) : base(serializerSettings, charPool) { SupportedMediaTypes.Clear(); foreach (var type in lrpSupportedMedia.Types) { SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse(type)); } }
/// <summary> /// Instances a new <seealso cref="FormMultipartEncodedMediaTypeFormatter"/> /// </summary> /// <param name="multipartStreamProviderFactory"><seealso cref="MultipartStreamProvider"/> factory so you can inject your own code</param> public FormMultipartEncodedMediaTypeFormatter(Func <MultipartStreamProvider> multipartStreamProviderFactory) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue(SupportedMediaType)); SupportedEncodings.Add(new UTF8Encoding(encoderShouldEmitUTF8Identifier: false)); SupportedEncodings.Add(Encoding.GetEncoding("iso-8859-1")); _multipartStreamProviderFactory = multipartStreamProviderFactory; }
public OpenSearchDescriptionFormatter() { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(MediaTypeHeaderValue.Parse("application/opensearchdescription+xml")); SupportedEncodings.Add(Encoding.UTF8); SupportedEncodings.Add(Encoding.Unicode); }
public VendorSpecificJsonMediaTypeFormatter(Type resourceType, MediaTypeHeaderValue vendorMediaType) { _resourceType = resourceType; SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(vendorMediaType); }
private void Initialize() { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(new MediaTypeHeaderValue(_mediaTypeHeaderValueName)); SerializerSettings.Converters.Add(linksConverter); SerializerSettings.Converters.Add(resourceConverter); SerializerSettings.Converters.Add(embeddedResourceConverter); SerializerSettings.NullValueHandling = NullValueHandling.Ignore; }
public TypedJsonMediaTypeFormatter(Type resourceType, MediaTypeHeaderValue mediaType, JsonMediaTypeFormatter formatter) { _resourceType = resourceType; CopyValues(formatter); SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(mediaType); }
public JsonApiInputFormatter(JsonSerializer jsonSerializer, Configuration configuration, JsonApiTransformer jsonApiTransformer) { this.jsonSerializer = jsonSerializer; this.configuration = configuration; this.jsonApiTransformer = jsonApiTransformer; SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(configuration.DefaultJsonApiMediaType); }
public JsonHateoasOutputFormatter(JsonSerializerSettings serializerSettings, ArrayPool <char> charPool) : base(serializerSettings, charPool) { SupportedMediaTypes.Clear(); SupportedMediaTypes.Add(ApplicationJsonHateoas); SupportedEncodings.Add(Encoding.UTF8); SupportedEncodings.Add(Encoding.Unicode); }
protected BaseFhirOutputFormatter(IEnumerable <MediaTypeHeaderValue> mediaTypeHeaderValues) { SupportedEncodings.Clear(); SupportedEncodings.Add(new UTF8Encoding(true)); SupportedMediaTypes.Clear(); foreach (var mediaTypeHeaderValue in mediaTypeHeaderValues) { SupportedMediaTypes.Add(mediaTypeHeaderValue); } }