private ThreadPool findThreadPool(ApplicationContext applicationContext) { if (applicationContext instanceof EmbeddedWebApplicationContext) { EmbeddedServletContainer container = ((EmbeddedWebApplicationContext) applicationContext).getEmbeddedServletContainer(); if (container instanceof JettyEmbeddedServletContainer) { return ((JettyEmbeddedServletContainer) container).getServer().getThreadPool(); } } return null; }
@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(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(); } }
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 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(); } }