equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
166 .path("/") |
166 .path("/") |
167 .toURL(); |
167 .toURL(); |
168 } |
168 } |
169 |
169 |
170 static void startHttpServer(String docroot) throws Exception { |
170 static void startHttpServer(String docroot) throws Exception { |
171 httpServer = HttpServer.create(new InetSocketAddress(0), 10); |
171 httpServer = HttpServer.create( |
|
172 new InetSocketAddress(InetAddress.getLoopbackAddress(), 0), |
|
173 10); |
172 HttpContext ctx = httpServer.createContext( |
174 HttpContext ctx = httpServer.createContext( |
173 "/", new FileServerHandler(docroot) |
175 "/", new FileServerHandler(docroot) |
174 ); |
176 ); |
175 httpServer.start(); |
177 httpServer.start(); |
176 } |
178 } |