Java Code Examples for org.springframework.web.accept.PathExtensionContentNegotiationStrategy#getMediaTypes()

The following examples show how to use org.springframework.web.accept.PathExtensionContentNegotiationStrategy#getMediaTypes() . 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
/**
 * Initialize the content negotiation strategy depending on the {@code ContentNegotiationManager}
 * setup and the availability of a {@code ServletContext}.
 * @see ServletPathExtensionContentNegotiationStrategy
 * @see PathExtensionContentNegotiationStrategy
 */
protected PathExtensionContentNegotiationStrategy initContentNegotiationStrategy() {
	Map<String, MediaType> mediaTypes = null;
	if (getContentNegotiationManager() != null) {
		PathExtensionContentNegotiationStrategy strategy =
				getContentNegotiationManager().getStrategy(PathExtensionContentNegotiationStrategy.class);
		if (strategy != null) {
			mediaTypes = new HashMap<>(strategy.getMediaTypes());
		}
	}
	return (getServletContext() != null ?
			new ServletPathExtensionContentNegotiationStrategy(getServletContext(), mediaTypes) :
			new PathExtensionContentNegotiationStrategy(mediaTypes));
}
 
Example 2
/**
 * Initialize the content negotiation strategy depending on the {@code ContentNegotiationManager}
 * setup and the availability of a {@code ServletContext}.
 * @see ServletPathExtensionContentNegotiationStrategy
 * @see PathExtensionContentNegotiationStrategy
 */
protected PathExtensionContentNegotiationStrategy initContentNegotiationStrategy() {
	Map<String, MediaType> mediaTypes = null;
	if (getContentNegotiationManager() != null) {
		PathExtensionContentNegotiationStrategy strategy =
				getContentNegotiationManager().getStrategy(PathExtensionContentNegotiationStrategy.class);
		if (strategy != null) {
			mediaTypes = new HashMap<>(strategy.getMediaTypes());
		}
	}
	return (getServletContext() != null ?
			new ServletPathExtensionContentNegotiationStrategy(getServletContext(), mediaTypes) :
			new PathExtensionContentNegotiationStrategy(mediaTypes));
}
 
Example 3
/**
 * Initialize the content negotiation strategy depending on the {@code ContentNegotiationManager}
 * setup and the availability of a {@code ServletContext}.
 * @see ServletPathExtensionContentNegotiationStrategy
 * @see PathExtensionContentNegotiationStrategy
 */
protected PathExtensionContentNegotiationStrategy initContentNegotiationStrategy() {
	Map<String, MediaType> mediaTypes = null;
	if (getContentNegotiationManager() != null) {
		PathExtensionContentNegotiationStrategy strategy =
				getContentNegotiationManager().getStrategy(PathExtensionContentNegotiationStrategy.class);
		if (strategy != null) {
			mediaTypes = new HashMap<String, MediaType>(strategy.getMediaTypes());
		}
	}
	return (getServletContext() != null ?
			new ServletPathExtensionContentNegotiationStrategy(getServletContext(), mediaTypes) :
			new PathExtensionContentNegotiationStrategy(mediaTypes));
}