Package org.springframework.web.accept
Class PathExtensionContentNegotiationStrategy
java.lang.Object
org.springframework.web.accept.MappingMediaTypeFileExtensionResolver
org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
org.springframework.web.accept.PathExtensionContentNegotiationStrategy
- All Implemented Interfaces:
ContentNegotiationStrategy,MediaTypeFileExtensionResolver
- Direct Known Subclasses:
ServletPathExtensionContentNegotiationStrategy
@Deprecated
public class PathExtensionContentNegotiationStrategy
extends AbstractMappingContentNegotiationStrategy
Deprecated.
A
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.
- Since:
- 3.2
- Author:
- Rossen Stoyanchev
-
Field Summary
Fields inherited from class org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
loggerFields inherited from interface org.springframework.web.accept.ContentNegotiationStrategy
MEDIA_TYPE_ALL_LIST -
Constructor Summary
ConstructorsConstructorDescriptionDeprecated.Create an instance without any mappings to start with.PathExtensionContentNegotiationStrategy(Map<String, MediaType> mediaTypes) Deprecated.Create an instance with the given map of file extensions and media types. -
Method Summary
Modifier and TypeMethodDescriptiongetMediaTypeForResource(Resource resource) Deprecated.protected StringgetMediaTypeKey(NativeWebRequest webRequest) Deprecated.Extract a key from the request to use to look up media types.voidsetUrlPathHelper(UrlPathHelper urlPathHelper) Deprecated.Configure aUrlPathHelperto use ingetMediaTypeKey(org.springframework.web.context.request.NativeWebRequest)in order to derive the lookup path for a target request URL path.voidsetUseJaf(boolean useJaf) Deprecated.as of 5.0, in favor ofAbstractMappingContentNegotiationStrategy.setUseRegisteredExtensionsOnly(boolean).Methods inherited from class org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
handleMatch, handleNoMatch, isIgnoreUnknownExtensions, isUseRegisteredExtensionsOnly, resolveMediaTypeKey, resolveMediaTypes, setIgnoreUnknownExtensions, setUseRegisteredExtensionsOnlyMethods inherited from class org.springframework.web.accept.MappingMediaTypeFileExtensionResolver
addMapping, getAllFileExtensions, getAllMediaTypes, getMediaTypes, lookupMediaType, resolveFileExtensions
-
Constructor Details
-
PathExtensionContentNegotiationStrategy
public PathExtensionContentNegotiationStrategy()Deprecated.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
Deprecated.Create an instance with the given map of file extensions and media types.
-
-
Method Details
-
setUrlPathHelper
Deprecated.Configure aUrlPathHelperto use ingetMediaTypeKey(org.springframework.web.context.request.NativeWebRequest)in order to derive the lookup path for a target request URL path.- Since:
- 4.2.8
-
setUseJaf
Deprecated.as of 5.0, in favor ofAbstractMappingContentNegotiationStrategy.setUseRegisteredExtensionsOnly(boolean).Indicate whether to use the Java Activation Framework as a fallback option to map from file extensions to media types. -
getMediaTypeKey
Deprecated.Description copied from class:AbstractMappingContentNegotiationStrategyExtract a key from the request to use to look up media types.- Specified by:
getMediaTypeKeyin classAbstractMappingContentNegotiationStrategy- Returns:
- the lookup key, or
nullif none
-
getMediaTypeForResource
Deprecated.A public method exposing the knowledge of the path extension strategy to resolve file extensions to aMediaTypein this case for a givenResource. The method first looks up any explicitly registered file extensions first and then falls back onMediaTypeFactoryif available.- Parameters:
resource- the resource to look up- Returns:
- the MediaType for the extension, or
nullif none found - Since:
- 4.3
-
ContentNegotiationManagerFactoryBeanon the deprecation of path extension config options.