#987 - Drop UTF8 HAL media type.

This commit is contained in:
Greg Turnquist
2019-05-30 15:49:56 -05:00
parent 400a6bb703
commit feaa56a68c
12 changed files with 43 additions and 70 deletions

View File

@@ -37,16 +37,6 @@ public class MediaTypes {
*/
public static final MediaType HAL_JSON = MediaType.valueOf(HAL_JSON_VALUE);
/**
* A String equivalent of {@link MediaTypes#HAL_JSON_UTF8}.
*/
public static final String HAL_JSON_UTF8_VALUE = HAL_JSON_VALUE + ";charset=UTF-8";
/**
* Public constant media type for {@code application/hal+json;charset=UTF-8}.
*/
public static final MediaType HAL_JSON_UTF8 = MediaType.valueOf(HAL_JSON_UTF8_VALUE);
/**
* A String equivalent of {@link MediaTypes#ALPS_JSON}.
*/

View File

@@ -73,7 +73,7 @@ public @interface EnableHypermediaSupport {
* @see http://stateless.co/hal_specification.html
* @see https://tools.ietf.org/html/draft-kelly-json-hal-05
*/
HAL(MediaTypes.HAL_JSON, MediaTypes.HAL_JSON_UTF8),
HAL(MediaTypes.HAL_JSON),
/**
* HAL-FORMS - Independent, backward-compatible extension of the HAL designed to add runtime FORM support

View File

@@ -36,7 +36,7 @@ public class HalLinkDiscoverer extends JsonPathLinkDiscoverer {
* Constructor for {@link MediaTypes#HAL_JSON}.
*/
public HalLinkDiscoverer() {
this(MediaTypes.HAL_JSON, MediaTypes.HAL_JSON_UTF8);
this(MediaTypes.HAL_JSON);
}
protected HalLinkDiscoverer(MediaType... mediaTypes) {

View File

@@ -17,7 +17,6 @@ package org.springframework.hateoas.mediatype.hal;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -41,7 +40,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
*/
class HalTraversonDefaults implements TraversonDefaults {
private static final List<MediaType> HAL_FLAVORS = Arrays.asList(MediaTypes.HAL_JSON, MediaTypes.HAL_JSON_UTF8);
private static final List<MediaType> HAL_FLAVORS = Collections.singletonList(MediaTypes.HAL_JSON);
/*
* (non-Javadoc)
@@ -54,7 +53,7 @@ class HalTraversonDefaults implements TraversonDefaults {
converters.add(new StringHttpMessageConverter(StandardCharsets.UTF_8));
List<MediaType> halFlavors = mediaTypes.stream() //
.filter(it -> HAL_FLAVORS.contains(it)) //
.filter(HAL_FLAVORS::contains) //
.collect(Collectors.toList());
if (!halFlavors.isEmpty()) {