Deprecated
as of 5.2.4. See class-level note in
ContentNegotiationManagerFactoryBean on the deprecation of path
extension config options.
ContentNegotiationStrategy that resolves the file extension in the
request path to a key to be used to look up a media type.
If the file extension is not found in the explicit registrations provided
to the constructor, the MediaTypeFactory is used as a fallback
mechanism.
| Modifier and Type | Field and Description |
|---|---|
| private UrlPathHelper |
| Access | Constructor and Description |
|---|---|
| public | |
| public | PathExtensionContentNegotiationStrategy(Map<String, MediaType> mediaTypes)
Create an instance with the given map of file extensions and media types. |
| Modifier and Type | Method and Description |
|---|---|
| public MediaType | Returns: the MediaType for the extension, ornull if none foundthe resource to look up resource)A public method exposing the knowledge of the path extension strategy to
resolve file extensions to a |
| protected String | getMediaTypeKey(NativeWebRequest webRequest)
Implements abstract org. Extract a key from the request to use to look up media types. |
| public void | setUrlPathHelper(UrlPathHelper urlPathHelper)
Configure a |
| public void | setUseJaf(boolean useJaf)
Deprecated
as of 5.0, in favor of
setUseRegisteredExtensionsOnly(boolean).
Indicate whether to use the Java Activation Framework as a fallback option to map from file extensions to media types. |
| urlPathHelper | back to summary |
|---|---|
| private UrlPathHelper urlPathHelper | |
| PathExtensionContentNegotiationStrategy | back to summary |
|---|---|
| public PathExtensionContentNegotiationStrategy() Create an instance without any mappings to start with. Mappings may be added later on if any extensions are resolved through the Java Activation framework. | |
| PathExtensionContentNegotiationStrategy | back to summary |
|---|---|
| public PathExtensionContentNegotiationStrategy(Map<String, MediaType> mediaTypes) Create an instance with the given map of file extensions and media types. | |
| getMediaTypeForResource | back to summary |
|---|---|
| public MediaType getMediaTypeForResource(Resource resource) A public method exposing the knowledge of the path extension strategy to
resolve file extensions to a | |
| getMediaTypeKey | back to summary |
|---|---|
| protected String getMediaTypeKey(NativeWebRequest webRequest) Implements abstract org. Doc from org. Extract a key from the request to use to look up media types. | |
| setUrlPathHelper | back to summary |
|---|---|
| public void setUrlPathHelper(UrlPathHelper urlPathHelper) Configure a
| |
| setUseJaf | back to summary |
|---|---|
| public void setUseJaf(boolean useJaf)
Deprecated as of 5.0, in favor of Indicate whether to use the Java Activation Framework as a fallback option to map from file extensions to media types.
| |