Top Description Fields Constructors Methods
org.springframework.web.server

public Class NotAcceptableStatusException

extends ResponseStatusException
Class Inheritance
Annotations
@SuppressWarnings:serial
Imports
java.util.Collections, .List, org.springframework.http.HttpHeaders, .HttpStatus, .MediaType, org.springframework.util.CollectionUtils, org.springframework.web.ErrorResponse

Exception for errors that fit response status 406 (not acceptable).
Author
Rossen Stoyanchev
Since
5.0

Field Summary

Modifier and TypeField and Description
private static final String
private final List<MediaType>

Constructor Summary

AccessConstructor and Description
public
NotAcceptableStatusException(String reason)

Constructor for when the requested Content-Type is invalid.

public
NotAcceptableStatusException(List<MediaType> mediaTypes)

Constructor for when the requested Content-Type is not supported.

Method Summary

Modifier and TypeMethod and Description
public HttpHeaders
getHeaders()

Overrides org.springframework.web.server.ResponseStatusException.getHeaders.

Overrides default org.springframework.web.ErrorResponse.getHeaders.

Return HttpHeaders with an "Accept" header that documents the supported media types, if available, or an empty instance otherwise.
public HttpHeaders
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.

Inherited from org.springframework.web.server.ResponseStatusException:
getMessagegetReasonupdateAndGetBody

Field Detail

PARSE_ERROR_DETAIL_CODEback to summary
private static final String PARSE_ERROR_DETAIL_CODE
supportedMediaTypesback to summary
private final List<MediaType> supportedMediaTypes

Constructor Detail

NotAcceptableStatusExceptionback to summary
public NotAcceptableStatusException(String reason)

Constructor for when the requested Content-Type is invalid.

NotAcceptableStatusExceptionback to summary
public NotAcceptableStatusException(List<MediaType> mediaTypes)

Constructor for when the requested Content-Type is not supported.

Method Detail

getHeadersback to summary
public HttpHeaders getHeaders()

Overrides org.springframework.web.server.ResponseStatusException.getHeaders.

Overrides default org.springframework.web.ErrorResponse.getHeaders.

Return HttpHeaders with an "Accept" header that documents the supported media types, if available, or an empty instance otherwise.

Annotations
@Override
getResponseHeadersback to summary
public HttpHeaders getResponseHeaders()

Overrides org.springframework.web.server.ResponseStatusException.getResponseHeaders.

Deprecated

since 6.0.

as of 6.0 in favor of getHeaders()

Delegates to getHeaders().

Annotations
@Deprecated
since:6.0
@Override
Since
5.1.13
getSupportedMediaTypesback to summary
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.