类 PathExtensionContentNegotiationStrategy
- java.lang.Object
- org.springframework.web.accept.MappingMediaTypeFileExtensionResolver
- org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
- org.springframework.web.accept.PathExtensionContentNegotiationStrategy
@Deprecated public class PathExtensionContentNegotiationStrategy extends AbstractMappingContentNegotiationStrategy
已过时。as of 5.2.4. See class-level note inContentNegotiationManagerFactoryBean
on the deprecation of path extension config options.AContentNegotiationStrategy
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.- 从以下版本开始:
- 3.2
- 作者:
- Rossen Stoyanchev
字段概要
从类继承的字段 org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
logger
从接口继承的字段 org.springframework.web.accept.ContentNegotiationStrategy
MEDIA_TYPE_ALL_LIST
构造器概要
构造器 构造器 说明 PathExtensionContentNegotiationStrategy()
已过时。Create an instance without any mappings to start with.PathExtensionContentNegotiationStrategy(Map<String,MediaType> mediaTypes)
已过时。Create an instance with the given map of file extensions and media types.
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 MediaType
getMediaTypeForResource(Resource resource)
已过时。protected String
getMediaTypeKey(NativeWebRequest webRequest)
已过时。Extract a key from the request to use to look up media types.void
setUrlPathHelper(UrlPathHelper urlPathHelper)
已过时。Configure aUrlPathHelper
to use ingetMediaTypeKey(org.springframework.web.context.request.NativeWebRequest)
in order to derive the lookup path for a target request URL path.void
setUseJaf(boolean useJaf)
已过时。as of 5.0, in favor ofAbstractMappingContentNegotiationStrategy.setUseRegisteredExtensionsOnly(boolean)
.从类继承的方法 org.springframework.web.accept.AbstractMappingContentNegotiationStrategy
handleMatch, handleNoMatch, isIgnoreUnknownExtensions, isUseRegisteredExtensionsOnly, resolveMediaTypeKey, resolveMediaTypes, setIgnoreUnknownExtensions, setUseRegisteredExtensionsOnly
从类继承的方法 org.springframework.web.accept.MappingMediaTypeFileExtensionResolver
addMapping, getAllFileExtensions, getAllMediaTypes, getMediaTypes, lookupMediaType, resolveFileExtensions
构造器详细资料
PathExtensionContentNegotiationStrategy
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
public PathExtensionContentNegotiationStrategy(@Nullable Map<String,MediaType> mediaTypes)
已过时。Create an instance with the given map of file extensions and media types.
方法详细资料
setUrlPathHelper
public void setUrlPathHelper(UrlPathHelper urlPathHelper)
已过时。Configure aUrlPathHelper
to use ingetMediaTypeKey(org.springframework.web.context.request.NativeWebRequest)
in order to derive the lookup path for a target request URL path.- 从以下版本开始:
- 4.2.8
setUseJaf
@Deprecated public void setUseJaf(boolean useJaf)
已过时。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
@Nullable protected String getMediaTypeKey(NativeWebRequest webRequest)
已过时。Extract a key from the request to use to look up media types.- 指定者:
getMediaTypeKey
在类中AbstractMappingContentNegotiationStrategy
- 返回:
- the lookup key, or
null
if none
getMediaTypeForResource
@Nullable public MediaType getMediaTypeForResource(Resource resource)
已过时。A public method exposing the knowledge of the path extension strategy to resolve file extensions to aMediaType
in this case for a givenResource
. The method first looks up any explicitly registered file extensions first and then falls back onMediaTypeFactory
if available.- 参数:
resource
- the resource to look up- 返回:
- the MediaType for the extension, or
null
if none found - 从以下版本开始:
- 4.3