public class ServletPathExtensionContentNegotiationStrategy extends PathExtensionContentNegotiationStrategy
PathExtensionContentNegotiationStrategy
that uses
ServletContext.getMimeType(String)
as a fallback mechanism when
matching a path extension to a media type.Constructor and Description |
---|
ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext)
Create an instance without any mappings to start with.
|
ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext,
Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
Modifier and Type | Method and Description |
---|---|
protected MediaType |
handleNoMatch(NativeWebRequest webRequest,
String extension)
Look up the given extension via
ServletContext.getMimeType(String)
and if that doesn't help, delegate to the parent implementation. |
getMediaTypeKey, handleMatch, setUseJaf
resolveMediaTypes
addMapping, getAllFileExtensions, lookupMediaType, resolveFileExtensions
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllFileExtensions, resolveFileExtensions
public ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext, Map<String,MediaType> mediaTypes)
IllegalArgumentException
- if a media type string cannot be parsedpublic ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext)
ServletContext.getMimeType(String)
or through the Java Activation
framework.protected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
ServletContext.getMimeType(String)
and if that doesn't help, delegate to the parent implementation.handleNoMatch
in class PathExtensionContentNegotiationStrategy