ContentNegotiationManagerFactoryBean
on the deprecation of path
extension config options.@Deprecated public class PathExtensionContentNegotiationStrategy extends AbstractMappingContentNegotiationStrategy
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.
logger
MEDIA_TYPE_ALL_LIST
Constructor and Description |
---|
PathExtensionContentNegotiationStrategy()
Deprecated.
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.
|
Modifier and Type | Method and Description |
---|---|
MediaType |
getMediaTypeForResource(Resource resource)
Deprecated.
|
protected String |
getMediaTypeKey(NativeWebRequest webRequest)
Deprecated.
Extract a key from the request to use to look up media types.
|
void |
setUrlPathHelper(UrlPathHelper urlPathHelper)
Deprecated.
Configure a
UrlPathHelper to use in getMediaTypeKey(org.springframework.web.context.request.NativeWebRequest)
in order to derive the lookup path for a target request URL path. |
void |
setUseJaf(boolean useJaf)
Deprecated.
as of 5.0, in favor of
AbstractMappingContentNegotiationStrategy.setUseRegisteredExtensionsOnly(boolean) . |
handleMatch, handleNoMatch, isIgnoreUnknownExtensions, isUseRegisteredExtensionsOnly, resolveMediaTypeKey, resolveMediaTypes, setIgnoreUnknownExtensions, setUseRegisteredExtensionsOnly
addMapping, getAllFileExtensions, getAllMediaTypes, getMediaTypes, lookupMediaType, resolveFileExtensions
public PathExtensionContentNegotiationStrategy()
public void setUrlPathHelper(UrlPathHelper urlPathHelper)
UrlPathHelper
to use in getMediaTypeKey(org.springframework.web.context.request.NativeWebRequest)
in order to derive the lookup path for a target request URL path.@Deprecated public void setUseJaf(boolean useJaf)
AbstractMappingContentNegotiationStrategy.setUseRegisteredExtensionsOnly(boolean)
.@Nullable protected String getMediaTypeKey(NativeWebRequest webRequest)
AbstractMappingContentNegotiationStrategy
getMediaTypeKey
in class AbstractMappingContentNegotiationStrategy
null
if none@Nullable public MediaType getMediaTypeForResource(Resource resource)
MediaType
in this case for a given
Resource
. The method first looks up any explicitly registered
file extensions first and then falls back on MediaTypeFactory
if available.resource
- the resource to look upnull
if none found