Class MediaTypes
java.lang.Object
com.toedter.spring.hateoas.jsonapi.MediaTypes
Provides constants for the JSON:API media type.
This utility class defines the official JSON:API media type application/vnd.api+json
as specified in the JSON:API specification. These constants can be used for content negotiation,
request/response type declarations, and Spring MVC mapping annotations.
Example usage:
@GetMapping(produces = MediaTypes.JSON_API_VALUE)
public EntityModel<Movie> getMovie() {
// ...
}
@RequestMapping(consumes = MediaTypes.JSON_API_VALUE)
public void createMovie(@RequestBody Movie movie) {
// ...
}
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.springframework.http.MediaTypeMediaTypeconstant for JSON:API:application/vnd.api+json.static final StringString representation of the JSON:API media type: "application/vnd.api+json". -
Method Summary
-
Field Details
-
JSON_API_VALUE
String representation of the JSON:API media type: "application/vnd.api+json".Use this constant with annotations like
@RequestMapping,@GetMapping, etc.- See Also:
-
JSON_API
public static final org.springframework.http.MediaType JSON_APIMediaTypeconstant for JSON:API:application/vnd.api+json.Use this constant for programmatic media type handling and content negotiation with Spring's
MediaTypeAPI.
-