DATAREST-1421 - Deprecate ALPS_JSON and ALPS_JSON_VALUE.

Instead, use Spring HATEAOS's MediaTypes.ALPS_JSON and ALPS_JSON_VALUE.
This commit is contained in:
Greg Turnquist
2019-08-08 10:26:53 -05:00
parent f2a358b565
commit 9c56c3f217
6 changed files with 28 additions and 18 deletions

View File

@@ -32,8 +32,17 @@ public class RestMediaTypes {
public static final MediaType JSON_PATCH_JSON = MediaType.valueOf("application/json-patch+json");
public static final MediaType MERGE_PATCH_JSON = MediaType.valueOf("application/merge-patch+json");
/**
* @deprecated Migrate to {@link MediaTypes#ALPS_JSON_VALUE}.
*/
@Deprecated
public static final String ALPS_JSON_VALUE = "application/alps+json";
public static final MediaType ALPS_JSON = MediaType.parseMediaType(ALPS_JSON_VALUE);
/**
* @deprecated Migrate to {@link MediaTypes#ALPS_JSON}.
*/
@Deprecated
public static final MediaType ALPS_JSON = MediaType.parseMediaType(MediaTypes.ALPS_JSON_VALUE);
public static final String SCHEMA_JSON_VALUE = "application/schema+json";
public static final MediaType SCHEMA_JSON = MediaType.valueOf(SCHEMA_JSON_VALUE);

View File

@@ -25,8 +25,8 @@ import org.springframework.data.rest.core.mapping.ResourceMappings;
import org.springframework.data.rest.webmvc.BasePathAwareController;
import org.springframework.data.rest.webmvc.ProfileController;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.data.rest.webmvc.RootResourceInformation;
import org.springframework.hateoas.MediaTypes;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -68,7 +68,7 @@ public class AlpsController {
* @return
*/
@RequestMapping(value = ProfileController.RESOURCE_PROFILE_MAPPING, method = OPTIONS,
produces = RestMediaTypes.ALPS_JSON_VALUE)
produces = MediaTypes.ALPS_JSON_VALUE)
HttpEntity<?> alpsOptions() {
verifyAlpsEnabled();
@@ -86,7 +86,7 @@ public class AlpsController {
* @return
*/
@RequestMapping(value = ProfileController.RESOURCE_PROFILE_MAPPING, method = GET,
produces = { MediaType.ALL_VALUE, RestMediaTypes.ALPS_JSON_VALUE })
produces = { MediaType.ALL_VALUE, MediaTypes.ALPS_JSON_VALUE })
HttpEntity<RootResourceInformation> descriptor(RootResourceInformation information) {
verifyAlpsEnabled();

View File

@@ -21,8 +21,8 @@ import java.util.Collections;
import org.springframework.core.MethodParameter;
import org.springframework.core.convert.converter.Converter;
import org.springframework.data.rest.webmvc.RestMediaTypes;
import org.springframework.data.rest.webmvc.RootResourceInformation;
import org.springframework.hateoas.MediaTypes;
import org.springframework.hateoas.mediatype.alps.Alps;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
@@ -61,7 +61,7 @@ public class AlpsJsonHttpMessageConverter extends MappingJackson2HttpMessageConv
mapper.setSerializationInclusion(Include.NON_EMPTY);
setPrettyPrint(true);
setSupportedMediaTypes(Arrays.asList(RestMediaTypes.ALPS_JSON, MediaType.APPLICATION_JSON, MediaType.ALL));
setSupportedMediaTypes(Arrays.asList(MediaTypes.ALPS_JSON, MediaType.APPLICATION_JSON, MediaType.ALL));
}
/*