Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
ecea82d3
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
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,体验更适合开发者的 AI 搜索 >>
提交
ecea82d3
编写于
10月 23, 2017
作者:
J
Juergen Hoeller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Polishing
上级
f31069ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
85 addition
and
85 deletion
+85
-85
spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java
...springframework/core/type/StandardAnnotationMetadata.java
+2
-2
spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java
.../core/type/classreading/MethodMetadataReadingVisitor.java
+2
-1
spring-web/src/main/java/org/springframework/http/ContentDisposition.java
...ain/java/org/springframework/http/ContentDisposition.java
+81
-82
未找到文件。
spring-core/src/main/java/org/springframework/core/type/StandardAnnotationMetadata.java
浏览文件 @
ecea82d3
/*
/*
* Copyright 2002-201
6
the original author or authors.
* Copyright 2002-201
7
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -156,7 +156,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
...
@@ -156,7 +156,7 @@ public class StandardAnnotationMetadata extends StandardClassMetadata implements
public
Set
<
MethodMetadata
>
getAnnotatedMethods
(
String
annotationName
)
{
public
Set
<
MethodMetadata
>
getAnnotatedMethods
(
String
annotationName
)
{
try
{
try
{
Method
[]
methods
=
getIntrospectedClass
().
getDeclaredMethods
();
Method
[]
methods
=
getIntrospectedClass
().
getDeclaredMethods
();
Set
<
MethodMetadata
>
annotatedMethods
=
new
LinkedHashSet
<>();
Set
<
MethodMetadata
>
annotatedMethods
=
new
LinkedHashSet
<>(
4
);
for
(
Method
method
:
methods
)
{
for
(
Method
method
:
methods
)
{
if
(!
method
.
isBridge
()
&&
method
.
getAnnotations
().
length
>
0
&&
if
(!
method
.
isBridge
()
&&
method
.
getAnnotations
().
length
>
0
&&
AnnotatedElementUtils
.
isAnnotated
(
method
,
annotationName
))
{
AnnotatedElementUtils
.
isAnnotated
(
method
,
annotationName
))
{
...
...
spring-core/src/main/java/org/springframework/core/type/classreading/MethodMetadataReadingVisitor.java
浏览文件 @
ecea82d3
...
@@ -79,12 +79,13 @@ public class MethodMetadataReadingVisitor extends MethodVisitor implements Metho
...
@@ -79,12 +79,13 @@ public class MethodMetadataReadingVisitor extends MethodVisitor implements Metho
@Override
@Override
public
AnnotationVisitor
visitAnnotation
(
final
String
desc
,
boolean
visible
)
{
public
AnnotationVisitor
visitAnnotation
(
final
String
desc
,
boolean
visible
)
{
String
className
=
Type
.
getType
(
desc
).
getClassName
();
this
.
methodMetadataSet
.
add
(
this
);
this
.
methodMetadataSet
.
add
(
this
);
String
className
=
Type
.
getType
(
desc
).
getClassName
();
return
new
AnnotationAttributesReadingVisitor
(
return
new
AnnotationAttributesReadingVisitor
(
className
,
this
.
attributesMap
,
this
.
metaAnnotationMap
,
this
.
classLoader
);
className
,
this
.
attributesMap
,
this
.
metaAnnotationMap
,
this
.
classLoader
);
}
}
@Override
@Override
public
String
getMethodName
()
{
public
String
getMethodName
()
{
return
this
.
methodName
;
return
this
.
methodName
;
...
...
spring-web/src/main/java/org/springframework/http/ContentDisposition.java
浏览文件 @
ecea82d3
...
@@ -27,9 +27,8 @@ import org.springframework.util.Assert;
...
@@ -27,9 +27,8 @@ import org.springframework.util.Assert;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
import
org.springframework.util.StringUtils
;
import
static
java
.
nio
.
charset
.
StandardCharsets
.
ISO_8859_1
;
import
static
java
.
nio
.
charset
.
StandardCharsets
.*;
import
static
java
.
nio
.
charset
.
StandardCharsets
.
UTF_8
;
import
static
java
.
time
.
format
.
DateTimeFormatter
.*;
import
static
java
.
time
.
format
.
DateTimeFormatter
.
RFC_1123_DATE_TIME
;
/**
/**
* Represent the Content-Disposition type and parameters as defined in RFC 2183.
* Represent the Content-Disposition type and parameters as defined in RFC 2183.
...
@@ -151,6 +150,85 @@ public class ContentDisposition {
...
@@ -151,6 +150,85 @@ public class ContentDisposition {
}
}
@Override
public
boolean
equals
(
Object
other
)
{
if
(
this
==
other
)
{
return
true
;
}
if
(!(
other
instanceof
ContentDisposition
))
{
return
false
;
}
ContentDisposition
otherCd
=
(
ContentDisposition
)
other
;
return
(
ObjectUtils
.
nullSafeEquals
(
this
.
type
,
otherCd
.
type
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
name
,
otherCd
.
name
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
filename
,
otherCd
.
filename
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
charset
,
otherCd
.
charset
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
size
,
otherCd
.
size
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
creationDate
,
otherCd
.
creationDate
)&&
ObjectUtils
.
nullSafeEquals
(
this
.
modificationDate
,
otherCd
.
modificationDate
)&&
ObjectUtils
.
nullSafeEquals
(
this
.
readDate
,
otherCd
.
readDate
));
}
@Override
public
int
hashCode
()
{
int
result
=
ObjectUtils
.
nullSafeHashCode
(
this
.
type
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
name
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
filename
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
charset
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
size
);
result
=
31
*
result
+
(
creationDate
!=
null
?
creationDate
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
modificationDate
!=
null
?
modificationDate
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
readDate
!=
null
?
readDate
.
hashCode
()
:
0
);
return
result
;
}
/**
* Return the header value for this content disposition as defined in RFC 2183.
* @see #parse(String)
*/
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
this
.
type
!=
null
)
{
sb
.
append
(
this
.
type
);
}
if
(
this
.
name
!=
null
)
{
sb
.
append
(
"; name=\""
);
sb
.
append
(
this
.
name
).
append
(
'\"'
);
}
if
(
this
.
filename
!=
null
)
{
if
(
this
.
charset
==
null
||
StandardCharsets
.
US_ASCII
.
equals
(
this
.
charset
))
{
sb
.
append
(
"; filename=\""
);
sb
.
append
(
this
.
filename
).
append
(
'\"'
);
}
else
{
sb
.
append
(
"; filename*="
);
sb
.
append
(
encodeHeaderFieldParam
(
this
.
filename
,
this
.
charset
));
}
}
if
(
this
.
size
!=
null
)
{
sb
.
append
(
"; size="
);
sb
.
append
(
this
.
size
);
}
if
(
this
.
creationDate
!=
null
)
{
sb
.
append
(
"; creation-date=\""
);
sb
.
append
(
RFC_1123_DATE_TIME
.
format
(
this
.
creationDate
));
sb
.
append
(
'\"'
);
}
if
(
this
.
modificationDate
!=
null
)
{
sb
.
append
(
"; modification-date=\""
);
sb
.
append
(
RFC_1123_DATE_TIME
.
format
(
this
.
modificationDate
));
sb
.
append
(
'\"'
);
}
if
(
this
.
readDate
!=
null
)
{
sb
.
append
(
"; read-date=\""
);
sb
.
append
(
RFC_1123_DATE_TIME
.
format
(
this
.
readDate
));
sb
.
append
(
'\"'
);
}
return
sb
.
toString
();
}
/**
/**
* Return a builder for a {@code ContentDisposition}.
* Return a builder for a {@code ContentDisposition}.
* @param type the disposition type like for example {@literal inline},
* @param type the disposition type like for example {@literal inline},
...
@@ -170,7 +248,6 @@ public class ContentDisposition {
...
@@ -170,7 +248,6 @@ public class ContentDisposition {
/**
/**
* Parse a {@literal Content-Disposition} header value as defined in RFC 2183.
* Parse a {@literal Content-Disposition} header value as defined in RFC 2183.
*
* @param contentDisposition the {@literal Content-Disposition} header value
* @param contentDisposition the {@literal Content-Disposition} header value
* @return the parsed content disposition
* @return the parsed content disposition
* @see #toString()
* @see #toString()
...
@@ -286,84 +363,6 @@ public class ContentDisposition {
...
@@ -286,84 +363,6 @@ public class ContentDisposition {
c
==
'.'
||
c
==
'^'
||
c
==
'_'
||
c
==
'`'
||
c
==
'|'
||
c
==
'~'
;
c
==
'.'
||
c
==
'^'
||
c
==
'_'
||
c
==
'`'
||
c
==
'|'
||
c
==
'~'
;
}
}
@Override
public
boolean
equals
(
Object
other
)
{
if
(
this
==
other
)
{
return
true
;
}
if
(!(
other
instanceof
ContentDisposition
))
{
return
false
;
}
ContentDisposition
otherCd
=
(
ContentDisposition
)
other
;
return
(
ObjectUtils
.
nullSafeEquals
(
this
.
type
,
otherCd
.
type
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
name
,
otherCd
.
name
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
filename
,
otherCd
.
filename
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
charset
,
otherCd
.
charset
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
size
,
otherCd
.
size
)
&&
ObjectUtils
.
nullSafeEquals
(
this
.
creationDate
,
otherCd
.
creationDate
)&&
ObjectUtils
.
nullSafeEquals
(
this
.
modificationDate
,
otherCd
.
modificationDate
)&&
ObjectUtils
.
nullSafeEquals
(
this
.
readDate
,
otherCd
.
readDate
));
}
@Override
public
int
hashCode
()
{
int
result
=
ObjectUtils
.
nullSafeHashCode
(
this
.
type
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
name
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
filename
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
charset
);
result
=
31
*
result
+
ObjectUtils
.
nullSafeHashCode
(
this
.
size
);
result
=
31
*
result
+
(
creationDate
!=
null
?
creationDate
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
modificationDate
!=
null
?
modificationDate
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
readDate
!=
null
?
readDate
.
hashCode
()
:
0
);
return
result
;
}
/**
* Return the header value for this content disposition as defined in RFC 2183.
* @see #parse(String)
*/
@Override
public
String
toString
()
{
StringBuilder
sb
=
new
StringBuilder
();
if
(
this
.
type
!=
null
)
{
sb
.
append
(
this
.
type
);
}
if
(
this
.
name
!=
null
)
{
sb
.
append
(
"; name=\""
);
sb
.
append
(
this
.
name
).
append
(
'\"'
);
}
if
(
this
.
filename
!=
null
)
{
if
(
this
.
charset
==
null
||
StandardCharsets
.
US_ASCII
.
equals
(
this
.
charset
))
{
sb
.
append
(
"; filename=\""
);
sb
.
append
(
this
.
filename
).
append
(
'\"'
);
}
else
{
sb
.
append
(
"; filename*="
);
sb
.
append
(
encodeHeaderFieldParam
(
this
.
filename
,
this
.
charset
));
}
}
if
(
this
.
size
!=
null
)
{
sb
.
append
(
"; size="
);
sb
.
append
(
this
.
size
);
}
if
(
this
.
creationDate
!=
null
)
{
sb
.
append
(
"; creation-date=\""
);
sb
.
append
(
RFC_1123_DATE_TIME
.
format
(
this
.
creationDate
));
sb
.
append
(
'\"'
);
}
if
(
this
.
modificationDate
!=
null
)
{
sb
.
append
(
"; modification-date=\""
);
sb
.
append
(
RFC_1123_DATE_TIME
.
format
(
this
.
modificationDate
));
sb
.
append
(
'\"'
);
}
if
(
this
.
readDate
!=
null
)
{
sb
.
append
(
"; read-date=\""
);
sb
.
append
(
RFC_1123_DATE_TIME
.
format
(
this
.
readDate
));
sb
.
append
(
'\"'
);
}
return
sb
.
toString
();
}
/**
/**
* Encode the given header field param as describe in RFC 5987.
* Encode the given header field param as describe in RFC 5987.
* @param input the header field param
* @param input the header field param
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录