类 MimeMappings
- java.lang.Object
- org.springframework.boot.web.server.MimeMappings
- 所有已实现的接口:
Iterable<MimeMappings.Mapping>
public final class MimeMappings extends Object implements Iterable<MimeMappings.Mapping>
Simple server-independent abstraction for mime mappings. Roughly equivalent to the <mime-mapping> element traditionally found in web.xml.- 从以下版本开始:
- 2.0.0
嵌套类概要
嵌套类 修饰符和类型 类 说明 static class
MimeMappings.Mapping
A single mime mapping.
字段概要
字段 修饰符和类型 字段 说明 static MimeMappings
DEFAULT
Default mime mapping commonly used.
构造器概要
构造器 构造器 说明 MimeMappings()
Create a new emptyMimeMappings
instance.MimeMappings(Map<String,String> mappings)
Create a newMimeMappings
from the specified mappings.MimeMappings(MimeMappings mappings)
Create a newMimeMappings
instance from the specified mappings.
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 String
add(String extension, String mimeType)
Add a new mime mapping.boolean
equals(Object obj)
String
get(String extension)
Get a mime mapping for the given extension.Collection<MimeMappings.Mapping>
getAll()
Returns all defined mappings.int
hashCode()
Iterator<MimeMappings.Mapping>
iterator()
String
remove(String extension)
Remove an existing mapping.static MimeMappings
unmodifiableMappings(MimeMappings mappings)
Create a new unmodifiable view of the specified mapping.从接口继承的方法 java.lang.Iterable
forEach, spliterator
字段详细资料
DEFAULT
public static final MimeMappings DEFAULT
Default mime mapping commonly used.
构造器详细资料
MimeMappings
public MimeMappings()
Create a new emptyMimeMappings
instance.
MimeMappings
public MimeMappings(MimeMappings mappings)
Create a newMimeMappings
instance from the specified mappings.- 参数:
mappings
- the source mappings
MimeMappings
public MimeMappings(Map<String,String> mappings)
Create a newMimeMappings
from the specified mappings.- 参数:
mappings
- the source mappings with extension as the key and mime-type as the value
方法详细资料
iterator
public Iterator<MimeMappings.Mapping> iterator()
- 指定者:
iterator
在接口中Iterable<MimeMappings.Mapping>
getAll
public Collection<MimeMappings.Mapping> getAll()
Returns all defined mappings.- 返回:
- the mappings.
add
public String add(String extension, String mimeType)
Add a new mime mapping.- 参数:
extension
- the file extension (excluding '.')mimeType
- the mime type to map- 返回:
- any previous mapping or
null
get
public String get(String extension)
Get a mime mapping for the given extension.- 参数:
extension
- the file extension (excluding '.')- 返回:
- a mime mapping or
null
remove
public String remove(String extension)
Remove an existing mapping.- 参数:
extension
- the file extension (excluding '.')- 返回:
- the removed mime mapping or
null
if no item was removed
unmodifiableMappings
public static MimeMappings unmodifiableMappings(MimeMappings mappings)
Create a new unmodifiable view of the specified mapping. Methods that attempt to modify the returned map will throwUnsupportedOperationException
s.- 参数:
mappings
- the mappings- 返回:
- an unmodifiable view of the specified mappings.