Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
4431a76a
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,发现更多精彩内容 >>
提交
4431a76a
编写于
4月 15, 2016
作者:
S
Stephane Maldini
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update addCookie signature and improve client cookie
上级
b2ca2164
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
4 addition
and
96 deletion
+4
-96
spring-web-reactive/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpRequest.java
...mework/http/client/reactive/ReactorClientHttpRequest.java
+3
-95
spring-web-reactive/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpResponse.java
...ework/http/server/reactive/ReactorServerHttpResponse.java
+1
-1
未找到文件。
spring-web-reactive/src/main/java/org/springframework/http/client/reactive/ReactorClientHttpRequest.java
浏览文件 @
4431a76a
...
@@ -17,11 +17,9 @@
...
@@ -17,11 +17,9 @@
package
org.springframework.http.client.reactive
;
package
org.springframework.http.client.reactive
;
import
java.net.URI
;
import
java.net.URI
;
import
java.time.Duration
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Optional
;
import
io.netty.handler.codec.http.cookie.Cookie
;
import
io.netty.handler.codec.http.cookie.
Default
Cookie
;
import
org.reactivestreams.Publisher
;
import
org.reactivestreams.Publisher
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Flux
;
import
reactor.core.publisher.Mono
;
import
reactor.core.publisher.Mono
;
...
@@ -30,10 +28,8 @@ import reactor.io.netty.http.HttpClient;
...
@@ -30,10 +28,8 @@ import reactor.io.netty.http.HttpClient;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.core.io.buffer.DataBuffer
;
import
org.springframework.core.io.buffer.DataBufferAllocator
;
import
org.springframework.core.io.buffer.DataBufferAllocator
;
import
org.springframework.http.HttpCookie
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseCookie
;
/**
/**
* {@link ClientHttpRequest} implementation for the Reactor Net HTTP client
* {@link ClientHttpRequest} implementation for the Reactor Net HTTP client
...
@@ -110,7 +106,7 @@ public class ReactorClientHttpRequest extends AbstractClientHttpRequest {
...
@@ -110,7 +106,7 @@ public class ReactorClientHttpRequest extends AbstractClientHttpRequest {
getHeaders
().
entrySet
().
stream
().
forEach
(
e
->
getHeaders
().
entrySet
().
stream
().
forEach
(
e
->
channel
.
headers
().
set
(
e
.
getKey
(),
e
.
getValue
()));
channel
.
headers
().
set
(
e
.
getKey
(),
e
.
getValue
()));
getCookies
().
values
().
stream
().
flatMap
(
Collection:
:
stream
).
forEach
(
cookie
->
getCookies
().
values
().
stream
().
flatMap
(
Collection:
:
stream
).
forEach
(
cookie
->
channel
.
addCookie
(
cookie
.
getName
(),
new
NettyCookie
(
cookie
)));
channel
.
addCookie
(
new
DefaultCookie
(
cookie
.
getName
(),
cookie
.
getValue
()
)));
return
Mono
.
empty
();
return
Mono
.
empty
();
})
})
.
after
(()
->
{
.
after
(()
->
{
...
@@ -125,95 +121,7 @@ public class ReactorClientHttpRequest extends AbstractClientHttpRequest {
...
@@ -125,95 +121,7 @@ public class ReactorClientHttpRequest extends AbstractClientHttpRequest {
.
map
(
httpChannel
->
new
ReactorClientHttpResponse
(
httpChannel
,
allocator
));
.
map
(
httpChannel
->
new
ReactorClientHttpResponse
(
httpChannel
,
allocator
));
}
}
private
final
static
class
NettyCookie
implements
Cookie
{
private
final
HttpCookie
httpCookie
;
public
NettyCookie
(
HttpCookie
httpCookie
)
{
this
.
httpCookie
=
httpCookie
;
}
@Override
public
String
name
()
{
return
this
.
httpCookie
.
getName
();
}
@Override
public
String
value
()
{
return
this
.
httpCookie
.
getValue
();
}
@Override
public
boolean
isHttpOnly
()
{
return
true
;
}
@Override
public
long
maxAge
()
{
return
-
1
;
}
@Override
public
String
domain
()
{
return
null
;
}
@Override
public
String
path
()
{
return
null
;
}
@Override
public
void
setValue
(
String
value
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
boolean
wrap
()
{
return
false
;
}
@Override
public
void
setWrap
(
boolean
wrap
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
void
setDomain
(
String
domain
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
void
setPath
(
String
path
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
void
setMaxAge
(
long
maxAge
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
void
setSecure
(
boolean
secure
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
void
setHttpOnly
(
boolean
httpOnly
)
{
throw
new
UnsupportedOperationException
(
"Read-Only Cookie"
);
}
@Override
public
int
compareTo
(
Cookie
o
)
{
return
httpCookie
.
getName
().
compareTo
(
o
.
name
());
}
@Override
public
boolean
isSecure
()
{
return
false
;
}
}
}
}
spring-web-reactive/src/main/java/org/springframework/http/server/reactive/ReactorServerHttpResponse.java
浏览文件 @
4431a76a
...
@@ -85,7 +85,7 @@ public class ReactorServerHttpResponse extends AbstractServerHttpResponse {
...
@@ -85,7 +85,7 @@ public class ReactorServerHttpResponse extends AbstractServerHttpResponse {
httpCookie
.
getPath
().
ifPresent
(
cookie:
:
setPath
);
httpCookie
.
getPath
().
ifPresent
(
cookie:
:
setPath
);
cookie
.
setSecure
(
httpCookie
.
isSecure
());
cookie
.
setSecure
(
httpCookie
.
isSecure
());
cookie
.
setHttpOnly
(
httpCookie
.
isHttpOnly
());
cookie
.
setHttpOnly
(
httpCookie
.
isHttpOnly
());
this
.
channel
.
addResponseCookie
(
name
,
cookie
);
this
.
channel
.
addResponseCookie
(
cookie
);
}
}
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录