Remove deprecated MediaType entries

See gh-33809
This commit is contained in:
Brian Clozel
2024-12-08 21:01:11 +01:00
parent ff28d2d47a
commit 5044b70a40
6 changed files with 4 additions and 100 deletions
@@ -18,7 +18,6 @@ package org.springframework.http;
import java.io.Serializable;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -120,32 +119,9 @@ public class MediaType extends MimeType implements Serializable {
/**
* A String equivalent of {@link MediaType#APPLICATION_JSON}.
* @see #APPLICATION_JSON_UTF8_VALUE
*/
public static final String APPLICATION_JSON_VALUE = "application/json";
/**
* Media type for {@code application/json;charset=UTF-8}.
* @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON}
* since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special
* characters without requiring a {@code charset=UTF-8} parameter.
*/
@Deprecated
public static final MediaType APPLICATION_JSON_UTF8;
/**
* A String equivalent of {@link MediaType#APPLICATION_JSON_UTF8}.
* @deprecated as of 5.2 in favor of {@link #APPLICATION_JSON_VALUE}
* since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special
* characters without requiring a {@code charset=UTF-8} parameter.
*/
@Deprecated
public static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";
/**
* Media type for {@code application/octet-stream}.
*/
@@ -182,32 +158,6 @@ public class MediaType extends MimeType implements Serializable {
*/
public static final String APPLICATION_PROBLEM_JSON_VALUE = "application/problem+json";
/**
* Media type for {@code application/problem+json}.
* @since 5.0
* @see <a href="https://www.iana.org/assignments/media-types/application/problem+json">
* Problem Details for HTTP APIs, 6.1. application/problem+json</a>
* @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON}
* since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special
* characters without requiring a {@code charset=UTF-8} parameter.
*/
@Deprecated
public static final MediaType APPLICATION_PROBLEM_JSON_UTF8;
/**
* A String equivalent of {@link MediaType#APPLICATION_PROBLEM_JSON_UTF8}.
* @since 5.0
* @deprecated as of 5.2 in favor of {@link #APPLICATION_PROBLEM_JSON_VALUE}
* since major browsers like Chrome
* <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=438464">
* now comply with the specification</a> and interpret correctly UTF-8 special
* characters without requiring a {@code charset=UTF-8} parameter.
*/
@Deprecated
public static final String APPLICATION_PROBLEM_JSON_UTF8_VALUE = "application/problem+json;charset=UTF-8";
/**
* Media type for {@code application/problem+xml}.
* @since 5.0
@@ -258,26 +208,6 @@ public class MediaType extends MimeType implements Serializable {
*/
public static final String APPLICATION_NDJSON_VALUE = "application/x-ndjson";
/**
* Media type for {@code application/stream+json}.
* @since 5.0
* @deprecated as of 5.3, see notice on {@link #APPLICATION_STREAM_JSON_VALUE}.
*/
@Deprecated
public static final MediaType APPLICATION_STREAM_JSON;
/**
* A String equivalent of {@link MediaType#APPLICATION_STREAM_JSON}.
* @since 5.0
* @deprecated as of 5.3 since it originates from the W3C Activity Streams
* specification which has a more specific purpose and has been since
* replaced with a different mime type. Use {@link #APPLICATION_NDJSON} as
* a replacement or any other line-delimited JSON format (for example, JSON Lines,
* JSON Text Sequences).
*/
@Deprecated
public static final String APPLICATION_STREAM_JSON_VALUE = "application/stream+json";
/**
* Media type for {@code application/xhtml+xml}.
*/
@@ -440,16 +370,13 @@ public class MediaType extends MimeType implements Serializable {
APPLICATION_FORM_URLENCODED = new MediaType("application", "x-www-form-urlencoded");
APPLICATION_GRAPHQL_RESPONSE = new MediaType("application", "graphql-response+json");
APPLICATION_JSON = new MediaType("application", "json");
APPLICATION_JSON_UTF8 = new MediaType("application", "json", StandardCharsets.UTF_8);
APPLICATION_NDJSON = new MediaType("application", "x-ndjson");
APPLICATION_OCTET_STREAM = new MediaType("application", "octet-stream");
APPLICATION_PDF = new MediaType("application", "pdf");
APPLICATION_PROBLEM_JSON = new MediaType("application", "problem+json");
APPLICATION_PROBLEM_JSON_UTF8 = new MediaType("application", "problem+json", StandardCharsets.UTF_8);
APPLICATION_PROBLEM_XML = new MediaType("application", "problem+xml");
APPLICATION_PROTOBUF = new MediaType("application", "x-protobuf");
APPLICATION_RSS_XML = new MediaType("application", "rss+xml");
APPLICATION_STREAM_JSON = new MediaType("application", "stream+json");
APPLICATION_XHTML_XML = new MediaType("application", "xhtml+xml");
APPLICATION_XML = new MediaType("application", "xml");
APPLICATION_YAML = new MediaType("application", "yaml");
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,10 +59,9 @@ public class Jackson2JsonEncoder extends AbstractJackson2Encoder {
this(Jackson2ObjectMapperBuilder.json().build());
}
@SuppressWarnings("deprecation")
public Jackson2JsonEncoder(ObjectMapper mapper, MimeType... mimeTypes) {
super(mapper, mimeTypes);
setStreamingMediaTypes(Arrays.asList(MediaType.APPLICATION_NDJSON, MediaType.APPLICATION_STREAM_JSON));
setStreamingMediaTypes(Arrays.asList(MediaType.APPLICATION_NDJSON));
this.ssePrettyPrinter = initSsePrettyPrinter();
}