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
ConstructorsModifierConstructorDescriptionprotectedHttpMediaTypeException(String message) Create a new HttpMediaTypeException.protectedHttpMediaTypeException(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 7807ProblemDetailwhosestatusshould match the response status.Return the list of supported media types.Methods inherited from class jakarta.servlet.ServletException
getRootCauseMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.web.ErrorResponse
getHeaders, getRawStatusCode, getStatus
-
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:ErrorResponseReturn the body for the response, formatted as an RFC 7807ProblemDetailwhosestatusshould match the response status.- Specified by:
getBodyin interfaceErrorResponse
-