/** * Get port. * * @return the local port number the server is listening on. */ public int getPort() { assertAlreadySetUp(); return connector.getLocalPort(); }
/** @return the local port number the server is listening on. */ public int getPort() { assertAlreadySetUp(); return ((SelectChannelConnector) connector).getLocalPort(); }
/** * Get secure port. * * @return the HTTPS port or -1 if not configured. */ public int getSecurePort() { assertAlreadySetUp(); return secureConnector != null ? secureConnector.getLocalPort() : -1; }
/** * Get the URI to reference this server. * <p> * The returned URI includes the proper host name and port number, but does * not contain a path. * * @return URI to reference this server's root context. */ public URI getURI() { assertAlreadySetUp(); String host = connector.getHost(); if (host.contains(":") && !host.startsWith("[")) host = "[" + host + "]"; final String uri = "http://" + host + ":" + getPort(); try { return new URI(uri); } catch (URISyntaxException e) { throw new RuntimeException("Unexpected URI error on " + uri, e); } }
/** * Get the URI to reference this server. * <p> * The returned URI includes the proper host name and port number, but does * not contain a path. * * @return URI to reference this server's root context. */ public URI getURI() { assertAlreadySetUp(); String host = connector.getHost(); if (host.contains(":") && !host.startsWith("[")) host = "[" + host + "]"; final String uri = "http://" + host + ":" + getPort(); try { return new URI(uri); } catch (URISyntaxException e) { throw new RuntimeException("Unexpected URI error on " + uri, e); } }