List of usage examples for org.springframework.web.accept ServletPathExtensionContentNegotiationStrategy ServletPathExtensionContentNegotiationStrategy
public ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext,
@Nullable Map<String, MediaType> mediaTypes)
From source file:org.springframework.web.servlet.resource.ResourceHttpRequestHandler.java
/** * Initialize the content negotiation strategy depending on the {@code ContentNegotiationManager} * setup and the availability of a {@code ServletContext}. * @see ServletPathExtensionContentNegotiationStrategy * @see PathExtensionContentNegotiationStrategy *//*from w w w . j a v a 2 s. c o m*/ 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)); }