Package org.springframework.web
Class HttpMediaTypeException
java.lang.Object
java.lang.Throwable
java.lang.Exception
jakarta.servlet.ServletException
org.springframework.web.HttpMediaTypeException
- All Implemented Interfaces:
Serializable
,ErrorResponse
- Direct Known Subclasses:
HttpMediaTypeNotAcceptableException
,HttpMediaTypeNotSupportedException
Abstract base for exceptions related to media types. Adds a list of supported
MediaTypes
.- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
HttpMediaTypeException
(String message) Create a new HttpMediaTypeException.protected
HttpMediaTypeException
(String message, List<MediaType> supportedMediaTypes) Create a new HttpMediaTypeException with a list of supported media types. -
Method Summary
Modifier and TypeMethodDescriptiongetBody()
Return the body for the response, formatted as an RFC 7807ProblemDetail
whosestatus
should match the response status.Return the list of supported media types.Methods inherited from class jakarta.servlet.ServletException
getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.web.ErrorResponse
getHeaders, getStatusCode
-
Constructor Details
-
HttpMediaTypeException
Create a new HttpMediaTypeException.- Parameters:
message
- the exception message
-
HttpMediaTypeException
Create a new HttpMediaTypeException with a list of supported media types.- Parameters:
supportedMediaTypes
- the list of supported media types
-
-
Method Details
-
getSupportedMediaTypes
Return the list of supported media types. -
getBody
Description copied from interface:ErrorResponse
Return the body for the response, formatted as an RFC 7807ProblemDetail
whosestatus
should match the response status.- Specified by:
getBody
in interfaceErrorResponse
-