Java Code Examples for org.springframework.web.HttpMediaTypeNotAcceptableException

The following examples show how to use org.springframework.web.HttpMediaTypeNotAcceptableException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: spring-analysis-note   Source File: ProducesRequestCondition.java    License: MIT License 6 votes vote down vote up
/**
 * Compares this and another "produces" condition as follows:
 * <ol>
 * <li>Sort 'Accept' header media types by quality value via
 * {@link MediaType#sortByQualityValue(List)} and iterate the list.
 * <li>Get the first index of matching media types in each "produces"
 * condition first matching with {@link MediaType#equals(Object)} and
 * then with {@link MediaType#includes(MediaType)}.
 * <li>If a lower index is found, the condition at that index wins.
 * <li>If both indexes are equal, the media types at the index are
 * compared further with {@link MediaType#SPECIFICITY_COMPARATOR}.
 * </ol>
 * <p>It is assumed that both instances have been obtained via
 * {@link #getMatchingCondition(HttpServletRequest)} and each instance
 * contains the matching producible media type expression only or
 * is otherwise empty.
 */
@Override
public int compareTo(ProducesRequestCondition other, HttpServletRequest request) {
	try {
		List<MediaType> acceptedMediaTypes = getAcceptedMediaTypes(request);
		for (MediaType acceptedMediaType : acceptedMediaTypes) {
			int thisIndex = this.indexOfEqualMediaType(acceptedMediaType);
			int otherIndex = other.indexOfEqualMediaType(acceptedMediaType);
			int result = compareMatchingMediaTypes(this, thisIndex, other, otherIndex);
			if (result != 0) {
				return result;
			}
			thisIndex = this.indexOfIncludedMediaType(acceptedMediaType);
			otherIndex = other.indexOfIncludedMediaType(acceptedMediaType);
			result = compareMatchingMediaTypes(this, thisIndex, other, otherIndex);
			if (result != 0) {
				return result;
			}
		}
		return 0;
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		// should never happen
		throw new IllegalStateException("Cannot compare without having any requested media types", ex);
	}
}
 
Example 2
private boolean safeMediaTypesForExtension(NativeWebRequest request, String extension) {
	List<MediaType> mediaTypes = null;
	try {
		mediaTypes = this.pathStrategy.resolveMediaTypeKey(request, extension);
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		// Ignore
	}
	if (CollectionUtils.isEmpty(mediaTypes)) {
		return false;
	}
	for (MediaType mediaType : mediaTypes) {
		if (!safeMediaType(mediaType)) {
			return false;
		}
	}
	return true;
}
 
Example 3
/**
 * {@inheritDoc}
 * @throws HttpMediaTypeNotAcceptableException if the 'Accept' header cannot be parsed
 */
@Override
public List<MediaType> resolveMediaTypes(NativeWebRequest request)
		throws HttpMediaTypeNotAcceptableException {

	String[] headerValueArray = request.getHeaderValues(HttpHeaders.ACCEPT);
	if (headerValueArray == null) {
		return MEDIA_TYPE_ALL_LIST;
	}

	List<String> headerValues = Arrays.asList(headerValueArray);
	try {
		List<MediaType> mediaTypes = MediaType.parseMediaTypes(headerValues);
		MediaType.sortBySpecificityAndQuality(mediaTypes);
		return !CollectionUtils.isEmpty(mediaTypes) ? mediaTypes : MEDIA_TYPE_ALL_LIST;
	}
	catch (InvalidMediaTypeException ex) {
		throw new HttpMediaTypeNotAcceptableException(
				"Could not parse 'Accept' header " + headerValues + ": " + ex.getMessage());
	}
}
 
Example 4
/**
 * An alternative to {@link #resolveMediaTypes(NativeWebRequest)} that accepts
 * an already extracted key.
 * @since 3.2.16
 */
public List<MediaType> resolveMediaTypeKey(NativeWebRequest webRequest, @Nullable String key)
		throws HttpMediaTypeNotAcceptableException {

	if (StringUtils.hasText(key)) {
		MediaType mediaType = lookupMediaType(key);
		if (mediaType != null) {
			handleMatch(key, mediaType);
			return Collections.singletonList(mediaType);
		}
		mediaType = handleNoMatch(webRequest, key);
		if (mediaType != null) {
			addMapping(key, mediaType);
			return Collections.singletonList(mediaType);
		}
	}
	return MEDIA_TYPE_ALL_LIST;
}
 
