Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dk131072
spring-framework
提交
f7073943
S
spring-framework
项目概览
dk131072
/
spring-framework
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f7073943
编写于
12月 08, 2013
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
8580d2d1
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
30 addition
and
30 deletion
+30
-30
spring-web/src/main/java/org/springframework/http/MediaType.java
...web/src/main/java/org/springframework/http/MediaType.java
+30
-30
未找到文件。
spring-web/src/main/java/org/springframework/http/MediaType.java
浏览文件 @
f7073943
...
...
@@ -234,16 +234,15 @@ public class MediaType extends MimeType implements Serializable {
* Create a new {@code MediaType} for the given type, subtype, and character set.
* @param type the primary type
* @param subtype the subtype
* @param char
S
et the character set
* @param char
s
et the character set
* @throws IllegalArgumentException if any of the parameters contain illegal characters
*/
public
MediaType
(
String
type
,
String
subtype
,
Charset
char
S
et
)
{
super
(
type
,
subtype
,
char
S
et
);
public
MediaType
(
String
type
,
String
subtype
,
Charset
char
s
et
)
{
super
(
type
,
subtype
,
char
s
et
);
}
/**
* Create a new {@code MediaType} for the given type, subtype, and quality value.
*
* @param type the primary type
* @param subtype the subtype
* @param qualityValue the quality value
...
...
@@ -275,6 +274,7 @@ public class MediaType extends MimeType implements Serializable {
super
(
type
,
subtype
,
parameters
);
}
protected
void
checkParameters
(
String
attribute
,
String
value
)
{
super
.
checkParameters
(
attribute
,
value
);
if
(
PARAM_QUALITY_FACTOR
.
equals
(
attribute
))
{
...
...
@@ -343,6 +343,7 @@ public class MediaType extends MimeType implements Serializable {
return
new
MediaType
(
this
,
params
);
}
/**
* Parse the given String value into a {@code MediaType} object,
* with this method name following the 'valueOf' naming convention
...
...
@@ -360,7 +361,6 @@ public class MediaType extends MimeType implements Serializable {
* @throws InvalidMediaTypeException if the string cannot be parsed
*/
public
static
MediaType
parseMediaType
(
String
mediaType
)
{
MimeType
type
;
try
{
type
=
MimeTypeUtils
.
parseMimeType
(
mediaType
);
...
...
@@ -368,7 +368,6 @@ public class MediaType extends MimeType implements Serializable {
catch
(
InvalidMimeTypeException
ex
)
{
throw
new
InvalidMediaTypeException
(
ex
);
}
try
{
return
new
MediaType
(
type
.
getType
(),
type
.
getSubtype
(),
type
.
getParameters
());
}
...
...
@@ -412,18 +411,18 @@ public class MediaType extends MimeType implements Serializable {
* Sorts the given list of {@code MediaType} objects by specificity.
* <p>Given two media types:
* <ol>
*
<li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
*
wildcard is ordered before the other.</li>
*
<li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
*
remain their current order.</li>
*
<li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
*
the wildcard is sorted before the other.</li>
*
<li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
*
and remain their current order.</li>
*
<li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
*
with the highest quality value is ordered before the other.</li>
*
<li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
*
media type with the most parameters is ordered before the other.</li>
* <li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
* wildcard is ordered before the other.</li>
* <li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
* remain their current order.</li>
* <li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
* the wildcard is sorted before the other.</li>
* <li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
* and remain their current order.</li>
* <li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
* with the highest quality value is ordered before the other.</li>
* <li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
* media type with the most parameters is ordered before the other.</li>
* </ol>
* <p>For example:
* <blockquote>audio/basic < audio/* < */*</blockquote>
...
...
@@ -445,18 +444,18 @@ public class MediaType extends MimeType implements Serializable {
* Sorts the given list of {@code MediaType} objects by quality value.
* <p>Given two media types:
* <ol>
*
<li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
*
with the highest quality value is ordered before the other.</li>
*
<li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
*
wildcard is ordered before the other.</li>
*
<li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
*
remain their current order.</li>
*
<li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
*
the wildcard is sorted before the other.</li>
*
<li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
*
and remain their current order.</li>
*
<li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
*
media type with the most parameters is ordered before the other.</li>
* <li>if the two media types have different {@linkplain #getQualityValue() quality value}, then the media type
* with the highest quality value is ordered before the other.</li>
* <li>if either media type has a {@linkplain #isWildcardType() wildcard type}, then the media type without the
* wildcard is ordered before the other.</li>
* <li>if the two media types have different {@linkplain #getType() types}, then they are considered equal and
* remain their current order.</li>
* <li>if either media type has a {@linkplain #isWildcardSubtype() wildcard subtype}, then the media type without
* the wildcard is sorted before the other.</li>
* <li>if the two media types have different {@linkplain #getSubtype() subtypes}, then they are considered equal
* and remain their current order.</li>
* <li>if the two media types have a different amount of {@linkplain #getParameter(String) parameters}, then the
* media type with the most parameters is ordered before the other.</li>
* </ol>
* @param mediaTypes the list of media types to be sorted
* @see #getQualityValue()
...
...
@@ -524,6 +523,7 @@ public class MediaType extends MimeType implements Serializable {
}
};
/**
* Comparator used by {@link #sortBySpecificity(List)}.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录