public class UnsupportedMediaTypeStatusException extends ResponseStatusException
Modifier and Type | Field and Description |
---|---|
private ResolvableType |
bodyType |
private MediaType |
contentType |
private java.util.List<MediaType> |
supportedMediaTypes |
Constructor and Description |
---|
UnsupportedMediaTypeStatusException(MediaType contentType,
java.util.List<MediaType> supportedTypes)
Constructor for when the Content-Type can be parsed but is not supported.
|
UnsupportedMediaTypeStatusException(MediaType contentType,
java.util.List<MediaType> supportedTypes,
ResolvableType bodyType)
Constructor for when trying to encode from or decode to a specific Java type.
|
UnsupportedMediaTypeStatusException(java.lang.String reason)
Constructor for when the specified Content-Type is invalid.
|
Modifier and Type | Method and Description |
---|---|
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. |
java.util.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.
|
private static java.lang.String |
initReason(MediaType contentType,
ResolvableType bodyType) |
getMessage, getReason, getStatus
contains, getMostSpecificCause, getRootCause
private final java.util.List<MediaType> supportedMediaTypes
@Nullable private final ResolvableType bodyType
public UnsupportedMediaTypeStatusException(@Nullable java.lang.String reason)
public UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, java.util.List<MediaType> supportedTypes)
public UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, java.util.List<MediaType> supportedTypes, @Nullable ResolvableType bodyType)
private static java.lang.String initReason(@Nullable MediaType contentType, @Nullable ResolvableType bodyType)
@Nullable public MediaType getContentType()
null
otherwise.public java.util.List<MediaType> getSupportedMediaTypes()
@Nullable public 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 available