Example 5
/**
 * Override to provide handling when a key is not resolved via.
 * {@link #lookupMediaType}. Sub-classes can take further steps to
 * determine the media type(s). If a MediaType is returned from
 * this method it will be added to the cache in the base class.
 */
@Nullable
protected MediaType handleNoMatch(NativeWebRequest request, String key)
		throws HttpMediaTypeNotAcceptableException {

	if (!isUseRegisteredExtensionsOnly()) {
		Optional<MediaType> mediaType = MediaTypeFactory.getMediaType("file." + key);
		if (mediaType.isPresent()) {
			return mediaType.get();
		}
	}
	if (isIgnoreUnknownExtensions()) {
		return null;
	}
	throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes());
}
 
Example 6
/**
 * Resolve file extension via {@link ServletContext#getMimeType(String)}
 * and also delegate to base class for a potential
 * {@link org.springframework.http.MediaTypeFactory} lookup.
 */
@Override
@Nullable
protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
		throws HttpMediaTypeNotAcceptableException {

	MediaType mediaType = null;
	String mimeType = this.servletContext.getMimeType("file." + extension);
	if (StringUtils.hasText(mimeType)) {
		mediaType = MediaType.parseMediaType(mimeType);
	}
	if (mediaType == null || MediaType.APPLICATION_OCTET_STREAM.equals(mediaType)) {
		MediaType superMediaType = super.handleNoMatch(webRequest, extension);
		if (superMediaType != null) {
			mediaType = superMediaType;
		}
	}
	return mediaType;
}
 
Example 7
/**
 * Resolve file extension via {@link ServletContext#getMimeType(String)}
 * and also delegate to base class for a potential JAF lookup.
 */
@Override
protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
		throws HttpMediaTypeNotAcceptableException {

	MediaType mediaType = null;
	if (this.servletContext != null) {
		String mimeType = this.servletContext.getMimeType("file." + extension);
		if (StringUtils.hasText(mimeType)) {
			mediaType = MediaType.parseMediaType(mimeType);
		}
	}
	if (mediaType == null || MediaType.APPLICATION_OCTET_STREAM.equals(mediaType)) {
		MediaType superMediaType = super.handleNoMatch(webRequest, extension);
		if (superMediaType != null) {
			mediaType = superMediaType;
		}
	}
	return mediaType;
}
 
Example 8
Source Project: java-technology-stack   Source File: ProducesRequestCondition.java    License: MIT License 6 votes vote down vote up
/**
 * Compares this and another "produces" condition as follows:
 * <ol>
 * <li>Sort 'Accept' header media types by quality value via
 * {@link MediaType#sortByQualityValue(List)} and iterate the list.
 * <li>Get the first index of matching media types in each "produces"
 * condition first matching with {@link MediaType#equals(Object)} and
 * then with {@link MediaType#includes(MediaType)}.
 * <li>If a lower index is found, the condition at that index wins.
 * <li>If both indexes are equal, the media types at the index are
 * compared further with {@link MediaType#SPECIFICITY_COMPARATOR}.
 * </ol>
 * <p>It is assumed that both instances have been obtained via
 * {@link #getMatchingCondition(HttpServletRequest)} and each instance
 * contains the matching producible media type expression only or
 * is otherwise empty.
 */
@Override
public int compareTo(ProducesRequestCondition other, HttpServletRequest request) {
	try {
		List<MediaType> acceptedMediaTypes = getAcceptedMediaTypes(request);
		for (MediaType acceptedMediaType : acceptedMediaTypes) {
			int thisIndex = this.indexOfEqualMediaType(acceptedMediaType);
			int otherIndex = other.indexOfEqualMediaType(acceptedMediaType);
			int result = compareMatchingMediaTypes(this, thisIndex, other, otherIndex);
			if (result != 0) {
				return result;
			}
			thisIndex = this.indexOfIncludedMediaType(acceptedMediaType);
			otherIndex = other.indexOfIncludedMediaType(acceptedMediaType);
			result = compareMatchingMediaTypes(this, thisIndex, other, otherIndex);
			if (result != 0) {
				return result;
			}
		}
		return 0;
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		// should never happen
		throw new IllegalStateException("Cannot compare without having any requested media types", ex);
	}
}
 
