List of usage examples for org.springframework.boot.web.server WebServerException WebServerException
public WebServerException(String message, Throwable cause)
From source file:org.springframework.boot.web.embedded.undertow.UndertowWebServer.java
@Override public void start() throws WebServerException { synchronized (this.monitor) { if (this.started) { return; }/*from w ww . j a v a 2 s.co m*/ try { if (!this.autoStart) { return; } if (this.undertow == null) { this.undertow = this.builder.build(); } this.undertow.start(); this.started = true; UndertowWebServer.logger.info("Undertow started on port(s) " + getPortsDescription()); } catch (Exception ex) { try { if (findBindException(ex) != null) { List<UndertowWebServer.Port> failedPorts = getConfiguredPorts(); List<UndertowWebServer.Port> actualPorts = getActualPorts(); failedPorts.removeAll(actualPorts); if (failedPorts.size() == 1) { throw new PortInUseException(failedPorts.iterator().next().getNumber()); } } throw new WebServerException("Unable to start embedded Undertow", ex); } finally { stopSilently(); } } } }
From source file:org.springframework.boot.web.embedded.undertow.UndertowWebServer.java
@Override public void stop() throws WebServerException { synchronized (this.monitor) { if (!this.started) { return; }/*from w w w. j a v a 2 s.co m*/ this.started = false; try { this.undertow.stop(); if (this.closeable != null) { this.closeable.close(); } } catch (Exception ex) { throw new WebServerException("Unable to stop undertow", ex); } } }
From source file:org.springframework.boot.web.reactive.server.AbstractReactiveWebServerFactory.java
/** * Return the absolute temp dir for given web server. * @param prefix server name// w w w .j a v a 2 s . co m * @return The temp dir for given server. */ protected File createTempDir(String prefix) { try { File tempDir = File.createTempFile(prefix + ".", "." + getPort()); tempDir.delete(); tempDir.mkdir(); tempDir.deleteOnExit(); return tempDir; } catch (IOException ex) { throw new WebServerException( "Unable to create tempDir. java.io.tmpdir is set to " + System.getProperty("java.io.tmpdir"), ex); } }