List of usage examples for org.springframework.web.server NotAcceptableStatusException NotAcceptableStatusException
public NotAcceptableStatusException(List<MediaType> supportedMediaTypes)
From source file:org.springframework.security.web.server.util.matcher.MediaTypeServerWebExchangeMatcher.java
private List<MediaType> resolveMediaTypes(ServerWebExchange exchange) throws NotAcceptableStatusException { try {//from w w w . java2 s . co m List<MediaType> mediaTypes = exchange.getRequest().getHeaders().getAccept(); MediaType.sortBySpecificityAndQuality(mediaTypes); return mediaTypes; } catch (InvalidMediaTypeException ex) { String value = exchange.getRequest().getHeaders().getFirst("Accept"); throw new NotAcceptableStatusException( "Could not parse 'Accept' header [" + value + "]: " + ex.getMessage()); } }
From source file:org.springframework.web.reactive.accept.ParameterContentTypeResolver.java
@Override protected MediaType handleNoMatch(String key) throws NotAcceptableStatusException { throw new NotAcceptableStatusException(getAllMediaTypes()); }