Source:
@Override public void start(GridRestProtocolHandler hnd) throws IgniteCheckedException { assert ctx.config().getConnectorConfiguration() != null; InetAddress locHost; try { locHost = U.resolveLocalHost(ctx.config().getLocalHost()); } catch (IOException e) { throw new IgniteCheckedException("Failed to resolve local host to bind address: " + ctx.config().getLocalHost(), e); } if (System.getProperty(IGNITE_JETTY_HOST) == null) System.setProperty(IGNITE_JETTY_HOST, locHost.getHostAddress()); jettyHnd = new GridJettyRestHandler(hnd, new C1<String, Boolean>() { @Override public Boolean apply(String tok) { return F.isEmpty(secretKey) || authenticate(tok); } }, log); String jettyPath = config().getJettyPath(); final URL cfgUrl; if (jettyPath == null) { cfgUrl = null; if (log.isDebugEnabled()) log.debug("Jetty configuration file is not provided, using defaults."); } else { cfgUrl = U.resolveIgniteUrl(jettyPath); if (cfgUrl == null) throw new IgniteSpiException("Invalid Jetty configuration file: " + jettyPath); else if (log.isDebugEnabled()) log.debug("Jetty configuration file: " + cfgUrl); } loadJettyConfiguration(cfgUrl); AbstractNetworkConnector connector = getJettyConnector(); try { host = InetAddress.getByName(connector.getHost()); } catch (UnknownHostException e) { throw new IgniteCheckedException("Failed to resolve Jetty host address: " + connector.getHost(), e); } int initPort = connector.getPort(); int portRange = config().getPortRange(); int lastPort = portRange == 0 ? initPort : initPort + portRange - 1; for (port = initPort; port <= lastPort; port++) { connector.setPort(port); if (startJetty()) { if (log.isInfoEnabled()) log.info(startInfo()); return; } } U.warn(log, "Failed to start Jetty REST server (possibly all ports in range are in use) " + "[firstPort=" + initPort + ", lastPort=" + lastPort + ']'); }

Target:
@Override public void start(GridRestProtocolHandler hnd) throws IgniteCheckedException { assert ctx.config().getConnectorConfiguration() != null; String jettyHost = System.getProperty(IGNITE_JETTY_HOST, ctx.config().getLocalHost()); try { System.setProperty(IGNITE_JETTY_HOST, U.resolveLocalHost(jettyHost).getHostAddress()); } catch (IOException e) { throw new IgniteCheckedException("Failed to resolve host to bind address: " + jettyHost, e); } jettyHnd = new GridJettyRestHandler(hnd, new C1<String, Boolean>() { @Override public Boolean apply(String tok) { return F.isEmpty(secretKey) || authenticate(tok); } }, log); String jettyPath = config().getJettyPath(); final URL cfgUrl; if (jettyPath == null) { cfgUrl = null; if (log.isDebugEnabled()) log.debug("Jetty configuration file is not provided, using defaults."); } else { cfgUrl = U.resolveIgniteUrl(jettyPath); if (cfgUrl == null) throw new IgniteSpiException("Invalid Jetty configuration file: " + jettyPath); else if (log.isDebugEnabled()) log.debug("Jetty configuration file: " + cfgUrl); } loadJettyConfiguration(cfgUrl); AbstractNetworkConnector connector = getJettyConnector(); try { host = InetAddress.getByName(connector.getHost()); } catch (UnknownHostException e) { throw new IgniteCheckedException("Failed to resolve Jetty host address: " + connector.getHost(), e); } int initPort = connector.getPort(); int portRange = config().getPortRange(); int lastPort = portRange == 0 ? initPort : initPort + portRange - 1; for (port = initPort; port <= lastPort; port++) { connector.setPort(port); if (startJetty()) { if (log.isInfoEnabled()) log.info(startInfo()); return; } } U.warn(log, "Failed to start Jetty REST server (possibly all ports in range are in use) " + "[firstPort=" + initPort + ", lastPort=" + lastPort + ']'); }