static void test2() throws IOException {
System.out.println("\n--- Test 2 ---");
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Policy.setPolicy(new CustomPolicy(
new URLPermission("http://127.0.0.1:"+httpPort+"/*", "GET:X-Foo"),
new URLPermission("https://127.0.0.1:"+httpsPort+"/*", "POST:X-Fob")));
}
String url1 = "http://127.0.0.1:"+httpPort+"/foo.html";
String url2 = "https://127.0.0.1:"+httpsPort+"/foo.html";
String url3 = "http://127.0.0.1:"+httpPort+"/bar.html";
String url4 = "https://127.0.0.1:"+httpsPort+"/bar.html";
// simple positive test. Should succeed
test(url1, "GET", "X-Foo");
test(url2, "POST", "X-Fob");
test(url3, "GET", "X-Foo");
test(url4, "POST", "X-Fob");
}
URLTest.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:openjdk-jdk10
作者:
评论列表
文章目录