Example 9
private boolean safeMediaTypesForExtension(NativeWebRequest request, String extension) {
	List<MediaType> mediaTypes = null;
	try {
		mediaTypes = this.pathStrategy.resolveMediaTypeKey(request, extension);
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		// Ignore
	}
	if (CollectionUtils.isEmpty(mediaTypes)) {
		return false;
	}
	for (MediaType mediaType : mediaTypes) {
		if (!safeMediaType(mediaType)) {
			return false;
		}
	}
	return true;
}
 
Example 10
/**
 * {@inheritDoc}
 * @throws HttpMediaTypeNotAcceptableException if the 'Accept' header cannot be parsed
 */
@Override
public List<MediaType> resolveMediaTypes(NativeWebRequest request)
		throws HttpMediaTypeNotAcceptableException {

	String[] headerValueArray = request.getHeaderValues(HttpHeaders.ACCEPT);
	if (headerValueArray == null) {
		return MEDIA_TYPE_ALL_LIST;
	}

	List<String> headerValues = Arrays.asList(headerValueArray);
	try {
		List<MediaType> mediaTypes = MediaType.parseMediaTypes(headerValues);
		MediaType.sortBySpecificityAndQuality(mediaTypes);
		return !CollectionUtils.isEmpty(mediaTypes) ? mediaTypes : MEDIA_TYPE_ALL_LIST;
	}
	catch (InvalidMediaTypeException ex) {
		throw new HttpMediaTypeNotAcceptableException(
				"Could not parse 'Accept' header " + headerValues + ": " + ex.getMessage());
	}
}
 
Example 11
/**
 * An alternative to {@link #resolveMediaTypes(NativeWebRequest)} that accepts
 * an already extracted key.
 * @since 3.2.16
 */
public List<MediaType> resolveMediaTypeKey(NativeWebRequest webRequest, @Nullable String key)
		throws HttpMediaTypeNotAcceptableException {

	if (StringUtils.hasText(key)) {
		MediaType mediaType = lookupMediaType(key);
		if (mediaType != null) {
			handleMatch(key, mediaType);
			return Collections.singletonList(mediaType);
		}
		mediaType = handleNoMatch(webRequest, key);
		if (mediaType != null) {
			addMapping(key, mediaType);
			return Collections.singletonList(mediaType);
		}
	}
	return MEDIA_TYPE_ALL_LIST;
}
 
Example 12
/**
 * Override to provide handling when a key is not resolved via.
 * {@link #lookupMediaType}. Sub-classes can take further steps to
 * determine the media type(s). If a MediaType is returned from
 * this method it will be added to the cache in the base class.
 */
@Nullable
protected MediaType handleNoMatch(NativeWebRequest request, String key)
		throws HttpMediaTypeNotAcceptableException {

	if (!isUseRegisteredExtensionsOnly()) {
		Optional<MediaType> mediaType = MediaTypeFactory.getMediaType("file." + key);
		if (mediaType.isPresent()) {
			return mediaType.get();
		}
	}
	if (isIgnoreUnknownExtensions()) {
		return null;
	}
	throw new HttpMediaTypeNotAcceptableException(getAllMediaTypes());
}
 
Example 13
/**
 * An alternative to {@link #resolveMediaTypes(NativeWebRequest)} that accepts
 * an already extracted key.
 * @since 3.2.16
 */
public List<MediaType> resolveMediaTypeKey(NativeWebRequest webRequest, String key)
		throws HttpMediaTypeNotAcceptableException {

	if (StringUtils.hasText(key)) {
		MediaType mediaType = lookupMediaType(key);
		if (mediaType != null) {
			handleMatch(key, mediaType);
			return Collections.singletonList(mediaType);
		}
		mediaType = handleNoMatch(webRequest, key);
		if (mediaType != null) {
			addMapping(key, mediaType);
			return Collections.singletonList(mediaType);
		}
	}
	return Collections.emptyList();
}
 
