@Bean public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() { return new JettyEmbeddedServletContainerFactory(); } }
int idleTimeout = ConfigurationFactory.getConfiguration().getInt(serviceName + ".http.connectionIdleTime",180000); int acceptQueueSize = ConfigurationFactory.getConfiguration().getInt(serviceName + ".http.acceptQueueSize", 0); final JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(Integer.valueOf(port));
@Test public void customize() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); this.jettySpringBootAutoConfiguration.customize(factory); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()) .isTrue(); }
@Test public void doNotCustomize() throws MalformedURLException { JettyEmbeddedServletContainerFactory tomcatFactory = new JettyEmbeddedServletContainerFactory(); TomcatSpringBootAutoConfiguration tomcatSpringBootAutoConfiguration = new TomcatSpringBootAutoConfiguration(); tomcatSpringBootAutoConfiguration.customize(tomcatFactory); assertThat(tomcatFactory.getServerCustomizers()) .isEmpty(); }
@Test public void doNotCustomize() throws MalformedURLException { JettyEmbeddedServletContainerFactory tomcatFactory = new JettyEmbeddedServletContainerFactory(); TomcatSpringBootAutoConfiguration tomcatSpringBootAutoConfiguration = new TomcatSpringBootAutoConfiguration(); tomcatSpringBootAutoConfiguration.customize(tomcatFactory); assertThat(tomcatFactory.getServerCustomizers()) .isEmpty(); }
public void customize() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); customizer.customize(server); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()) .isTrue(); }
@Test public void customize() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); this.jettySpringBootAutoConfiguration.customize(factory); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).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 { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); this.jettySpringBootAutoConfiguration.customize(factory); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists()) .isTrue(); }
@Test(expectedExceptions = RuntimeException.class) public void invalidClassPathResource() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); JettyProperties jp = new JettyProperties(); jp.setClassPathResource("/~ã``'[ªº*-+.@#$%{&*ç|°;.<>"); JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(jp); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); customizer.customize(server); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()).isTrue(); } }
@Test public void customize() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); customizer.customize(server); 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 { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(this.jettyProperties); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); customizer.customize(server); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("testJetty.txt").exists()) .isTrue(); }
@Test(expected = RuntimeException.class) public void invalidClassPathResource() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); JettyProperties jp = new JettyProperties(); jp.setClassPathResource("/~ã``'[ªº*-+.@#$%{&*ç|°;.<>"); JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(jp); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); customizer.customize(server); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()).isTrue(); } }
@Test(expected = RuntimeException.class) public void invalidClassPathResource() throws MalformedURLException { JettyEmbeddedServletContainerFactory factory = new JettyEmbeddedServletContainerFactory(); JettyProperties jp = new JettyProperties(); jp.setClassPathResource("/~ã``'[ªº*-+.@#$%{&*ç|°;.<>"); JsfJettyServerCustomizer customizer = new JsfJettyServerCustomizer(jp); Server server = ((JettyEmbeddedServletContainer) factory.getEmbeddedServletContainer()).getServer(); customizer.customize(server); Handler[] childHandlersByClass = server.getChildHandlersByClass(WebAppContext.class); WebAppContext webAppContext = (WebAppContext) childHandlersByClass[0]; assertThat(webAppContext.getBaseResource().getResource("test.txt").exists()).isTrue(); } }