public class PathExtensionContentNegotiationStrategy extends AbstractMappingContentNegotiationStrategy
The presence of the Java Activation framework is detected and enabled
automatically but the setUseJaf(boolean) property may be used to
override that setting.
| Constructor and Description |
|---|
PathExtensionContentNegotiationStrategy()
Create an instance without any mappings to start with.
|
PathExtensionContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
Create an instance with the given extension-to-MediaType lookup.
|
| Modifier and Type | Method and Description |
|---|---|
protected String |
getMediaTypeKey(NativeWebRequest webRequest)
Sub-classes must extract the key to use to look up a media type.
|
protected void |
handleMatch(String extension,
MediaType mediaType)
Invoked when a matching media type is found in the lookup map.
|
protected MediaType |
handleNoMatch(NativeWebRequest webRequest,
String extension)
Invoked when no matching media type is found in the lookup map.
|
void |
setUseJaf(boolean useJaf)
Indicate whether to use the Java Activation Framework to map from file extensions to media types.
|
resolveMediaTypesaddMapping, getAllFileExtensions, lookupMediaType, resolveFileExtensionsclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAllFileExtensions, resolveFileExtensionspublic PathExtensionContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
IllegalArgumentException - if a media type string cannot be parsedpublic PathExtensionContentNegotiationStrategy()
public void setUseJaf(boolean useJaf)
Default is true, i.e. the Java Activation Framework is used (if available).
protected String getMediaTypeKey(NativeWebRequest webRequest)
AbstractMappingContentNegotiationStrategygetMediaTypeKey in class AbstractMappingContentNegotiationStrategynull if the key cannot be derivedprotected void handleMatch(String extension, MediaType mediaType)
AbstractMappingContentNegotiationStrategyhandleMatch in class AbstractMappingContentNegotiationStrategyprotected MediaType handleNoMatch(NativeWebRequest webRequest, String extension)
AbstractMappingContentNegotiationStrategyhandleNoMatch in class AbstractMappingContentNegotiationStrategy