public class UnsupportedMediaTypeException extends NestedRuntimeException
Content-Type
is not supported.Constructor and Description |
---|
UnsupportedMediaTypeException(MediaType contentType,
List<MediaType> supportedTypes)
Constructor for when the Content-Type can be parsed but is not supported.
|
UnsupportedMediaTypeException(MediaType contentType,
List<MediaType> supportedTypes,
ResolvableType bodyType)
Constructor for when trying to encode from or decode to a specific Java type.
|
UnsupportedMediaTypeException(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. |
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.
|
contains, getMessage, getMostSpecificCause, getRootCause
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
public UnsupportedMediaTypeException(String reason)
public UnsupportedMediaTypeException(@Nullable MediaType contentType, List<MediaType> supportedTypes)
@Nullable public MediaType getContentType()
null
otherwise.public List<MediaType> getSupportedMediaTypes()
@Nullable public ResolvableType getBodyType()
null
if not available