org.springframework.boot.web.server.WebServerException Java Examples
The following examples show how to use
org.springframework.boot.web.server.WebServerException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VertxWebServer.java From vertx-spring-boot with Apache License 2.0 | 6 votes |
@Override public void start() throws WebServerException { if (server != null) { return; } Router router = Router.router(vertx); router.route() .handler(requestHandler); server = vertx .createHttpServer(httpServerOptions) .requestHandler(router); Mono<Void> future = Mono.create(sink -> server.listen(result -> { if (result.succeeded()) { logger.info("Vert.x HTTP server started on port {}", getPort()); sink.success(); } else { sink.error(result.cause()); } })); future.block(Duration.ofSeconds(5)); }
Example #2
Source File: VertxWebServer.java From vertx-spring-boot with Apache License 2.0 | 6 votes |
@Override public void stop() throws WebServerException { if (server == null) { return; } Mono<Void> future = Mono.create(sink -> server.close(result -> { if (result.succeeded()) { sink.success(); } else { sink.error(result.cause()); } })); future .doOnTerminate(() -> server = null) .block(Duration.ofSeconds(5)); }
Example #3
Source File: RSocketWebServer.java From spring-boot-rsocket with Apache License 2.0 | 6 votes |
@Override public void start() throws WebServerException { if (this.disposableServer == null) { try { this.disposableServer = startHttpServer(); } catch (Exception ex) { ChannelBindException bindException = findBindException(ex); if (bindException != null) { throw new PortInUseException(bindException.localPort()); } throw new WebServerException("Unable to start Netty", ex); } logger.info("Netty started on port(s): " + getPort()); startDaemonAwaitThread(this.disposableServer); } }
Example #4
Source File: HttpClientProperties.java From spring-cloud-gateway with Apache License 2.0 | 6 votes |
public X509Certificate[] getTrustedX509CertificatesForTrustManager() { try { CertificateFactory certificateFactory = CertificateFactory .getInstance("X.509"); ArrayList<Certificate> allCerts = new ArrayList<>(); for (String trustedCert : getTrustedX509Certificates()) { try { URL url = ResourceUtils.getURL(trustedCert); Collection<? extends Certificate> certs = certificateFactory .generateCertificates(url.openStream()); allCerts.addAll(certs); } catch (IOException e) { throw new WebServerException( "Could not load certificate '" + trustedCert + "'", e); } } return allCerts.toArray(new X509Certificate[allCerts.size()]); } catch (CertificateException e1) { throw new WebServerException("Could not load CertificateFactory X.509", e1); } }
Example #5
Source File: NettyTcpServer.java From spring-boot-protocol with Apache License 2.0 | 6 votes |
@Override public void stop() throws WebServerException { for(ServerListener serverListener : serverListeners){ try { serverListener.onServerStop(this); }catch (Throwable t){ logger.error("case by stop event [" + t.getMessage()+"]",t); } } try{ super.stop(); for (TcpChannel tcpChannel : TcpChannel.getChannels().values()) { tcpChannel.close(); } } catch (Exception e) { throw new WebServerException(e.getMessage(),e); } }
Example #6
Source File: ArmeriaWebServer.java From armeria with Apache License 2.0 | 5 votes |
@Override public synchronized void stop() { try { if (isRunning) { server.stop().get(); isRunning = false; } } catch (Exception cause) { throw new WebServerException("Failed to stop " + ArmeriaWebServer.class.getSimpleName(), Exceptions.peel(cause)); } }
Example #7
Source File: DiscoveryClientRegistrationInvoker.java From Moss with Apache License 2.0 | 5 votes |
@Override public void customize(ConfigurableApplicationContext context) { if(context instanceof ServletWebServerApplicationContext && !AdminEndpointApplicationRunListener.isEmbeddedServletServer(context.getEnvironment())) { MetaDataProvider metaDataProvider = context.getBean(MetaDataProvider.class); WebServer webServer = new WebServer() { @Override public void start() throws WebServerException { } @Override public void stop() throws WebServerException { } @Override public int getPort() { return metaDataProvider.getServerPort(); } }; context.publishEvent( new ServletWebServerInitializedEvent( webServer, new ServletWebServerApplicationContext()) ); } }
Example #8
Source File: ServerlessReactiveServletEmbeddedServerFactory.java From aws-serverless-java-container with Apache License 2.0 | 5 votes |
@Override public void start() throws WebServerException { // register this object as the main handler servlet with a mapping of / SpringBootLambdaContainerHandler .getInstance() .getServletContext() .addServlet(SERVLET_NAME, this) .addMapping("/"); handler.init(new ServletAdapterConfig()); }
Example #9
Source File: ServerlessServletEmbeddedServerFactory.java From aws-serverless-java-container with Apache License 2.0 | 5 votes |
@Override public WebServer getWebServer(ServletContextInitializer... initializers) { this.initializers = initializers; for (ServletContextInitializer i : initializers) { try { if (handler.getServletContext() == null) { throw new WebServerException("Attempting to initialize ServletEmbeddedWebServer without ServletContext in Handler", null); } i.onStartup(handler.getServletContext()); } catch (ServletException e) { throw new WebServerException("Could not initialize Servlets", e); } } return this; }
Example #10
Source File: NettyTcpServer.java From spring-boot-protocol with Apache License 2.0 | 5 votes |
@Override public void start() throws WebServerException { try{ super.setIoRatio(properties.getServerIoRatio()); super.setIoThreadCount(properties.getServerIoThreads()); super.init(); for(ServerListener serverListener : serverListeners){ serverListener.onServerStart(this); } super.run(); } catch (Exception e) { throw new WebServerException("tcp server start fail.. cause = " + e,e); } }
Example #11
Source File: RSocketWebServer.java From spring-boot-rsocket with Apache License 2.0 | 5 votes |
@Override public void stop() throws WebServerException { if (this.disposableServer != null) { this.disposableServer.dispose(); this.disposableServer = null; } }
Example #12
Source File: MockServletWebServerFactory.java From spring-security-oauth2-boot with Apache License 2.0 | 4 votes |
@Override public void start() throws WebServerException { }
Example #13
Source File: ServerlessReactiveServletEmbeddedServerFactory.java From aws-serverless-java-container with Apache License 2.0 | 4 votes |
@Override public void stop() throws WebServerException { // nothing to do here. }
Example #14
Source File: LealoneTomcatWebServer.java From Lealone-Plugins with Apache License 2.0 | 4 votes |
@Override public void start() throws WebServerException { server.start(); }
Example #15
Source File: LealoneTomcatWebServer.java From Lealone-Plugins with Apache License 2.0 | 4 votes |
@Override public void stop() throws WebServerException { server.stop(); }
Example #16
Source File: ServerlessServletEmbeddedServerFactory.java From aws-serverless-java-container with Apache License 2.0 | 2 votes |
@Override public void start() throws WebServerException { }
Example #17
Source File: ServerlessServletEmbeddedServerFactory.java From aws-serverless-java-container with Apache License 2.0 | 2 votes |
@Override public void stop() throws WebServerException { }