/** * Create the JettyServletWebServerFactory bean. * * @return JettyServletWebServerFactory */ @Bean public JettyServletWebServerFactory jettyServletWebServerFactory() { JettyServletWebServerFactory factory = new JettyServletWebServerFactory(); factory.addServerCustomizers(this::configureServerForHttp2); return factory; }
/** * {@inheritDoc} */ @Override public void customize(final JettyServletWebServerFactory factory) { if (serverProperties.getSsl() != null && serverProperties.getSsl().isEnabled()) { factory.addServerCustomizers(this::sslCustomizer); } }
@Test public void customize() throws MalformedURLException { JettyServletWebServerFactory factory = new JettyServletWebServerFactory(); this.jettySpringBootAutoConfiguration.customize(factory); Server server = ((JettyWebServer) factory.getWebServer()).getServer(); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists()) .isTrue(); }
@Test public void customize() throws MalformedURLException { JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties); Server server = ((JettyWebServer) new JettyServletWebServerFactory().getWebServer()).getServer(); customizer.customize(server); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists()) .isTrue(); }
@Bean public JettyServletWebServerFactory jettyEmbeddedServletContainerFactory() { JettyServletWebServerFactory jettyContainerFactory = new JettyServletWebServerFactory(); jettyContainerFactory.setContextPath(CONTEXT_PATH); return jettyContainerFactory; }
@Override public void customize(JettyServletWebServerFactory container) { container.addServerCustomizers(new JsfJettyServerCustomizer(this.jettyProperties)); }
@Bean public JettyServletWebServerFactory jettyServletWebServerFactory() { return new JettyServletWebServerFactory(); }
/** {@inheritDoc} */ @Override protected void installLogbackAccess(JettyServletWebServerFactory container) { container.addServerCustomizers(this::wrapJettyHandler); log.debug("Installed Logback-access: container=[{}]", container); }