org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy Java Examples

The following examples show how to use org.springframework.web.accept.ServletPathExtensionContentNegotiationStrategy. 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 File: ResourceHttpRequestHandler.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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
Source File: ResourceHttpRequestHandler.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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
Source File: ResourceHttpRequestHandler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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));
}