Package org.springframework.web.server
Class NotAcceptableStatusException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.web.server.ResponseStatusException
- org.springframework.web.server.NotAcceptableStatusException
- All Implemented Interfaces:
Serializable
public class NotAcceptableStatusException extends ResponseStatusException
Exception for errors that fit response status 406 (not acceptable).- Since:
- 5.0
- Author:
- Rossen Stoyanchev
- See Also:
- Serialized Form
Constructor Summary
Constructors Constructor Description NotAcceptableStatusException(String reason)
Constructor for when the requested Content-Type is invalid.NotAcceptableStatusException(List<MediaType> supportedMediaTypes)
Constructor for when the requested Content-Type is not supported.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
getHeaders()
Return a Map with an "Accept" header.HttpHeaders
getResponseHeaders()
Return HttpHeaders with an "Accept" header, or an empty instance.List<MediaType>
getSupportedMediaTypes()
Return the list of supported content types in cases when the Accept header is parsed but not supported, or an empty list otherwise.Methods inherited from class org.springframework.web.server.ResponseStatusException
getMessage, getReason, getStatus
Methods inherited from class org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
Constructor Detail
NotAcceptableStatusException
public NotAcceptableStatusException(String reason)
Constructor for when the requested Content-Type is invalid.
NotAcceptableStatusException
public NotAcceptableStatusException(List<MediaType> supportedMediaTypes)
Constructor for when the requested Content-Type is not supported.
Method Detail
getHeaders
public Map<String,String> getHeaders()
Return a Map with an "Accept" header.- Overrides:
getHeaders
in classResponseStatusException
- Since:
- 5.1.11
getResponseHeaders
public HttpHeaders getResponseHeaders()
Return HttpHeaders with an "Accept" header, or an empty instance.- Overrides:
getResponseHeaders
in classResponseStatusException
- Since:
- 5.1.13
getSupportedMediaTypes
public List<MediaType> getSupportedMediaTypes()
Return the list of supported content types in cases when the Accept header is parsed but not supported, or an empty list otherwise.