Add support for offical, IANA-registered media type for HAL.
Fixes GH-2453.
This commit is contained in:
@@ -189,6 +189,8 @@ public class RepositoryRestHandlerMapping extends BasePathAwareHandlerMapping {
|
||||
|
||||
Set<String> mediaTypes = new LinkedHashSet<String>();
|
||||
mediaTypes.add(configuration.getDefaultMediaType().toString());
|
||||
mediaTypes.add(MediaTypes.HAL_JSON_VALUE);
|
||||
mediaTypes.add(MediaTypes.VND_HAL_JSON_VALUE);
|
||||
mediaTypes.add(MediaType.APPLICATION_JSON_VALUE);
|
||||
mediaTypes.add(MediaTypes.HAL_FORMS_JSON_VALUE);
|
||||
|
||||
|
||||
@@ -575,6 +575,7 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
|
||||
|
||||
ArrayList<MediaType> mediaTypes = new ArrayList<>();
|
||||
mediaTypes.add(MediaTypes.HAL_JSON);
|
||||
mediaTypes.add(MediaTypes.VND_HAL_JSON);
|
||||
|
||||
// Enable returning HAL if application/json is asked if it's configured to be the default type
|
||||
if (repositoryRestConfiguration.useHalAsDefaultJsonMediaType()) {
|
||||
@@ -809,7 +810,8 @@ public class RepositoryRestMvcConfiguration extends HateoasAwareSpringDataWebCon
|
||||
messageConverters.add(alpsJsonHttpMessageConverter);
|
||||
}
|
||||
|
||||
if (repositoryRestConfiguration.getDefaultMediaType().equals(MediaTypes.HAL_JSON)) {
|
||||
if (List.of(MediaTypes.HAL_JSON, MediaTypes.VND_HAL_JSON)
|
||||
.contains(repositoryRestConfiguration.getDefaultMediaType())) {
|
||||
messageConverters.add(halJacksonHttpMessageConverter);
|
||||
messageConverters.add(jacksonHttpMessageConverter);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user