Class HttpMediaTypeNotSupportedException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.HttpMediaTypeException
org.springframework.web.HttpMediaTypeNotSupportedException
- All Implemented Interfaces:
Serializable, ErrorResponse
Exception thrown when a client POSTs, PUTs, or PATCHes content of a type
not supported by request handler.
- Since:
- 3.0
- Author:
- Arjen Poutsma, Rossen Stoyanchev
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface ErrorResponse
ErrorResponse.Builder, ErrorResponse.Interceptor -
Constructor Summary
ConstructorsConstructorDescriptionHttpMediaTypeNotSupportedException(@Nullable String message, List<MediaType> mediaTypes) Create a new HttpMediaTypeNotSupportedException for a parse error.HttpMediaTypeNotSupportedException(String message) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(@Nullable MediaType contentType, List<MediaType> mediaTypes) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(@Nullable MediaType contentType, List<MediaType> mediaTypes, @Nullable HttpMethod httpMethod) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(@Nullable MediaType contentType, List<MediaType> supportedMediaTypes, @Nullable HttpMethod httpMethod, String message) Create a new HttpMediaTypeNotSupportedException. -
Method Summary
Modifier and TypeMethodDescriptionReturn the HTTP request content type method that caused the failure.Return headers to use for the response.Return the HTTP status code to use for the response.Methods inherited from class HttpMediaTypeException
getBody, getDetailMessageArguments, getDetailMessageCode, getSupportedMediaTypesMethods inherited from class jakarta.servlet.ServletException
getRootCauseMethods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, 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, updateAndGetBody
-
Constructor Details
-
HttpMediaTypeNotSupportedException
Create a new HttpMediaTypeNotSupportedException.- Parameters:
message- the exception message
-
HttpMediaTypeNotSupportedException
-
HttpMediaTypeNotSupportedException
-
HttpMediaTypeNotSupportedException
public HttpMediaTypeNotSupportedException(@Nullable MediaType contentType, List<MediaType> mediaTypes, @Nullable HttpMethod httpMethod) Create a new HttpMediaTypeNotSupportedException.- Parameters:
contentType- the unsupported content typemediaTypes- the list of supported media typeshttpMethod- the HTTP method of the request- Since:
- 6.0
-
HttpMediaTypeNotSupportedException
public HttpMediaTypeNotSupportedException(@Nullable MediaType contentType, List<MediaType> supportedMediaTypes, @Nullable HttpMethod httpMethod, String message) Create a new HttpMediaTypeNotSupportedException.- Parameters:
contentType- the unsupported content typesupportedMediaTypes- the list of supported media typeshttpMethod- the HTTP method of the requestmessage- the detail message- Since:
- 6.0
-
-
Method Details
-
getContentType
-
getStatusCode
Description copied from interface:ErrorResponseReturn the HTTP status code to use for the response. -
getHeaders
Description copied from interface:ErrorResponseReturn headers to use for the response.
-