Example 14
private boolean safeMediaTypesForExtension(String extension) {
	List<MediaType> mediaTypes = null;
	try {
		mediaTypes = this.pathStrategy.resolveMediaTypeKey(null, extension);
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		// Ignore
	}
	if (CollectionUtils.isEmpty(mediaTypes)) {
		return false;
	}
	for (MediaType mediaType : mediaTypes) {
		if (!safeMediaType(mediaType)) {
			return false;
		}
	}
	return true;
}
 
Example 15
/**
 * {@inheritDoc}
 * @throws HttpMediaTypeNotAcceptableException if the 'Accept' header cannot be parsed
 */
@Override
public List<MediaType> resolveMediaTypes(NativeWebRequest request)
		throws HttpMediaTypeNotAcceptableException {

	String[] headerValueArray = request.getHeaderValues(HttpHeaders.ACCEPT);
	if (headerValueArray == null) {
		return Collections.<MediaType>emptyList();
	}

	List<String> headerValues = Arrays.asList(headerValueArray);
	try {
		List<MediaType> mediaTypes = MediaType.parseMediaTypes(headerValues);
		MediaType.sortBySpecificityAndQuality(mediaTypes);
		return mediaTypes;
	}
	catch (InvalidMediaTypeException ex) {
		throw new HttpMediaTypeNotAcceptableException(
				"Could not parse 'Accept' header " + headerValues + ": " + ex.getMessage());
	}
}
 
Example 16
/**
 * Determines the list of {@link MediaType} for the given {@link HttpServletRequest}.
 * @param request the current servlet request
 * @return the list of media types requested, if any
 */
@Nullable
protected List<MediaType> getMediaTypes(HttpServletRequest request) {
	Assert.state(this.contentNegotiationManager != null, "No ContentNegotiationManager set");
	try {
		ServletWebRequest webRequest = new ServletWebRequest(request);
		List<MediaType> acceptableMediaTypes = this.contentNegotiationManager.resolveMediaTypes(webRequest);
		List<MediaType> producibleMediaTypes = getProducibleMediaTypes(request);
		Set<MediaType> compatibleMediaTypes = new LinkedHashSet<>();
		for (MediaType acceptable : acceptableMediaTypes) {
			for (MediaType producible : producibleMediaTypes) {
				if (acceptable.isCompatibleWith(producible)) {
					compatibleMediaTypes.add(getMostSpecificMediaType(acceptable, producible));
				}
			}
		}
		List<MediaType> selectedMediaTypes = new ArrayList<>(compatibleMediaTypes);
		MediaType.sortBySpecificityAndQuality(selectedMediaTypes);
		return selectedMediaTypes;
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		if (logger.isDebugEnabled()) {
			logger.debug(ex.getMessage());
		}
		return null;
	}
}
 
Example 17
@SuppressWarnings("unchecked")
protected void writeEntityWithMessageConverters(Object entity, HttpServletRequest request,
		HttpServletResponse response, ServerResponse.Context context)
		throws ServletException, IOException {

	ServletServerHttpResponse serverResponse = new ServletServerHttpResponse(response);
	MediaType contentType = getContentType(response);
	Class<?> entityClass = entity.getClass();

	for (HttpMessageConverter<?> messageConverter : context.messageConverters()) {
		if (messageConverter instanceof GenericHttpMessageConverter<?>) {
			GenericHttpMessageConverter<Object> genericMessageConverter =
					(GenericHttpMessageConverter<Object>) messageConverter;
			if (genericMessageConverter.canWrite(this.entityType, entityClass, contentType)) {
				genericMessageConverter.write(entity, this.entityType, contentType, serverResponse);
				return;
			}
		}
		if (messageConverter.canWrite(entityClass, contentType)) {
			((HttpMessageConverter<Object>)messageConverter).write(entity, contentType, serverResponse);
			return;
		}
	}

	List<MediaType> producibleMediaTypes = producibleMediaTypes(context.messageConverters(), entityClass);
	throw new HttpMediaTypeNotAcceptableException(producibleMediaTypes);
}
 
