Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
33a0c720
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
33a0c720
编写于
10月 01, 2009
作者:
M
michaelm
浏览文件
操作
浏览文件
下载
差异文件
Merge
上级
3e4d0358
a5914016
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
4 deletion
+28
-4
test/java/net/Authenticator/B4933582.java
test/java/net/Authenticator/B4933582.java
+24
-2
test/sun/net/www/httptest/HttpTransaction.java
test/sun/net/www/httptest/HttpTransaction.java
+2
-1
test/sun/security/ssl/sun/net/www/httpstest/HttpTransaction.java
...n/security/ssl/sun/net/www/httpstest/HttpTransaction.java
+2
-1
未找到文件。
test/java/net/Authenticator/B4933582.java
浏览文件 @
33a0c720
...
@@ -125,9 +125,16 @@ public class B4933582 implements HttpCallback {
...
@@ -125,9 +125,16 @@ public class B4933582 implements HttpCallback {
firstTime
=
args
[
0
].
equals
(
"first"
);
firstTime
=
args
[
0
].
equals
(
"first"
);
MyAuthenticator
auth
=
new
MyAuthenticator
();
MyAuthenticator
auth
=
new
MyAuthenticator
();
Authenticator
.
setDefault
(
auth
);
Authenticator
.
setDefault
(
auth
);
AuthCacheValue
.
setAuthCache
(
new
CacheImpl
())
;
CacheImpl
cache
;
try
{
try
{
server
=
new
HttpServer
(
new
B4933582
(),
1
,
10
,
5009
);
if
(
firstTime
)
{
server
=
new
HttpServer
(
new
B4933582
(),
1
,
10
,
0
);
cache
=
new
CacheImpl
(
server
.
getLocalPort
());
}
else
{
cache
=
new
CacheImpl
();
server
=
new
HttpServer
(
new
B4933582
(),
1
,
10
,
cache
.
getPort
());
}
AuthCacheValue
.
setAuthCache
(
cache
);
System
.
out
.
println
(
"Server: listening on port: "
+
server
.
getLocalPort
());
System
.
out
.
println
(
"Server: listening on port: "
+
server
.
getLocalPort
());
client
(
"http://localhost:"
+
server
.
getLocalPort
()+
"/d1/foo.html"
);
client
(
"http://localhost:"
+
server
.
getLocalPort
()+
"/d1/foo.html"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -172,8 +179,15 @@ public class B4933582 implements HttpCallback {
...
@@ -172,8 +179,15 @@ public class B4933582 implements HttpCallback {
static
class
CacheImpl
extends
AuthCacheImpl
{
static
class
CacheImpl
extends
AuthCacheImpl
{
HashMap
map
;
HashMap
map
;
int
port
;
// need to store the port number the server is using
CacheImpl
()
throws
IOException
{
CacheImpl
()
throws
IOException
{
this
(-
1
);
}
CacheImpl
(
int
port
)
throws
IOException
{
super
();
super
();
this
.
port
=
port
;
File
src
=
new
File
(
"cache.ser"
);
File
src
=
new
File
(
"cache.ser"
);
if
(
src
.
exists
())
{
if
(
src
.
exists
())
{
ObjectInputStream
is
=
new
ObjectInputStream
(
ObjectInputStream
is
=
new
ObjectInputStream
(
...
@@ -181,6 +195,8 @@ public class B4933582 implements HttpCallback {
...
@@ -181,6 +195,8 @@ public class B4933582 implements HttpCallback {
);
);
try
{
try
{
map
=
(
HashMap
)
is
.
readObject
();
map
=
(
HashMap
)
is
.
readObject
();
this
.
port
=
(
Integer
)
is
.
readObject
();
System
.
out
.
println
(
"read port from file "
+
port
);
}
catch
(
ClassNotFoundException
e
)
{
}
catch
(
ClassNotFoundException
e
)
{
assert
false
;
assert
false
;
}
}
...
@@ -192,6 +208,10 @@ public class B4933582 implements HttpCallback {
...
@@ -192,6 +208,10 @@ public class B4933582 implements HttpCallback {
setMap
(
map
);
setMap
(
map
);
}
}
int
getPort
()
{
return
port
;
}
private
void
writeMap
()
{
private
void
writeMap
()
{
try
{
try
{
File
dst
=
new
File
(
"cache.ser"
);
File
dst
=
new
File
(
"cache.ser"
);
...
@@ -203,6 +223,8 @@ public class B4933582 implements HttpCallback {
...
@@ -203,6 +223,8 @@ public class B4933582 implements HttpCallback {
new
FileOutputStream
(
dst
)
new
FileOutputStream
(
dst
)
);
);
os
.
writeObject
(
map
);
os
.
writeObject
(
map
);
os
.
writeObject
(
port
);
System
.
out
.
println
(
"wrote port "
+
port
);
os
.
close
();
os
.
close
();
}
catch
(
IOException
e
)
{}
}
catch
(
IOException
e
)
{}
}
}
...
...
test/sun/net/www/httptest/HttpTransaction.java
浏览文件 @
33a0c720
...
@@ -102,7 +102,8 @@ public class HttpTransaction {
...
@@ -102,7 +102,8 @@ public class HttpTransaction {
if
(
rspheaders
!=
null
)
{
if
(
rspheaders
!=
null
)
{
buf
.
append
(
rspheaders
.
toString
()).
append
(
"\r\n"
);
buf
.
append
(
rspheaders
.
toString
()).
append
(
"\r\n"
);
}
}
buf
.
append
(
"Body: "
).
append
(
new
String
(
rspbody
)).
append
(
"\r\n"
);
String
rbody
=
rspbody
==
null
?
""
:
new
String
(
rspbody
);
buf
.
append
(
"Body: "
).
append
(
rbody
).
append
(
"\r\n"
);
return
new
String
(
buf
);
return
new
String
(
buf
);
}
}
...
...
test/sun/security/ssl/sun/net/www/httpstest/HttpTransaction.java
浏览文件 @
33a0c720
...
@@ -102,7 +102,8 @@ public class HttpTransaction {
...
@@ -102,7 +102,8 @@ public class HttpTransaction {
if
(
rspheaders
!=
null
)
{
if
(
rspheaders
!=
null
)
{
buf
.
append
(
rspheaders
.
toString
()).
append
(
"\r\n"
);
buf
.
append
(
rspheaders
.
toString
()).
append
(
"\r\n"
);
}
}
buf
.
append
(
"Body: "
).
append
(
new
String
(
rspbody
)).
append
(
"\r\n"
);
String
rbody
=
rspbody
==
null
?
""
:
new
String
(
rspbody
);
buf
.
append
(
"Body: "
).
append
(
rbody
).
append
(
"\r\n"
);
return
new
String
(
buf
);
return
new
String
(
buf
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录