public class UnsupportedMediaTypeStatusException extends ResponseStatusException
| Constructor and Description |
|---|
UnsupportedMediaTypeStatusException(MediaType contentType,
List<MediaType> supportedTypes)
Constructor for when the Content-Type can be parsed but is not supported.
|
UnsupportedMediaTypeStatusException(MediaType contentType,
List<MediaType> supportedTypes,
HttpMethod method)
Constructor that provides the HTTP method.
|
UnsupportedMediaTypeStatusException(MediaType contentType,
List<MediaType> supportedTypes,
org.springframework.core.ResolvableType bodyType)
Constructor for when trying to encode from or decode to a specific Java type.
|
UnsupportedMediaTypeStatusException(MediaType contentType,
List<MediaType> supportedTypes,
org.springframework.core.ResolvableType bodyType,
HttpMethod method)
Constructor for when trying to encode from or decode to a specific Java type.
|
UnsupportedMediaTypeStatusException(String reason)
Constructor for when the specified Content-Type is invalid.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.core.ResolvableType |
getBodyType()
Return the body type in the context of which this exception was generated.
|
MediaType |
getContentType()
Return the request Content-Type header if it was parsed successfully,
or
null otherwise. |
HttpHeaders |
getResponseHeaders()
Return headers associated with the exception that should be added to the
error response, e.g.
|
List<MediaType> |
getSupportedMediaTypes()
Return the list of supported content types in cases when the Content-Type
header is parsed but not supported, or an empty list otherwise.
|
getHeaders, getMessage, getRawStatusCode, getReason, getStatuscontains, getMostSpecificCause, getRootCauseaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic UnsupportedMediaTypeStatusException(@Nullable
String reason)
public UnsupportedMediaTypeStatusException(@Nullable
MediaType contentType,
List<MediaType> supportedTypes)
public UnsupportedMediaTypeStatusException(@Nullable
MediaType contentType,
List<MediaType> supportedTypes,
@Nullable
org.springframework.core.ResolvableType bodyType)
public UnsupportedMediaTypeStatusException(@Nullable
MediaType contentType,
List<MediaType> supportedTypes,
@Nullable
HttpMethod method)
public UnsupportedMediaTypeStatusException(@Nullable
MediaType contentType,
List<MediaType> supportedTypes,
@Nullable
org.springframework.core.ResolvableType bodyType,
@Nullable
HttpMethod method)
@Nullable public MediaType getContentType()
null otherwise.public List<MediaType> getSupportedMediaTypes()
@Nullable public org.springframework.core.ResolvableType getBodyType()
This is applicable when the exception was raised as a result trying to encode from or decode to a specific Java type.
null if not availablepublic HttpHeaders getResponseHeaders()
ResponseStatusExceptionThe default implementation in this class returns empty headers.
getResponseHeaders in class ResponseStatusException