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 SummaryFields inherited from class org.springframework.web.accept.AbstractMappingContentNegotiationStrategyloggerFields inherited from interface org.springframework.web.accept.ContentNegotiationStrategyMEDIA_TYPE_ALL_LIST
- 
Constructor SummaryConstructorsConstructorDescriptionDeprecated.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 SummaryModifier 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.AbstractMappingContentNegotiationStrategyhandleMatch, handleNoMatch, isIgnoreUnknownExtensions, isUseRegisteredExtensionsOnly, resolveMediaTypeKey, resolveMediaTypes, setIgnoreUnknownExtensions, setUseRegisteredExtensionsOnlyMethods inherited from class org.springframework.web.accept.MappingMediaTypeFileExtensionResolveraddMapping, getAllFileExtensions, getAllMediaTypes, getMediaTypes, lookupMediaType, resolveFileExtensions
- 
Constructor Details- 
PathExtensionContentNegotiationStrategypublic 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.
- 
PathExtensionContentNegotiationStrategyDeprecated.Create an instance with the given map of file extensions and media types.
 
- 
- 
Method Details- 
setUrlPathHelperDeprecated.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
 
- 
setUseJafDeprecated.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.
- 
getMediaTypeKeyDeprecated.Description copied from class:AbstractMappingContentNegotiationStrategyExtract a key from the request to use to look up media types.- Specified by:
- getMediaTypeKeyin class- AbstractMappingContentNegotiationStrategy
- Returns:
- the lookup key, or nullif none
 
- 
getMediaTypeForResourceDeprecated.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.