类 MediaTypeFactory
- java.lang.Object
- org.springframework.http.MediaTypeFactory
public final class MediaTypeFactory extends Object
- 从以下版本开始:
- 5.0
- 作者:
- Juergen Hoeller, Arjen Poutsma
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static Optional<MediaType>
getMediaType(String filename)
Determine a media type for the given file name, if possible.static Optional<MediaType>
getMediaType(Resource resource)
Determine a media type for the given resource, if possible.static List<MediaType>
getMediaTypes(String filename)
Determine the media types for the given file name, if possible.
方法详细资料
getMediaType
public static Optional<MediaType> getMediaType(@Nullable Resource resource)
Determine a media type for the given resource, if possible.- 参数:
resource
- the resource to introspect- 返回:
- the corresponding media type, or
null
if none found
getMediaType
public static Optional<MediaType> getMediaType(@Nullable String filename)
Determine a media type for the given file name, if possible.- 参数:
filename
- the file name plus extension- 返回:
- the corresponding media type, or
null
if none found
getMediaTypes
public static List<MediaType> getMediaTypes(@Nullable String filename)
Determine the media types for the given file name, if possible.- 参数:
filename
- the file name plus extension- 返回:
- the corresponding media types, or an empty list if none found