/** * Pass in a server, return a URL bound to localhost and its port * @param server server * @return a URL bonded to the base of the server * @throws MalformedURLException if the URL cannot be created. */ public static URL getServerURL(HttpServer server) throws MalformedURLException { assertNotNull("No server", server); int port = server.getPort(); return new URL("http://localhost:" + port + "/"); }
/** * Pass in a server, return a URL bound to localhost and its port * @param server server * @return a URL bonded to the base of the server * @throws MalformedURLException if the URL cannot be created. */ public static URL getServerURL(HttpServer2 server) throws MalformedURLException { assertNotNull("No server", server); return new URL("http://" + NetUtils.getHostPortString(server.getConnectorAddress(0))); }
/** * Pass in a server, return a URL bound to localhost and its port * @param server server * @return a URL bonded to the base of the server * @throws MalformedURLException if the URL cannot be created. */ public static URL getServerURL(HttpServer2 server) throws MalformedURLException { assertNotNull("No server", server); return new URL("http://" + NetUtils.getHostPortString(server.getConnectorAddress(0))); }