Example 18
Source Project: spring-analysis-note   Source File: ProducesRequestCondition.java    License: MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private List<MediaType> getAcceptedMediaTypes(HttpServletRequest request)
		throws HttpMediaTypeNotAcceptableException {

	List<MediaType> result = (List<MediaType>) request.getAttribute(MEDIA_TYPES_ATTRIBUTE);
	if (result == null) {
		result = this.contentNegotiationManager.resolveMediaTypes(new ServletWebRequest(request));
		request.setAttribute(MEDIA_TYPES_ATTRIBUTE, result);
	}
	return result;
}
 
Example 19
Source Project: spring-analysis-note   Source File: ReactiveTypeHandler.java    License: MIT License 5 votes vote down vote up
@SuppressWarnings("unchecked")
private Collection<MediaType> getMediaTypes(NativeWebRequest request)
		throws HttpMediaTypeNotAcceptableException {

	Collection<MediaType> mediaTypes = (Collection<MediaType>) request.getAttribute(
			HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST);

	return CollectionUtils.isEmpty(mediaTypes) ?
			this.contentNegotiationManager.resolveMediaTypes(request) : mediaTypes;
}
 
Example 20
@Override
public void handleReturnValue(@Nullable Object returnValue, MethodParameter returnType,
		ModelAndViewContainer mavContainer, NativeWebRequest webRequest)
		throws IOException, HttpMediaTypeNotAcceptableException, HttpMessageNotWritableException {

	mavContainer.setRequestHandled(true);
	ServletServerHttpRequest inputMessage = createInputMessage(webRequest);
	ServletServerHttpResponse outputMessage = createOutputMessage(webRequest);

	// Try even with null return value. ResponseBodyAdvice could get involved.
	writeWithMessageConverters(returnValue, returnType, inputMessage, outputMessage);
}
 
Example 21
@Test(expected = HttpMediaTypeNotAcceptableException.class)
public void handleReturnValueNotAcceptable() throws Exception {
	MediaType accepted = MediaType.APPLICATION_ATOM_XML;
	servletRequest.addHeader("Accept", accepted.toString());

	given(stringMessageConverter.canWrite(String.class, null)).willReturn(true);
	given(stringMessageConverter.getSupportedMediaTypes()).willReturn(Arrays.asList(MediaType.TEXT_PLAIN));
	given(stringMessageConverter.canWrite(String.class, accepted)).willReturn(false);

	processor.handleReturnValue("Foo", returnTypeString, mavContainer, webRequest);
}
 
Example 22
@Test(expected = HttpMediaTypeNotAcceptableException.class)
public void handleReturnValueNotAcceptableProduces() throws Exception {
	MediaType accepted = MediaType.TEXT_PLAIN;
	servletRequest.addHeader("Accept", accepted.toString());

	given(stringMessageConverter.canWrite(String.class, null)).willReturn(true);
	given(stringMessageConverter.getSupportedMediaTypes()).willReturn(Collections.singletonList(MediaType.TEXT_PLAIN));
	given(stringMessageConverter.canWrite(String.class, accepted)).willReturn(false);

	processor.handleReturnValue("Foo", returnTypeStringProduces, mavContainer, webRequest);
}
 
Example 23
@Test
public void shouldFailHandlingWhenContentTypeNotSupported() throws Exception {
	String body = "Foo";
	ResponseEntity<String> returnValue = new ResponseEntity<>(body, HttpStatus.OK);
	MediaType accepted = MediaType.APPLICATION_ATOM_XML;
	servletRequest.addHeader("Accept", accepted.toString());

	given(stringHttpMessageConverter.canWrite(String.class, null)).willReturn(true);
	given(stringHttpMessageConverter.getSupportedMediaTypes())
			.willReturn(Collections.singletonList(TEXT_PLAIN));

	assertThatExceptionOfType(HttpMediaTypeNotAcceptableException.class).isThrownBy(() ->
			processor.handleReturnValue(returnValue, returnTypeResponseEntity, mavContainer, webRequest));
}
 
