/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
/** * Test for the availability of the web server * * @return true if the web server is started, false otherwise */ public boolean isAlive() { return webServer != null && webServer.isStarted(); }
public synchronized boolean isStarted() { return (server != null) && server.isStarted(); }
public boolean isStarted() { return server.isStarted(); }
public boolean isStarted() { return (httpServer != null) && httpServer.isStarted(); }
/** Returns the port assigned to the server. * * @return the port assigned to the server. */ public static int getPort() { if ( port == 0 ) { if ( ! SERVER.isStarted() ) throw new IllegalStateException( "The server is not started yet" ); port = SERVER.getConnectors()[ 0 ].getLocalPort(); } return port; }
/** Returns the port assigned to the server. * * @return the port assigned to the server. */ public static int getPort() { if ( port == 0 ) { if ( ! SERVER.isStarted() ) throw new IllegalStateException( "The server is not started yet" ); port = SERVER.getConnectors()[ 0 ].getLocalPort(); } return port; }
private void waitUntilStarted() { while (!server.isFailed() && !server.isStarted()) { try { Thread.sleep(1000); } catch (final InterruptedException ignored) { break; } } if (server.isFailed()) { throw new IllegalStateException("Server has failed."); } }
/** Returns the port assigned to the server. * * @return the port assigned to the server. */ public static int getPort() { if ( port == 0 ) { if ( ! SERVER.isStarted() ) throw new IllegalStateException( "The server is not started yet" ); port = SERVER.getConnectors()[ 0 ].getLocalPort(); } return port; }
/** Returns the port assigned to the server. * * @return the port assigned to the server. */ public static int getPort() { if ( port == 0 ) { if ( ! SERVER.isStarted() ) throw new IllegalStateException( "The server is not started yet" ); port = SERVER.getConnectors()[ 0 ].getLocalPort(); } return port; }
/** Create a Socket connector. * This methods adds a socket connector to the server * @param locahost if true, only listen on local host, else listen on all interfaces. * @return A URL to access the server via the socket connector. * @throws Exception */ public LocalConnector createLocalConnector() throws Exception { synchronized (this) { LocalConnector connector = new LocalConnector(); _server.addConnector(connector); if (_server.isStarted()) connector.start(); return connector; } }
/** * @param contextPath The _contextPath to set. */ public void setContextPath(String contextPath) { if (contextPath!=null && contextPath.length()>1 && contextPath.endsWith("/")) throw new IllegalArgumentException("ends with /"); _contextPath = contextPath; if (getServer()!=null && (getServer().isStarting() || getServer().isStarted())) { Handler[] contextCollections = getServer().getChildHandlersByClass(ContextHandlerCollection.class); for (int h=0;contextCollections!=null&& h<contextCollections.length;h++) ((ContextHandlerCollection)contextCollections[h]).mapContexts(); } }
public void stop() throws Exception { if (server.isStopped()) { // Nothing to do } else if (server.isStarting()) { waitUntilStarted(); doStop(); } else if (server.isStarted()) { doStop(); } else if (server.isStopping()) { waitUntilStopped(); } else if (server.isFailed()) { throw new IllegalStateException("Could not stop a server which has failed."); } else { doStop(); } }