author | vlivanov |
Wed, 02 Mar 2016 15:42:03 +0300 | |
changeset 36349 | 6cc8e6f596b2 |
parent 36129 | 332b49163fc9 |
child 37785 | daf6dcc73e9d |
permissions | -rw-r--r-- |
36129
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
1 |
/* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
4 |
* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
8 |
* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
13 |
* accompanied this code). |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
14 |
* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
18 |
* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
21 |
* questions. |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
22 |
*/ |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
23 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
24 |
/* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
25 |
* @test |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
26 |
* @bug 8132734 |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
27 |
* @summary Test the System properties for JarFile that support multi-release jar files |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
28 |
* @library /lib/testlibrary/java/util/jar |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
29 |
* @build Compiler JarBuilder CreateMultiReleaseTestJars |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
30 |
* @run testng MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
31 |
* @run testng/othervm -Djdk.util.jar.version=0 MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
32 |
* @run testng/othervm -Djdk.util.jar.version=8 MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
33 |
* @run testng/othervm -Djdk.util.jar.version=9 MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
34 |
* @run testng/othervm -Djdk.util.jar.version=10 MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
35 |
* @run testng/othervm -Djdk.util.jar.version=100 MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
36 |
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
37 |
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
38 |
* @run testng/othervm -Djdk.util.jar.version=10 -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
39 |
* @run testng/othervm -Djdk.util.jar.version=8 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
40 |
* @run testng/othervm -Djdk.util.jar.version=9 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
41 |
* @run testng/othervm -Djdk.util.jar.version=10 -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
42 |
* @run testng/othervm -Djdk.util.jar.enableMultiRelease=false MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
43 |
* @run testng/othervm -Djdk.util.jar.enableMultiRelease=force MultiReleaseJarHttpProperties |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
44 |
*/ |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
45 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
46 |
import com.sun.net.httpserver.*; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
47 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
48 |
import java.io.IOException; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
49 |
import java.io.InputStream; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
50 |
import java.io.OutputStream; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
51 |
import java.net.InetSocketAddress; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
52 |
import java.net.URL; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
53 |
import java.net.URLClassLoader; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
54 |
import java.nio.file.Files; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
55 |
import java.nio.file.Path; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
56 |
import java.nio.file.Paths; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
57 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
58 |
import org.testng.Assert; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
59 |
import org.testng.annotations.AfterClass; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
60 |
import org.testng.annotations.BeforeClass; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
61 |
import org.testng.annotations.Test; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
62 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
63 |
public class MultiReleaseJarHttpProperties extends MultiReleaseJarProperties { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
64 |
private SimpleHttpServer server; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
65 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
66 |
@BeforeClass |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
67 |
public void initialize() throws Exception { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
68 |
server = new SimpleHttpServer(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
69 |
server.start(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
70 |
super.initialize(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
71 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
72 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
73 |
@Override |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
74 |
protected void initializeClassLoader() throws Exception { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
75 |
URL[] urls = new URL[]{ |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
76 |
new URL("http://localhost:" + server.getPort() + "/multi-release-jar") |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
77 |
}; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
78 |
cldr = new URLClassLoader(urls); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
79 |
// load any class, Main is convenient and in the root entries |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
80 |
rootClass = cldr.loadClass("version.Main"); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
81 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
82 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
83 |
@AfterClass |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
84 |
public void close() throws IOException { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
85 |
// Windows requires server to stop before file is deleted |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
86 |
if (server != null) |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
87 |
server.stop(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
88 |
super.close(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
89 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
90 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
91 |
/* |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
92 |
* jdk.util.jar.enableMultiRelease=force is a no-op for URLClassLoader |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
93 |
*/ |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
94 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
95 |
@Test |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
96 |
public void testURLClassLoader() throws Throwable { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
97 |
Class<?> vcls = cldr.loadClass("version.Version"); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
98 |
invokeMethod(vcls, rtVersion); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
99 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
100 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
101 |
@Test |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
102 |
public void testGetResourceAsStream() throws Exception { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
103 |
String resource = rtVersion == 9 ? "/version/PackagePrivate.java" : "/version/Version.java"; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
104 |
// use rootClass as a base for getting resources |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
105 |
getResourceAsStream(rootClass, resource); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
106 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
107 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
108 |
@Test |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
109 |
public void testGetResource() throws Exception { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
110 |
String resource = rtVersion == 9 ? "/version/PackagePrivate.java" : "/version/Version.java"; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
111 |
// use rootClass as a base for getting resources |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
112 |
getResource(rootClass, resource); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
113 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
114 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
115 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
116 |
/** |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
117 |
* Extremely simple server that only performs one task. The server listens for |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
118 |
* requests on the ephemeral port. If it sees a request that begins with |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
119 |
* "/multi-release-jar", it consumes the request and returns a stream of bytes |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
120 |
* representing the jar file multi-release.jar found in "userdir". |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
121 |
*/ |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
122 |
class SimpleHttpServer { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
123 |
private static final String userdir = System.getProperty("user.dir", "."); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
124 |
private static final Path multirelease = Paths.get(userdir, "multi-release.jar"); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
125 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
126 |
private final HttpServer server; |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
127 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
128 |
public SimpleHttpServer() throws IOException { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
129 |
server = HttpServer.create(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
130 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
131 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
132 |
public void start() throws IOException { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
133 |
server.bind(new InetSocketAddress(0), 0); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
134 |
server.createContext("/multi-release-jar", t -> { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
135 |
try (InputStream is = t.getRequestBody()) { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
136 |
is.readAllBytes(); // probably not necessary to consume request |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
137 |
byte[] bytes = Files.readAllBytes(multirelease); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
138 |
t.sendResponseHeaders(200, bytes.length); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
139 |
try (OutputStream os = t.getResponseBody()) { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
140 |
os.write(bytes); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
141 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
142 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
143 |
}); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
144 |
server.setExecutor(null); // creates a default executor |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
145 |
server.start(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
146 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
147 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
148 |
public void stop() { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
149 |
server.stop(0); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
150 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
151 |
|
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
152 |
int getPort() { |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
153 |
return server.getAddress().getPort(); |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
154 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
155 |
} |
332b49163fc9
8132734: JDK 9 runtime changes to support multi-release jar files
sdrach
parents:
diff
changeset
|
156 |