Class UnsupportedMediaTypeStatusException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.springframework.core.NestedRuntimeException
org.springframework.web.ErrorResponseException
org.springframework.web.server.ResponseStatusException
org.springframework.web.server.UnsupportedMediaTypeStatusException
- All Implemented Interfaces:
Serializable, ErrorResponse
Exception for errors that fit response status 415 (unsupported media type).
- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ErrorResponse
ErrorResponse.Builder, ErrorResponse.Interceptor -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for when the specified Content-Type is invalid.UnsupportedMediaTypeStatusException(@Nullable String reason, List<MediaType> supportedTypes) Constructor for when the specified Content-Type is invalid.UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes) Constructor for when the Content-Type can be parsed but is not supported.UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes, @Nullable ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes, @Nullable ResolvableType bodyType, @Nullable HttpMethod method) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes, @Nullable HttpMethod method) Constructor that provides the HTTP method. -
Method Summary
Modifier and TypeMethodDescriptionReturn the body type in the context of which this exception was generated.Return the request Content-Type header if it was parsed successfully, ornullotherwise.Return HttpHeaders with an "Accept" header that documents the supported media types, if available, or an empty instance otherwise.Return the list of supported content types in cases when the Content-Type header is parsed but not supported, or an empty list otherwise.Methods inherited from class ResponseStatusException
getMessage, getReason, updateAndGetBodyMethods inherited from class ErrorResponseException
getBody, getDetailMessageArguments, getDetailMessageCode, getStatusCode, setDetail, setInstance, setTitle, setTypeMethods inherited from class NestedRuntimeException
contains, getMostSpecificCause, getRootCauseMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ErrorResponse
getDetailMessageArguments, getTitleMessageCode, getTypeMessageCode
-
Constructor Details
-
UnsupportedMediaTypeStatusException
-
UnsupportedMediaTypeStatusException
-
UnsupportedMediaTypeStatusException
-
UnsupportedMediaTypeStatusException
-
UnsupportedMediaTypeStatusException
-
UnsupportedMediaTypeStatusException
public UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes, @Nullable ResolvableType bodyType, @Nullable HttpMethod method) Constructor for when trying to encode from or decode to a specific Java type.- Since:
- 5.3.6
-
-
Method Details
-
getContentType
-
getSupportedMediaTypes
-
getBodyType
Return the body type in the context of which this exception was generated.This is applicable when the exception was raised as a result trying to encode from or decode to a specific Java type.
- Returns:
- the body type, or
nullif not available - Since:
- 5.1
-
getHeaders
Return HttpHeaders with an "Accept" header that documents the supported media types, if available, or an empty instance otherwise.- Specified by:
getHeadersin interfaceErrorResponse- Overrides:
getHeadersin classResponseStatusException
-