Example 24
@Test
public void shouldFailHandlingWhenConverterCannotWrite() throws Exception {
	String body = "Foo";
	ResponseEntity<String> returnValue = new ResponseEntity<>(body, HttpStatus.OK);
	MediaType accepted = TEXT_PLAIN;
	servletRequest.addHeader("Accept", accepted.toString());

	given(stringHttpMessageConverter.canWrite(String.class, null)).willReturn(true);
	given(stringHttpMessageConverter.getSupportedMediaTypes())
			.willReturn(Collections.singletonList(TEXT_PLAIN));
	given(stringHttpMessageConverter.canWrite(String.class, accepted)).willReturn(false);

	assertThatExceptionOfType(HttpMediaTypeNotAcceptableException.class).isThrownBy(() ->
			processor.handleReturnValue(returnValue, returnTypeResponseEntityProduces, mavContainer, webRequest));
}
 
Example 25
@Test  // SPR-9142
public void shouldFailHandlingWhenAcceptHeaderIllegal() throws Exception {
	ResponseEntity<String> returnValue = new ResponseEntity<>("Body", HttpStatus.ACCEPTED);
	servletRequest.addHeader("Accept", "01");

	assertThatExceptionOfType(HttpMediaTypeNotAcceptableException.class).isThrownBy(() ->
			processor.handleReturnValue(returnValue, returnTypeResponseEntity, mavContainer, webRequest));
}
 
Example 26
@Test(expected = HttpMediaTypeNotAcceptableException.class)  // SPR-9603
public void getHandlerRequestMethodMatchFalsePositive() throws Exception {
	MockHttpServletRequest request = new MockHttpServletRequest("GET", "/users");
	request.addHeader("Accept", "application/xml");
	this.handlerMapping.registerHandler(new UserController());
	this.handlerMapping.getHandler(request);
}
 
Example 27
private void testHttpMediaTypeNotAcceptableException(String url) throws Exception {
	try {
		MockHttpServletRequest request = new MockHttpServletRequest("GET", url);
		request.addHeader("Accept", "application/json");
		this.handlerMapping.getHandler(request);
		fail("HttpMediaTypeNotAcceptableException expected");
	}
	catch (HttpMediaTypeNotAcceptableException ex) {
		assertEquals("Invalid supported producible media types",
				Collections.singletonList(new MediaType("application", "xml")),
				ex.getSupportedMediaTypes());
	}
}
 
Example 28
Source Project: spring-analysis-note   Source File: ContentNegotiationManager.java    License: MIT License 5 votes vote down vote up
@Override
public List<MediaType> resolveMediaTypes(NativeWebRequest request) throws HttpMediaTypeNotAcceptableException {
	for (ContentNegotiationStrategy strategy : this.strategies) {
		List<MediaType> mediaTypes = strategy.resolveMediaTypes(request);
		if (mediaTypes.equals(MEDIA_TYPE_ALL_LIST)) {
			continue;
		}
		return mediaTypes;
	}
	return MEDIA_TYPE_ALL_LIST;
}
 
Example 29
@Test(expected = HttpMediaTypeNotAcceptableException.class)  // SPR-10170
public void favorPathWithIgnoreUnknownPathExtensionTurnedOff() throws Exception {
	this.factoryBean.setFavorPathExtension(true);
	this.factoryBean.setIgnoreUnknownPathExtensions(false);
	this.factoryBean.afterPropertiesSet();
	ContentNegotiationManager manager = this.factoryBean.getObject();

	this.servletRequest.setRequestURI("/flower.foobarbaz");
	this.servletRequest.addParameter("format", "json");

	manager.resolveMediaTypes(this.webRequest);
}
 
Example 30
@Test(expected = HttpMediaTypeNotAcceptableException.class)  // SPR-10170
public void favorParameterWithUnknownMediaType() throws HttpMediaTypeNotAcceptableException {
	this.factoryBean.setFavorParameter(true);
	this.factoryBean.afterPropertiesSet();
	ContentNegotiationManager manager = this.factoryBean.getObject();

	this.servletRequest.setRequestURI("/flower");
	this.servletRequest.setParameter("format", "invalid");

	manager.resolveMediaTypes(this.webRequest);
}