@Override public Optional<ServerApplicationFactory> serverApplicationFactory(){ return Optional.of(new GrizzlyApplicationFactory()); }
private NetworkListener createSSLListener(int port, SSLProperties sslProperties) { SSLConfigurationBuilder sslBuilder = new SSLConfigurationBuilder(); NetworkListener listener = new NetworkListener("grizzly", "0.0.0.0", Integer.valueOf(port)); listener.getFileCache().setEnabled(false); listener.setSecure(true); listener.setSSLEngineConfig(sslBuilder.build(sslProperties)); return listener; }
private void addSSL(HttpServer httpServer) { try { SSLProperties sslProperties = serverData.getRootContext().getBean(SSLProperties.class); if (sslProperties != null) { httpServer.addListener(this.createSSLListener(serverData.getPort(), sslProperties)); } }catch(BeanNotOfRequiredTypeException e){ } }
public void run(CompletableFuture start, JaxRsServletConfigurer jaxRsConfigurer, CompletableFuture end) { WebappContext webappContext = new WebappContext("WebappContext", ""); new ServletContextListenerConfigurer(serverData, servletContextListenerData, servletRequestListenerData); jaxRsConfigurer.addServlet(this.serverData,webappContext); new ServletConfigurer(serverData, servletData).addServlets(webappContext); new FilterConfigurer(serverData, this.filterData).addFilters(webappContext); addListeners(webappContext); HttpServer httpServer = HttpServer.createSimpleServer(null, "0.0.0.0", serverData.getPort()); serverData.getModule().getServerConfigManager().accept(new WebServerProvider(httpServer)); addAccessLog(httpServer); addSSL(httpServer); startServer(webappContext, httpServer, start, end); }
public ServerApplication createApp(final Module module, final ApplicationContext rootContext) { ModuleDataExtractor extractor = new ModuleDataExtractor(module); PersistentList resources = extractor.getRestResources(rootContext); MicroserverEnvironment microserverEnvironment = rootContext.getBean(MicroserverEnvironment.class); microserverEnvironment.assureModule(module); String fullRestResource = "/" + module.getContext() + "/*"; ServerData serverData = new ServerData(microserverEnvironment.getModuleBean(module).getPort(), resources, rootContext, fullRestResource, module); List<FilterData> filterDataList = extractor.createFilteredDataList(serverData); List<ServletData> servletDataList = extractor.createServletDataList(serverData); GrizzlyApplication app = new GrizzlyApplication( new AllData(serverData, filterDataList, servletDataList, module.getListeners(serverData), module.getRequestListeners(serverData))); return app; } }
private void addAccessLog(HttpServer httpServer) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; final AccessLogBuilder builder = new AccessLogBuilder(accessLogLocation); builder.rotatedDaily(); builder.rotationPattern("yyyy-MM-dd"); builder.instrument(httpServer.getServerConfiguration()); } catch (Exception e) { logger.error(InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getMessage()); if (e.getCause() != null) logger.error("CAUSED BY: " + InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getCause().getMessage()); } }
public void run(CompletableFuture start, JaxRsServletConfigurer jaxRsConfigurer, CompletableFuture end) { WebappContext webappContext = new WebappContext("WebappContext", ""); new ServletContextListenerConfigurer(serverData, servletContextListenerData, servletRequestListenerData); jaxRsConfigurer.addServlet(this.serverData,webappContext); new ServletConfigurer(serverData, servletData).addServlets(webappContext); new FilterConfigurer(serverData, this.filterData).addFilters(webappContext); addListeners(webappContext); HttpServer httpServer = HttpServer.createSimpleServer(null, "0.0.0.0", serverData.getPort()); serverData.getModule().getServerConfigManager().accept(new WebServerProvider(httpServer)); addAccessLog(httpServer); addSSL(httpServer); startServer(webappContext, httpServer, start, end); }
private NetworkListener createSSLListener(int port, SSLProperties sslProperties) { SSLConfigurationBuilder sslBuilder = new SSLConfigurationBuilder(); NetworkListener listener = new NetworkListener("grizzly", "0.0.0.0", Integer.valueOf(port)); listener.getFileCache().setEnabled(false); listener.setSecure(true); listener.setSSLEngineConfig(sslBuilder.build(sslProperties)); return listener; }
@Override public Optional<ServerApplicationFactory> serverApplicationFactory(){ return Optional.of(new GrizzlyApplicationFactory()); }
private void addSSL(HttpServer httpServer) { try { SSLProperties sslProperties = serverData.getRootContext().getBean(SSLProperties.class); if (sslProperties != null) { httpServer.addListener(this.createSSLListener(serverData.getPort(), sslProperties)); } }catch(BeanNotOfRequiredTypeException e){ } }
public ServerApplication createApp(final Module module, final ApplicationContext rootContext) { ModuleDataExtractor extractor = new ModuleDataExtractor(module); PersistentList resources = extractor.getRestResources(rootContext); MicroserverEnvironment microserverEnvironment = rootContext.getBean(MicroserverEnvironment.class); microserverEnvironment.assureModule(module); String fullRestResource = "/" + module.getContext() + "/*"; ServerData serverData = new ServerData(microserverEnvironment.getModuleBean(module).getPort(), resources, rootContext, fullRestResource, module); List<FilterData> filterDataList = extractor.createFilteredDataList(serverData); List<ServletData> servletDataList = extractor.createServletDataList(serverData); GrizzlyApplication app = new GrizzlyApplication( new AllData(serverData, filterDataList, servletDataList, module.getListeners(serverData), module.getRequestListeners(serverData))); return app; } }
private void addAccessLog(HttpServer httpServer) { try { String accessLogLocation = serverData.getRootContext().getBean(AccessLogLocationBean.class).getAccessLogLocation(); accessLogLocation = accessLogLocation + "/" + replaceSlash(serverData.getModule().getContext()) + "-access.log"; final AccessLogBuilder builder = new AccessLogBuilder(accessLogLocation); builder.rotatedDaily(); builder.rotationPattern("yyyy-MM-dd"); builder.instrument(httpServer.getServerConfiguration()); } catch (Exception e) { logger.error(InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getMessage()); if (e.getCause() != null) logger.error("CAUSED BY: " + InternalErrorCode.SERVER_STARTUP_FAILED_TO_CREATE_ACCESS_LOG.toString() + ": " + e.getCause().getMessage()); } }