Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
0c3dd731
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
0c3dd731
编写于
5月 16, 2013
作者:
K
khazra
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
7150552: network test hangs [macosx]
Summary: Remove usage of test/sun/net/www/httptest Reviewed-by: chegar
上级
99320688
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
201 addition
and
184 deletion
+201
-184
test/ProblemList.txt
test/ProblemList.txt
+0
-4
test/java/net/CookieHandler/CookieManagerTest.java
test/java/net/CookieHandler/CookieManagerTest.java
+110
-85
test/sun/net/www/protocol/http/B6299712.java
test/sun/net/www/protocol/http/B6299712.java
+91
-95
未找到文件。
test/ProblemList.txt
浏览文件 @
0c3dd731
...
...
@@ -205,10 +205,6 @@ java/net/MulticastSocket/Test.java macosx-all
#7143960
java/net/DatagramSocket/SendDatagramToBadAddress.java macosx-all
# 7150552
sun/net/www/protocol/http/B6299712.java macosx-all
java/net/CookieHandler/CookieManagerTest.java macosx-all
############################################################################
# jdk_io
...
...
test/java/net/CookieHandler/CookieManagerTest.java
浏览文件 @
0c3dd731
...
...
@@ -24,21 +24,25 @@
/*
* @test
* @summary Unit test for java.net.CookieManager
* @bug 6244040
* @library ../../../sun/net/www/httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @bug 6244040 7150552
* @run main/othervm -ea CookieManagerTest
* @author Edward Wang
*/
import
java.net.*
;
import
java.util.*
;
import
java.io.*
;
import
sun.net.www.MessageHeader
;
import
com.sun.net.httpserver.*
;
import
java.io.IOException
;
import
java.net.CookieHandler
;
import
java.net.CookieManager
;
import
java.net.CookiePolicy
;
import
java.net.HttpURLConnection
;
import
java.net.InetAddress
;
import
java.net.InetSocketAddress
;
import
java.net.URL
;
public
class
CookieManagerTest
{
static
CookieHttpTransaction
httpTrans
;
static
TestHttpServer
server
;
static
CookieTransactionHandler
httpTrans
;
static
HttpServer
server
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
startHttpServer
();
...
...
@@ -49,41 +53,48 @@ public class CookieManagerTest {
}
}
public
static
void
startHttpServer
()
{
try
{
httpTrans
=
new
CookieHttpTransaction
();
server
=
new
TestHttpServer
(
httpTrans
,
1
,
1
,
0
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
public
static
void
startHttpServer
()
throws
IOException
{
httpTrans
=
new
CookieTransactionHandler
();
server
=
HttpServer
.
create
(
new
InetSocketAddress
(
0
),
0
);
server
.
createContext
(
"/"
,
httpTrans
);
server
.
start
();
}
public
static
void
makeHttpCall
()
{
public
static
void
makeHttpCall
()
throws
IOException
{
try
{
System
.
out
.
println
(
"http server listen on: "
+
server
.
getLocalPort
());
System
.
out
.
println
(
"http server listenining on: "
+
server
.
getAddress
().
getPort
());
// install CookieManager to use
CookieHandler
.
setDefault
(
new
CookieManager
());
for
(
int
i
=
0
;
i
<
CookieHttpTransaction
.
testCount
;
i
++)
{
System
.
out
.
println
(
"====== CookieManager test "
+
(
i
+
1
)
+
" ======"
);
((
CookieManager
)
CookieHandler
.
getDefault
()).
setCookiePolicy
(
CookieHttpTransaction
.
testPolicies
[
i
]);
((
CookieManager
)
CookieHandler
.
getDefault
()).
getCookieStore
().
removeAll
();
URL
url
=
new
URL
(
"http"
,
InetAddress
.
getLocalHost
().
getHostAddress
(),
server
.
getLocalPort
(),
CookieHttpTransaction
.
testCases
[
i
][
0
].
serverPath
);
for
(
int
i
=
0
;
i
<
CookieTransactionHandler
.
testCount
;
i
++)
{
System
.
out
.
println
(
"====== CookieManager test "
+
(
i
+
1
)
+
" ======"
);
((
CookieManager
)
CookieHandler
.
getDefault
())
.
setCookiePolicy
(
CookieTransactionHandler
.
testPolicies
[
i
]);
((
CookieManager
)
CookieHandler
.
getDefault
())
.
getCookieStore
().
removeAll
();
URL
url
=
new
URL
(
"http"
,
InetAddress
.
getLocalHost
().
getHostAddress
(),
server
.
getAddress
().
getPort
(),
CookieTransactionHandler
.
testCases
[
i
][
0
]
.
serverPath
);
HttpURLConnection
uc
=
(
HttpURLConnection
)
url
.
openConnection
();
uc
.
getResponseCode
();
uc
.
disconnect
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
server
.
terminate
(
);
server
.
stop
(
0
);
}
}
}
class
CookieHttpTransaction
implements
HttpCallback
{
class
CookieTransactionHandler
implements
HttpHandler
{
private
int
testcaseDone
=
0
;
private
int
testDone
=
0
;
public
static
boolean
badRequest
=
false
;
// the main test control logic will also loop exactly this number
// to send http request
...
...
@@ -91,6 +102,47 @@ class CookieHttpTransaction implements HttpCallback {
private
String
localHostAddr
=
"127.0.0.1"
;
@Override
public
void
handle
(
HttpExchange
exchange
)
throws
IOException
{
if
(
testDone
<
testCases
[
testcaseDone
].
length
)
{
// still have other tests to run,
// check the Cookie header and then redirect it
if
(
testDone
>
0
)
checkRequest
(
exchange
.
getRequestHeaders
());
exchange
.
getResponseHeaders
().
add
(
"Location"
,
testCases
[
testcaseDone
][
testDone
].
serverPath
);
exchange
.
getResponseHeaders
()
.
add
(
testCases
[
testcaseDone
][
testDone
].
headerToken
,
testCases
[
testcaseDone
][
testDone
].
cookieToSend
);
exchange
.
sendResponseHeaders
(
302
,
-
1
);
testDone
++;
}
else
{
// the last test of this test case
if
(
testDone
>
0
)
checkRequest
(
exchange
.
getRequestHeaders
());
testcaseDone
++;
testDone
=
0
;
exchange
.
sendResponseHeaders
(
200
,
-
1
);
}
exchange
.
close
();
}
private
void
checkRequest
(
Headers
hdrs
)
{
assert
testDone
>
0
;
String
cookieHeader
=
hdrs
.
getFirst
(
"Cookie"
);
if
(
cookieHeader
!=
null
&&
cookieHeader
.
equalsIgnoreCase
(
testCases
[
testcaseDone
][
testDone
-
1
]
.
cookieToRecv
))
{
System
.
out
.
printf
(
"%15s %s\n"
,
"PASSED:"
,
cookieHeader
);
}
else
{
System
.
out
.
printf
(
"%15s %s\n"
,
"FAILED:"
,
cookieHeader
);
System
.
out
.
printf
(
"%15s %s\n\n"
,
"should be:"
,
testCases
[
testcaseDone
][
testDone
-
1
].
cookieToRecv
);
badRequest
=
true
;
}
}
// test cases
public
static
class
CookieTestCase
{
public
String
headerToken
;
...
...
@@ -106,13 +158,17 @@ class CookieHttpTransaction implements HttpCallback {
}
};
//
// these two must match each other, i.e. testCases.length == testPolicies.length
//
public
static
CookieTestCase
[][]
testCases
=
null
;
// the test cases to run; each test case may contain multiple roundtrips
public
static
CookiePolicy
[]
testPolicies
=
null
;
// indicates what CookiePolicy to use with each test cases
/*
* these two must match each other,
* i.e. testCases.length == testPolicies.length
*/
// the test cases to run; each test case may contain multiple roundtrips
public
static
CookieTestCase
[][]
testCases
=
null
;
// indicates what CookiePolicy to use with each test cases
public
static
CookiePolicy
[]
testPolicies
=
null
;
Cookie
HttpTransaction
()
{
Cookie
TransactionHandler
()
{
testCases
=
new
CookieTestCase
[
testCount
][];
testPolicies
=
new
CookiePolicy
[
testCount
];
...
...
@@ -126,7 +182,9 @@ class CookieHttpTransaction implements HttpCallback {
testPolicies
[
count
]
=
CookiePolicy
.
ACCEPT_ORIGINAL_SERVER
;
testCases
[
count
++]
=
new
CookieTestCase
[]{
new
CookieTestCase
(
"Set-Cookie"
,
"CUSTOMER=WILE:BOB; path=/; expires=Sat, 09-Nov-2030 23:12:40 GMT;"
+
"domain=."
+
localHostAddr
,
"CUSTOMER=WILE:BOB; "
+
"path=/; expires=Sat, 09-Nov-2030 23:12:40 GMT;"
+
"domain=."
+
localHostAddr
,
"CUSTOMER=WILE:BOB"
,
"/"
),
...
...
@@ -172,12 +230,17 @@ class CookieHttpTransaction implements HttpCallback {
),
new
CookieTestCase
(
"Set-Cookie2"
,
"Part_Number=\"Rocket_Launcher_0001\"; Version=\"1\";Path=\"/acme\";"
+
"domain=."
+
localHostAddr
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
,
"/acme/pickitem"
),
new
CookieTestCase
(
"Set-Cookie2"
,
"Shipping=\"FedEx\"; Version=\"1\"; Path=\"/acme\";"
+
"domain=."
+
localHostAddr
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
+
"; Shipping=\"FedEx\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
+
"; Shipping=\"FedEx\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
,
"/acme/shipping"
)
};
...
...
@@ -191,8 +254,11 @@ class CookieHttpTransaction implements HttpCallback {
"/acme/ammo"
),
new
CookieTestCase
(
"Set-Cookie2"
,
"Part_Number=\"Riding_Rocket_0023\"; Version=\"1\"; Path=\"/acme/ammo\";"
+
"domain=."
+
localHostAddr
,
"$Version=\"1\"; Part_Number=\"Riding_Rocket_0023\";$Path=\"/acme/ammo\";$Domain=\"."
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
,
"Part_Number=\"Riding_Rocket_0023\"; Version=\"1\"; Path=\"/acme/ammo\";"
+
"domain=."
+
localHostAddr
,
"$Version=\"1\"; Part_Number=\"Riding_Rocket_0023\";$Path=\"/acme/ammo\";$Domain=\"."
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";"
+
"$Domain=\"."
+
localHostAddr
+
"\""
,
"/acme/ammo"
),
new
CookieTestCase
(
""
,
...
...
@@ -228,60 +294,19 @@ class CookieHttpTransaction implements HttpCallback {
),
new
CookieTestCase
(
"Set-Cookie2"
,
"Part_Number=\"Rocket_Launcher_0001\"; Version=\"1\";Path=\"/acme\""
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
,
"/acme/pickitem"
),
new
CookieTestCase
(
"Set-Cookie2"
,
"Shipping=\"FedEx\"; Version=\"1\"; Path=\"/acme\""
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
+
"; Shipping=\"FedEx\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
,
"$Version=\"1\"; Customer=\"WILE_E_COYOTE\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
+
"; Part_Number=\"Rocket_Launcher_0001\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
+
"; Shipping=\"FedEx\";$Path=\"/acme\";$Domain=\""
+
localHostAddr
+
"\""
,
"/acme/shipping"
)
};
assert
count
==
testCount
;
}
private
int
testcaseDone
=
0
;
private
int
testDone
=
0
;
/*
* Our http server which is conducted by testCases array
*/
public
void
request
(
HttpTransaction
trans
)
{
try
{
if
(
testDone
<
testCases
[
testcaseDone
].
length
)
{
// still have other tests to run,
// check the Cookie header and then redirect it
if
(
testDone
>
0
)
checkResquest
(
trans
);
trans
.
addResponseHeader
(
"Location"
,
testCases
[
testcaseDone
][
testDone
].
serverPath
);
trans
.
addResponseHeader
(
testCases
[
testcaseDone
][
testDone
].
headerToken
,
testCases
[
testcaseDone
][
testDone
].
cookieToSend
);
testDone
++;
trans
.
sendResponse
(
302
,
"Moved Temporarily"
);
}
else
{
// the last test of this test case
if
(
testDone
>
0
)
checkResquest
(
trans
);
testcaseDone
++;
testDone
=
0
;
trans
.
sendResponse
(
200
,
"OK"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
private
void
checkResquest
(
HttpTransaction
trans
)
{
String
cookieHeader
=
null
;
assert
testDone
>
0
;
cookieHeader
=
trans
.
getRequestHeader
(
"Cookie"
);
if
(
cookieHeader
!=
null
&&
cookieHeader
.
equalsIgnoreCase
(
testCases
[
testcaseDone
][
testDone
-
1
].
cookieToRecv
))
{
System
.
out
.
printf
(
"%15s %s\n"
,
"PASSED:"
,
cookieHeader
);
}
else
{
System
.
out
.
printf
(
"%15s %s\n"
,
"FAILED:"
,
cookieHeader
);
System
.
out
.
printf
(
"%15s %s\n\n"
,
"should be:"
,
testCases
[
testcaseDone
][
testDone
-
1
].
cookieToRecv
);
badRequest
=
true
;
}
}
}
test/sun/net/www/protocol/http/B6299712.java
浏览文件 @
0c3dd731
...
...
@@ -23,33 +23,33 @@
/*
* @test
* @bug 6299712
* @library ../../httptest/
* @build HttpCallback TestHttpServer ClosedChannelList HttpTransaction
* @bug 6299712 7150552
* @run main/othervm B6299712
* @summary NullPointerException in sun.net.www.protocol.http.HttpURLConnection.followRedirect
*/
import
com.sun.net.httpserver.HttpExchange
;
import
com.sun.net.httpserver.HttpHandler
;
import
com.sun.net.httpserver.HttpServer
;
import
java.net.*
;
import
java.io.*
;
import
java.util.*
;
/*
* Test Description:
* - main thread run as a http client
* - another thread runs a
http server, which redirect the first call to "/redirect"
*
and return
'200 OK' for the successive call
* - a global ResponseCache instance is installed, which return DeployCacheResponse
* for url
ends
with "/redirect", i.e. the url redirected to by our simple http server,
* and null for other url.
* - main thread
is
run as a http client
* - another thread runs a
n http server, which redirects calls to "/" to
*
"/redirect" and returns
'200 OK' for the successive call
* - a global ResponseCache instance is installed, which return
s
DeployCacheResponse
* for url
s that end
with "/redirect", i.e. the url redirected to by our simple http server,
* and null for other url
s
.
* - the whole result is that the first call will be served by our simple
* http server and is redirected to "/redirect". The successive call will be done
* automatically by HttpURLConnection, which will be served by DeployCacheResponse.
* The NPE will be thrown on the second round if the bug is there.
*/
public
class
B6299712
{
static
SimpleHttpTransaction
httpTrans
;
static
TestHttpServer
server
;
static
HttpServer
server
;
public
static
void
main
(
String
[]
args
)
throws
Exception
{
ResponseCache
.
setDefault
(
new
DeployCacheHandler
());
...
...
@@ -58,123 +58,119 @@ public class B6299712 {
makeHttpCall
();
}
public
static
void
startHttpServer
()
{
try
{
httpTrans
=
new
SimpleHttpTransaction
();
server
=
new
TestHttpServer
(
httpTrans
,
1
,
10
,
0
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
public
static
void
startHttpServer
()
throws
IOException
{
server
=
HttpServer
.
create
(
new
InetSocketAddress
(
0
),
0
);
server
.
createContext
(
"/"
,
new
DefaultHandler
());
server
.
createContext
(
"/redirect"
,
new
RedirectHandler
());
server
.
start
();
}
public
static
void
makeHttpCall
()
{
public
static
void
makeHttpCall
()
throws
IOException
{
try
{
System
.
out
.
println
(
"http server listen on: "
+
server
.
getLocalPort
());
URL
url
=
new
URL
(
"http"
,
InetAddress
.
getLocalHost
().
getHostAddress
(),
server
.
getLocalPort
(),
"/"
);
System
.
out
.
println
(
"http server listen on: "
+
server
.
getAddress
().
getPort
());
URL
url
=
new
URL
(
"http"
,
InetAddress
.
getLocalHost
().
getHostAddress
(),
server
.
getAddress
().
getPort
(),
"/"
);
HttpURLConnection
uc
=
(
HttpURLConnection
)
url
.
openConnection
();
System
.
out
.
println
(
uc
.
getResponseCode
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
if
(
uc
.
getResponseCode
()
!=
200
)
throw
new
RuntimeException
(
"Expected Response Code was 200,"
+
"received: "
+
uc
.
getResponseCode
());
uc
.
disconnect
();
}
finally
{
server
.
terminate
(
);
server
.
stop
(
0
);
}
}
}
class
SimpleHttpTransaction
implements
HttpCallback
{
/*
* Our http server which simply redirect first call
*/
public
void
request
(
HttpTransaction
trans
)
{
try
{
String
path
=
trans
.
getRequestURI
().
getPath
();
if
(
path
.
equals
(
"/"
))
{
// the first call, redirect it
String
location
=
"/redirect"
;
trans
.
addResponseHeader
(
"Location"
,
location
);
trans
.
sendResponse
(
302
,
"Moved Temporarily"
);
}
else
{
// the second call
trans
.
sendResponse
(
200
,
"OK"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
static
class
RedirectHandler
implements
HttpHandler
{
@Override
public
void
handle
(
HttpExchange
exchange
)
throws
IOException
{
exchange
.
sendResponseHeaders
(
200
,
-
1
);
exchange
.
close
();
}
}
}
class
DeployCacheHandler
extends
java
.
net
.
ResponseCache
{
private
boolean
inCacheHandler
=
false
;
private
boolean
_downloading
=
false
;
static
class
DefaultHandler
implements
HttpHandler
{
public
synchronized
CacheResponse
get
(
final
URI
uri
,
String
rqstMethod
,
Map
requestHeaders
)
throws
IOException
{
System
.
out
.
println
(
"get!!!: "
+
uri
);
try
{
@Override
public
void
handle
(
HttpExchange
exchange
)
throws
IOException
{
exchange
.
getResponseHeaders
().
add
(
"Location"
,
"/redirect"
);
exchange
.
sendResponseHeaders
(
302
,
-
1
);
exchange
.
close
();
}
}
static
class
DeployCacheHandler
extends
java
.
net
.
ResponseCache
{
public
synchronized
CacheResponse
get
(
final
URI
uri
,
String
rqstMethod
,
Map
<
String
,
List
<
String
>>
requestHeaders
)
throws
IOException
{
System
.
out
.
println
(
"get!!!: "
+
uri
);
if
(!
uri
.
toString
().
endsWith
(
"redirect"
))
{
return
null
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
System
.
out
.
println
(
"Serving request from cache"
);
return
new
DeployCacheResponse
(
new
EmptyInputStream
(),
new
HashMap
<
String
,
List
<
String
>>());
}
return
new
DeployCacheResponse
(
new
EmptyInputStream
(),
new
HashMap
());
}
public
synchronized
CacheRequest
put
(
URI
uri
,
URLConnection
conn
)
throws
IOException
{
URL
url
=
uri
.
toURL
();
return
new
DeployCacheRequest
(
url
,
conn
);
public
synchronized
CacheRequest
put
(
URI
uri
,
URLConnection
conn
)
throws
IOException
{
URL
url
=
uri
.
toURL
();
return
new
DeployCacheRequest
(
url
,
conn
);
}
}
}
class
DeployCacheRequest
extends
java
.
net
.
CacheRequest
{
static
class
DeployCacheRequest
extends
java
.
net
.
CacheRequest
{
private
URL
_url
;
private
URLConnection
_conn
;
private
boolean
_downloading
=
false
;
private
URL
_url
;
private
URLConnection
_conn
;
DeployCacheRequest
(
URL
url
,
URLConnection
conn
)
{
_url
=
url
;
_conn
=
conn
;
}
DeployCacheRequest
(
URL
url
,
URLConnection
conn
)
{
_url
=
url
;
_conn
=
conn
;
}
public
void
abort
()
{
public
void
abort
()
{
}
}
public
OutputStream
getBody
()
throws
IOException
{
public
OutputStream
getBody
()
throws
IOException
{
return
null
;
return
null
;
}
}
}
class
DeployCacheResponse
extends
java
.
net
.
CacheResponse
{
protected
InputStream
is
;
protected
Map
headers
;
static
class
DeployCacheResponse
extends
java
.
net
.
CacheResponse
{
protected
InputStream
is
;
protected
Map
<
String
,
List
<
String
>>
headers
;
DeployCacheResponse
(
InputStream
is
,
Map
headers
)
{
this
.
is
=
is
;
this
.
headers
=
headers
;
}
DeployCacheResponse
(
InputStream
is
,
Map
<
String
,
List
<
String
>>
headers
)
{
this
.
is
=
is
;
this
.
headers
=
headers
;
}
public
InputStream
getBody
()
throws
IOException
{
return
is
;
}
public
InputStream
getBody
()
throws
IOException
{
return
is
;
}
public
Map
getHeaders
()
throws
IOException
{
return
headers
;
public
Map
<
String
,
List
<
String
>>
getHeaders
()
throws
IOException
{
List
<
String
>
val
=
new
ArrayList
<>();
val
.
add
(
"HTTP/1.1 200 OK"
);
headers
.
put
(
null
,
val
);
return
headers
;
}
}
}
class
EmptyInputStream
extends
InputStream
{
public
EmptyInputStream
()
{
}
static
class
EmptyInputStream
extends
InputStream
{
public
int
read
()
throws
IOException
{
return
-
1
;
public
int
read
()
throws
IOException
{
return
-
1
;
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录