diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java index d54cd75247..c8f64e5d63 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java @@ -148,7 +148,7 @@ public class EndpointWebMvcAutoConfiguration if (managementPort == ManagementServerPort.DIFFERENT) { if (this.applicationContext instanceof EmbeddedWebApplicationContext && ((EmbeddedWebApplicationContext) this.applicationContext) - .getEmbeddedServletContainer() != null) { + .getEmbeddedWebServer() != null) { createChildManagementContext(); } else { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java index 0b6dbd877f..9d0bc38d7f 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcChildContextConfiguration.java @@ -44,9 +44,9 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura import org.springframework.boot.autoconfigure.web.ErrorAttributes; import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.EmbeddedWebServer; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; import org.springframework.boot.web.servlet.ErrorPage; @@ -68,7 +68,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; /** * Configuration triggered from {@link EndpointWebMvcAutoConfiguration} when a new - * {@link EmbeddedServletContainer} running on a different port is required. + * {@link EmbeddedWebServer} running on a different port is required. * * @author Dave Syer * @author Stephane Nicoll diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java index 565b2b1aeb..c02cff0085 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/TomcatPublicMetrics.java @@ -28,8 +28,8 @@ import org.apache.catalina.session.ManagerBase; import org.springframework.beans.BeansException; import org.springframework.boot.actuate.metrics.Metric; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; +import org.springframework.boot.context.embedded.EmbeddedWebServer; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -58,10 +58,10 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa } private Manager getManager(EmbeddedWebApplicationContext applicationContext) { - EmbeddedServletContainer embeddedServletContainer = applicationContext - .getEmbeddedServletContainer(); - if (embeddedServletContainer instanceof TomcatEmbeddedServletContainer) { - return getManager((TomcatEmbeddedServletContainer) embeddedServletContainer); + EmbeddedWebServer embeddedWebServer = applicationContext + .getEmbeddedWebServer(); + if (embeddedWebServer instanceof TomcatEmbeddedServletContainer) { + return getManager((TomcatEmbeddedServletContainer) embeddedWebServer); } return null; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java index a49f73c0e9..bb6583e777 100755 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfigurationTests.java @@ -62,10 +62,10 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfi import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent; +import org.springframework.boot.context.embedded.EmbeddedWebServer; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.boot.context.embedded.ServerPortInfoApplicationContextInitializer; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; @@ -351,7 +351,7 @@ public class EndpointWebMvcAutoConfigurationTests { this.applicationContext.register(RootConfig.class, EndpointConfig.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, ErrorMvcAutoConfiguration.class); - this.thrown.expect(EmbeddedServletContainerException.class); + this.thrown.expect(EmbeddedWebServerException.class); this.applicationContext.refresh(); } finally { @@ -887,7 +887,7 @@ public class EndpointWebMvcAutoConfigurationTests { private ApplicationContext rootContext; - private EmbeddedServletContainer servletContainer; + private EmbeddedWebServer servletContainer; GrabManagementPort(ApplicationContext rootContext) { this.rootContext = rootContext; @@ -900,7 +900,7 @@ public class EndpointWebMvcAutoConfigurationTests { } } - public EmbeddedServletContainer getServletContainer() { + public EmbeddedWebServer getServletContainer() { return this.servletContainer; } diff --git a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java index 9e6e02fb61..b9aa0afc4a 100644 --- a/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java +++ b/spring-boot-actuator/src/test/java/org/springframework/boot/actuate/cloudfoundry/SkipSslVerificationHttpRequestFactoryTests.java @@ -23,7 +23,7 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; +import org.springframework.boot.context.embedded.EmbeddedWebServer; import org.springframework.boot.context.embedded.ExampleServlet; import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; @@ -66,7 +66,7 @@ public class SkipSslVerificationHttpRequestFactoryTests { TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory( 0); factory.setSsl(getSsl("password", "classpath:test.jks")); - EmbeddedServletContainer container = factory.getEmbeddedServletContainer( + EmbeddedWebServer container = factory.getEmbeddedServletContainer( new ServletRegistrationBean(new ExampleServlet(), "/hello")); container.start(); return "https://localhost:" + container.getPort() + "/hello"; diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java index b02785ebe1..64efd3580a 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/admin/SpringApplicationAdminJmxAutoConfigurationTests.java @@ -128,7 +128,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { assertThat(this.mBeanServer.getAttribute(createDefaultObjectName(), "EmbeddedWebApplication")).isEqualTo(Boolean.TRUE); int expected = ((EmbeddedWebApplicationContext) this.context) - .getEmbeddedServletContainer().getPort(); + .getEmbeddedWebServer().getPort(); String actual = getProperty(createDefaultObjectName(), "local.server.port"); assertThat(actual).isEqualTo(String.valueOf(expected)); } diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java index bb3e2d8adf..1ea124601d 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/MustacheAutoConfigurationIntegrationTests.java @@ -64,7 +64,7 @@ public class MustacheAutoConfigurationIntegrationTests { @Before public void init() { - this.port = this.context.getEmbeddedServletContainer().getPort(); + this.port = this.context.getEmbeddedWebServer().getPort(); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java index 76daa2a223..e72bf34a49 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mustache/web/MustacheWebIntegrationTests.java @@ -70,7 +70,7 @@ public class MustacheWebIntegrationTests { @Before public void init() { - this.port = this.context.getEmbeddedServletContainer().getPort(); + this.port = this.context.getEmbeddedWebServer().getPort(); } @Test diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java index b5711dced0..9638ff488c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/SecurityFilterAutoConfigurationEarlyInitializationTests.java @@ -64,7 +64,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests { "security.user.password:password"); context.register(Config.class); context.refresh(); - int port = context.getEmbeddedServletContainer().getPort(); + int port = context.getEmbeddedWebServer().getPort(); new TestRestTemplate("user", "password") .getForEntity("http://localhost:" + port, Object.class); // If early initialization occurred a ConverterNotFoundException is thrown diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java index 5c6c495073..94a4d2ba4c 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/OAuth2AutoConfigurationTests.java @@ -399,7 +399,7 @@ public class OAuth2AutoConfigurationTests { private void verifyAuthentication(ClientDetails config, HttpStatus finalStatus) { String baseUrl = "http://localhost:" - + this.context.getEmbeddedServletContainer().getPort(); + + this.context.getEmbeddedWebServer().getPort(); TestRestTemplate rest = new TestRestTemplate(); // First, verify the web endpoint can't be reached assertEndpointUnauthorized(baseUrl, rest); diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java index 942c42a92e..3e7407481f 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/EmbeddedServletContainerServletContextListenerTests.java @@ -22,8 +22,8 @@ import javax.servlet.ServletContextListener; import org.junit.Test; import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.EmbeddedWebServer; import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; @@ -36,7 +36,7 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; /** - * Tests for {@link EmbeddedServletContainer}s driving {@link ServletContextListener}s + * Tests for {@link EmbeddedWebServer}s driving {@link ServletContextListener}s * correctly * * @author Andy Wilkinson diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java index 067e3a8f81..b67a61cf13 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/web/MultipartAutoConfigurationTests.java @@ -139,7 +139,7 @@ public class MultipartAutoConfigurationTests { this.context = new AnnotationConfigEmbeddedWebApplicationContext( ContainerWithEverythingTomcat.class, BaseConfiguration.class); new RestTemplate().getForObject("http://localhost:" - + this.context.getEmbeddedServletContainer().getPort() + "/", + + this.context.getEmbeddedWebServer().getPort() + "/", String.class); this.context.getBean(MultipartConfigElement.class); assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs( @@ -208,7 +208,7 @@ public class MultipartAutoConfigurationTests { HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); ClientHttpRequest request = requestFactory.createRequest( new URI("http://localhost:" - + this.context.getEmbeddedServletContainer().getPort() + "/"), + + this.context.getEmbeddedWebServer().getPort() + "/"), HttpMethod.GET); ClientHttpResponse response = request.execute(); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); @@ -217,7 +217,7 @@ public class MultipartAutoConfigurationTests { private void verifyServletWorks() { RestTemplate restTemplate = new RestTemplate(); String url = "http://localhost:" - + this.context.getEmbeddedServletContainer().getPort() + "/"; + + this.context.getEmbeddedWebServer().getPort() + "/"; assertThat(restTemplate.getForObject(url, String.class)).isEqualTo("Hello"); } diff --git a/spring-boot-cli/samples/http.groovy b/spring-boot-cli/samples/http.groovy index 564f229025..f7ff3ef77e 100644 --- a/spring-boot-cli/samples/http.groovy +++ b/spring-boot-cli/samples/http.groovy @@ -16,7 +16,7 @@ class Example implements CommandLineRunner { } void run(String... args) { - def port = context.embeddedServletContainer.port; + def port = context.embeddedWebServer.port; def world = new RESTClient("http://localhost:" + port).get(path:"/").data.text print "Hello " + world } diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java index 2dff183f1c..8c6a5d156f 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/autoconfigure/LocalDevToolsAutoConfigurationTests.java @@ -246,7 +246,7 @@ public class LocalDevToolsAutoConfigurationTests { public void devToolsSwitchesJspServletToDevelopmentMode() { this.context = initializeAndRun(Config.class); TomcatEmbeddedServletContainer tomcatContainer = (TomcatEmbeddedServletContainer) ((EmbeddedWebApplicationContext) this.context) - .getEmbeddedServletContainer(); + .getEmbeddedWebServer(); Container context = tomcatContainer.getTomcat().getHost().findChildren()[0]; StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp"); EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils diff --git a/spring-boot-docs/src/main/asciidoc/howto.adoc b/spring-boot-docs/src/main/asciidoc/howto.adoc index 998bc3a214..ecde0a60f1 100644 --- a/spring-boot-docs/src/main/asciidoc/howto.adoc +++ b/spring-boot-docs/src/main/asciidoc/howto.adoc @@ -571,7 +571,7 @@ To scan for a free port (using OS natives to prevent clashes) use `server.port=0 [[howto-discover-the-http-port-at-runtime]] === Discover the HTTP port at runtime You can access the port the server is running on from log output or from the -`EmbeddedWebApplicationContext` via its `EmbeddedServletContainer`. The best way to get +`EmbeddedWebApplicationContext` via its `EmbeddedWebServer`. The best way to get that and be sure that it has initialized is to add a `@Bean` of type `ApplicationListener` and pull the container out of the event when it is published. diff --git a/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java b/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java index 3fcad5eb37..bf1d81cba9 100644 --- a/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java +++ b/spring-boot-docs/src/test/java/org/springframework/boot/context/embedded/TomcatLegacyCookieProcessorExampleTests.java @@ -41,7 +41,7 @@ public class TomcatLegacyCookieProcessorExampleTests { EmbeddedWebApplicationContext applicationContext = (EmbeddedWebApplicationContext) new SpringApplication( TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run(); Context context = (Context) ((TomcatEmbeddedServletContainer) applicationContext - .getEmbeddedServletContainer()).getTomcat().getHost().findChildren()[0]; + .getEmbeddedWebServer()).getTomcat().getHost().findChildren()[0]; assertThat(context.getCookieProcessor()) .isInstanceOf(LegacyCookieProcessor.class); } diff --git a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java index 3383a91b36..8fa13489b3 100644 --- a/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java +++ b/spring-boot-samples/spring-boot-sample-tomcat/src/test/java/sample/tomcat/SampleTomcatApplicationTests.java @@ -90,7 +90,7 @@ public class SampleTomcatApplicationTests { public void testTimeout() throws Exception { EmbeddedWebApplicationContext context = (EmbeddedWebApplicationContext) this.applicationContext; TomcatEmbeddedServletContainer embeddedServletContainer = (TomcatEmbeddedServletContainer) context - .getEmbeddedServletContainer(); + .getEmbeddedWebServer(); ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat() .getConnector().getProtocolHandler(); int timeout = ((AbstractProtocol) protocolHandler).getConnectionTimeout(); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java index ba2c7e24a9..9dfbd728cd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactory.java @@ -184,7 +184,7 @@ public abstract class AbstractEmbeddedServletContainerFactory return tempDir; } catch (IOException ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to create tempDir. java.io.tmpdir is set to " + System.getProperty("java.io.tmpdir"), ex); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java index 80486a804c..a2a647ee0f 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerFactory.java @@ -23,12 +23,12 @@ import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletCon import org.springframework.boot.web.servlet.ServletContextInitializer; /** - * Factory interface that can be used to create {@link EmbeddedServletContainer}s. + * Factory interface that can be used to create {@link EmbeddedWebServer}s. * Implementations are encouraged to extend * {@link AbstractEmbeddedServletContainerFactory} when possible. * * @author Phillip Webb - * @see EmbeddedServletContainer + * @see EmbeddedWebServer * @see AbstractEmbeddedServletContainerFactory * @see JettyEmbeddedServletContainerFactory * @see TomcatEmbeddedServletContainerFactory @@ -37,16 +37,16 @@ import org.springframework.boot.web.servlet.ServletContextInitializer; public interface EmbeddedServletContainerFactory { /** - * Gets a new fully configured but paused {@link EmbeddedServletContainer} instance. + * Gets a new fully configured but paused {@link EmbeddedWebServer} instance. * Clients should not be able to connect to the returned server until - * {@link EmbeddedServletContainer#start()} is called (which happens when the + * {@link EmbeddedWebServer#start()} is called (which happens when the * {@link ApplicationContext} has been fully refreshed). * @param initializers {@link ServletContextInitializer}s that should be applied as * the container starts - * @return a fully configured and started {@link EmbeddedServletContainer} - * @see EmbeddedServletContainer#stop() + * @return a fully configured and started {@link EmbeddedWebServer} + * @see EmbeddedWebServer#stop() */ - EmbeddedServletContainer getEmbeddedServletContainer( + EmbeddedWebServer getEmbeddedServletContainer( ServletContextInitializer... initializers); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java index aab4e67773..55ec953785 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerInitializedEvent.java @@ -20,7 +20,7 @@ import org.springframework.context.ApplicationEvent; /** * Event to be published after the context is refreshed and the - * {@link EmbeddedServletContainer} is ready. Useful for obtaining the local port of a + * {@link EmbeddedWebServer} is ready. Useful for obtaining the local port of a * running server. Normally it will have been started, but listeners are free to inspect * the server and stop and start it if they want to. * @@ -33,26 +33,26 @@ public class EmbeddedServletContainerInitializedEvent extends ApplicationEvent { public EmbeddedServletContainerInitializedEvent( EmbeddedWebApplicationContext applicationContext, - EmbeddedServletContainer source) { + EmbeddedWebServer source) { super(source); this.applicationContext = applicationContext; } /** - * Access the {@link EmbeddedServletContainer}. + * Access the {@link EmbeddedWebServer}. * @return the embedded servlet container */ - public EmbeddedServletContainer getEmbeddedServletContainer() { + public EmbeddedWebServer getEmbeddedServletContainer() { return getSource(); } /** - * Access the source of the event (an {@link EmbeddedServletContainer}). + * Access the source of the event (an {@link EmbeddedWebServer}). * @return the embedded servlet container */ @Override - public EmbeddedServletContainer getSource() { - return (EmbeddedServletContainer) super.getSource(); + public EmbeddedWebServer getSource() { + return (EmbeddedWebServer) super.getSource(); } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java index 04ea2b95b5..bdb4de3cad 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebApplicationContext.java @@ -57,7 +57,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils; * A {@link WebApplicationContext} that can be used to bootstrap itself from a contained * {@link EmbeddedServletContainerFactory} bean. *

- * This context will create, initialize and run an {@link EmbeddedServletContainer} by + * This context will create, initialize and run an {@link EmbeddedWebServer} by * searching for a single {@link EmbeddedServletContainerFactory} bean within the * {@link ApplicationContext} itself. The {@link EmbeddedServletContainerFactory} is free * to use standard Spring concepts (such as dependency injection, lifecycle callbacks and @@ -99,7 +99,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext */ public static final String DISPATCHER_SERVLET_NAME = "dispatcherServlet"; - private volatile EmbeddedServletContainer embeddedServletContainer; + private volatile EmbeddedWebServer embeddedWebServer; private ServletConfig servletConfig; @@ -142,7 +142,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext @Override protected void finishRefresh() { super.finishRefresh(); - EmbeddedServletContainer localContainer = startEmbeddedServletContainer(); + EmbeddedWebServer localContainer = startEmbeddedServletContainer(); if (localContainer != null) { publishEvent( new EmbeddedServletContainerInitializedEvent(this, localContainer)); @@ -156,11 +156,11 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext } private void createEmbeddedServletContainer() { - EmbeddedServletContainer localContainer = this.embeddedServletContainer; + EmbeddedWebServer localContainer = this.embeddedWebServer; ServletContext localServletContext = getServletContext(); if (localContainer == null && localServletContext == null) { EmbeddedServletContainerFactory containerFactory = getEmbeddedServletContainerFactory(); - this.embeddedServletContainer = containerFactory + this.embeddedWebServer = containerFactory .getEmbeddedServletContainer(getSelfInitializer()); } else if (localServletContext != null) { @@ -291,8 +291,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext } } - private EmbeddedServletContainer startEmbeddedServletContainer() { - EmbeddedServletContainer localContainer = this.embeddedServletContainer; + private EmbeddedWebServer startEmbeddedServletContainer() { + EmbeddedWebServer localContainer = this.embeddedWebServer; if (localContainer != null) { localContainer.start(); } @@ -300,11 +300,11 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext } private void stopAndReleaseEmbeddedServletContainer() { - EmbeddedServletContainer localContainer = this.embeddedServletContainer; + EmbeddedWebServer localContainer = this.embeddedWebServer; if (localContainer != null) { try { localContainer.stop(); - this.embeddedServletContainer = null; + this.embeddedWebServer = null; } catch (Exception ex) { throw new IllegalStateException(ex); @@ -341,12 +341,12 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext } /** - * Returns the {@link EmbeddedServletContainer} that was created by the context or + * Returns the {@link EmbeddedWebServer} that was created by the context or * {@code null} if the container has not yet been created. * @return the embedded servlet container */ - public EmbeddedServletContainer getEmbeddedServletContainer() { - return this.embeddedServletContainer; + public EmbeddedWebServer getEmbeddedWebServer() { + return this.embeddedWebServer; } /** diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebServer.java similarity index 75% rename from spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java rename to spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebServer.java index 872cdd33c8..1e099f85d9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebServer.java @@ -17,8 +17,8 @@ package org.springframework.boot.context.embedded; /** - * Simple interface that represents a fully configured embedded servlet container (for - * example Tomcat or Jetty). Allows the container to be {@link #start() started} and + * Simple interface that represents a fully configured embedded web server (for + * example Tomcat or Jetty). Allows the server to be {@link #start() started} and * {@link #stop() stopped}. *

* Instances of this class are usually obtained via a @@ -28,21 +28,21 @@ package org.springframework.boot.context.embedded; * @author Dave Syer * @see EmbeddedServletContainerFactory */ -public interface EmbeddedServletContainer { +public interface EmbeddedWebServer { /** * Starts the embedded servlet container. Calling this method on an already started * container has no effect. - * @throws EmbeddedServletContainerException if the container cannot be started + * @throws EmbeddedWebServerException if the container cannot be started */ - void start() throws EmbeddedServletContainerException; + void start() throws EmbeddedWebServerException; /** * Stops the embedded servlet container. Calling this method on an already stopped * container has no effect. - * @throws EmbeddedServletContainerException if the container cannot be stopped + * @throws EmbeddedWebServerException if the container cannot be stopped */ - void stop() throws EmbeddedServletContainerException; + void stop() throws EmbeddedWebServerException; /** * Return the port this server is listening on. diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerException.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebServerException.java similarity index 84% rename from spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerException.java rename to spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebServerException.java index b7d03ad025..74afdd1ce1 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedServletContainerException.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/EmbeddedWebServerException.java @@ -22,9 +22,9 @@ package org.springframework.boot.context.embedded; * @author Phillip Webb */ @SuppressWarnings("serial") -public class EmbeddedServletContainerException extends RuntimeException { +public class EmbeddedWebServerException extends RuntimeException { - public EmbeddedServletContainerException(String message, Throwable cause) { + public EmbeddedWebServerException(String message, Throwable cause) { super(message, cause); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/PortInUseException.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/PortInUseException.java index 7f83c47359..f804f6ef12 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/PortInUseException.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/PortInUseException.java @@ -23,7 +23,7 @@ package org.springframework.boot.context.embedded; * @author Andy Wilkinson * @since 1.4.0 */ -public class PortInUseException extends EmbeddedServletContainerException { +public class PortInUseException extends EmbeddedWebServerException { private final int port; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServerPortInfoApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServerPortInfoApplicationContextInitializer.java index e03179e1eb..a7fa35e095 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServerPortInfoApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/ServerPortInfoApplicationContextInitializer.java @@ -33,7 +33,7 @@ import org.springframework.util.StringUtils; /** * {@link ApplicationContextInitializer} that sets {@link Environment} properties for the - * ports that {@link EmbeddedServletContainer} servers are actually listening on. The + * ports that {@link EmbeddedWebServer} servers are actually listening on. The * property {@literal "local.server.port"} can be injected directly into tests using * {@link Value @Value} or obtained via the {@link Environment}. *

diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java index adbb5ba0d3..f95dfe46fa 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/SslStoreProvider.java @@ -19,7 +19,7 @@ package org.springframework.boot.context.embedded; import java.security.KeyStore; /** - * Interface to provide SSL key stores for an {@link EmbeddedServletContainer} to use. Can + * Interface to provide SSL key stores for an {@link EmbeddedWebServer} to use. Can * be used when file based key stores cannot be used. * * @author Phillip Webb diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java index b3104910f5..12ea934da8 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainer.java @@ -28,15 +28,15 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.HandlerWrapper; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; +import org.springframework.boot.context.embedded.EmbeddedWebServer; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.boot.context.embedded.PortInUseException; import org.springframework.util.Assert; import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; /** - * {@link EmbeddedServletContainer} that can be used to control an embedded Jetty server. + * {@link EmbeddedWebServer} that can be used to control an embedded Jetty server. * Usually this class should be created using the * {@link JettyEmbeddedServletContainerFactory} and not directly. * @@ -46,7 +46,7 @@ import org.springframework.util.StringUtils; * @author EddĂș MelĂ©ndez * @see JettyEmbeddedServletContainerFactory */ -public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { +public class JettyEmbeddedServletContainer implements EmbeddedWebServer { private static final Log logger = LogFactory .getLog(JettyEmbeddedServletContainer.class); @@ -96,7 +96,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { catch (Exception ex) { // Ensure process isn't left running stopSilently(); - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to start embedded Jetty servlet container", ex); } } @@ -112,7 +112,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { } @Override - public void start() throws EmbeddedServletContainerException { + public void start() throws EmbeddedWebServerException { synchronized (this.monitor) { if (this.started) { return; @@ -143,11 +143,11 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { JettyEmbeddedServletContainer.logger .info("Jetty started on port(s) " + getActualPortsDescription()); } - catch (EmbeddedServletContainerException ex) { + catch (EmbeddedWebServerException ex) { throw ex; } catch (Exception ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to start embedded Jetty servlet container", ex); } } @@ -216,7 +216,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { Thread.currentThread().interrupt(); } catch (Exception ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to stop embedded Jetty servlet container", ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java index b7fbd037a5..9e1802afa3 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactory.java @@ -65,9 +65,9 @@ import org.eclipse.jetty.webapp.WebAppContext; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.Compression; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.EmbeddedWebServer; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.boot.context.embedded.MimeMappings; import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl.ClientAuth; @@ -149,7 +149,7 @@ public class JettyEmbeddedServletContainerFactory } @Override - public EmbeddedServletContainer getEmbeddedServletContainer( + public EmbeddedWebServer getEmbeddedServletContainer( ServletContextInitializer... initializers) { JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext(); int port = (getPort() >= 0 ? getPort() : 0); @@ -291,7 +291,7 @@ public class JettyEmbeddedServletContainerFactory factory.setKeyStoreResource(Resource.newResource(url)); } catch (IOException ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Could not find key store '" + ssl.getKeyStore() + "'", ex); } if (ssl.getKeyStoreType() != null) { @@ -312,7 +312,7 @@ public class JettyEmbeddedServletContainerFactory factory.setTrustStoreResource(Resource.newResource(url)); } catch (IOException ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Could not find trust store '" + ssl.getTrustStore() + "'", ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java index 9fc6e6c960..4bdcbe43f2 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/jetty/package-info.java @@ -16,7 +16,7 @@ /** * Support for Jetty - * {@link org.springframework.boot.context.embedded.EmbeddedServletContainer + * {@link org.springframework.boot.context.embedded.EmbeddedWebServer * EmbeddedServletContainers}. * * @see org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ConnectorStartFailedException.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ConnectorStartFailedException.java index f2f4aadfda..c69f342580 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ConnectorStartFailedException.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/ConnectorStartFailedException.java @@ -18,7 +18,7 @@ package org.springframework.boot.context.embedded.tomcat; import org.apache.catalina.connector.Connector; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; /** * A {@code ConnectorStartFailedException} is thrown when a Tomcat {@link Connector} fails @@ -27,7 +27,7 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerExcepti * @author Andy Wilkinson * @since 1.4.1 */ -public class ConnectorStartFailedException extends EmbeddedServletContainerException { +public class ConnectorStartFailedException extends EmbeddedWebServerException { private final int port; diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java index 0fe9d6373e..0852c9bbef 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainer.java @@ -34,12 +34,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.naming.ContextBindings; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; +import org.springframework.boot.context.embedded.EmbeddedWebServer; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.util.Assert; /** - * {@link EmbeddedServletContainer} that can be used to control an embedded Tomcat server. + * {@link EmbeddedWebServer} that can be used to control an embedded Tomcat server. * Usually this class should be created using the * {@link TomcatEmbeddedServletContainerFactory} and not directly. * @@ -47,7 +47,7 @@ import org.springframework.util.Assert; * @author Dave Syer * @see TomcatEmbeddedServletContainerFactory */ -public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer { +public class TomcatEmbeddedServletContainer implements EmbeddedWebServer { private static final Log logger = LogFactory .getLog(TomcatEmbeddedServletContainer.class); @@ -84,7 +84,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer initialize(); } - private void initialize() throws EmbeddedServletContainerException { + private void initialize() throws EmbeddedWebServerException { TomcatEmbeddedServletContainer.logger .info("Tomcat initialized with port(s): " + getPortsDescription(false)); synchronized (this.monitor) { @@ -114,7 +114,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer startDaemonAwaitThread(); } catch (Exception ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to start embedded Tomcat", ex); } } @@ -175,7 +175,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer } @Override - public void start() throws EmbeddedServletContainerException { + public void start() throws EmbeddedWebServerException { synchronized (this.monitor) { if (this.started) { return; @@ -196,7 +196,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer throw ex; } catch (Exception ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to start embedded Tomcat servlet container", ex); } finally { @@ -267,7 +267,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer } catch (Exception ex) { TomcatEmbeddedServletContainer.logger.error("Cannot start connector: ", ex); - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to start embedded Tomcat connectors", ex); } } @@ -277,7 +277,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer } @Override - public void stop() throws EmbeddedServletContainerException { + public void stop() throws EmbeddedWebServerException { synchronized (this.monitor) { if (!this.started) { return; @@ -293,7 +293,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer } } catch (Exception ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to stop embedded Tomcat", ex); } finally { diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java index 7726d81949..6acd4bcdbd 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java @@ -57,9 +57,9 @@ import org.apache.tomcat.util.net.SSLHostConfig; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.Compression; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.EmbeddedWebServer; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.boot.context.embedded.MimeMappings; import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl.ClientAuth; @@ -156,7 +156,7 @@ public class TomcatEmbeddedServletContainerFactory } @Override - public EmbeddedServletContainer getEmbeddedServletContainer( + public EmbeddedWebServer getEmbeddedServletContainer( ServletContextInitializer... initializers) { Tomcat tomcat = new Tomcat(); File baseDir = (this.baseDirectory != null ? this.baseDirectory @@ -414,7 +414,7 @@ public class TomcatEmbeddedServletContainerFactory protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString()); } catch (FileNotFoundException ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Could not load key store: " + ex.getMessage(), ex); } if (ssl.getKeyStoreType() != null) { @@ -433,7 +433,7 @@ public class TomcatEmbeddedServletContainerFactory ResourceUtils.getURL(ssl.getTrustStore()).toString()); } catch (FileNotFoundException ex) { - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Could not load trust store: " + ex.getMessage(), ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java index 88332132ee..48ef6aed56 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/package-info.java @@ -16,7 +16,7 @@ /** * Support for Tomcat - * {@link org.springframework.boot.context.embedded.EmbeddedServletContainer + * {@link org.springframework.boot.context.embedded.EmbeddedWebServer * EmbeddedServletContainers}. * * @see org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java index 0208cf4080..d3ef612ffc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainer.java @@ -44,8 +44,8 @@ import org.apache.commons.logging.LogFactory; import org.xnio.channels.BoundChannel; import org.springframework.boot.context.embedded.Compression; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; +import org.springframework.boot.context.embedded.EmbeddedWebServer; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.boot.context.embedded.PortInUseException; import org.springframework.http.HttpHeaders; import org.springframework.util.MimeType; @@ -54,7 +54,7 @@ import org.springframework.util.ReflectionUtils; import org.springframework.util.StringUtils; /** - * {@link EmbeddedServletContainer} that can be used to control an embedded Undertow + * {@link EmbeddedWebServer} that can be used to control an embedded Undertow * server. Typically this class should be created using * {@link UndertowEmbeddedServletContainerFactory} and not directly. * @@ -65,7 +65,7 @@ import org.springframework.util.StringUtils; * @since 1.2.0 * @see UndertowEmbeddedServletContainerFactory */ -public class UndertowEmbeddedServletContainer implements EmbeddedServletContainer { +public class UndertowEmbeddedServletContainer implements EmbeddedWebServer { private static final Log logger = LogFactory .getLog(UndertowEmbeddedServletContainer.class); @@ -142,7 +142,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine } @Override - public void start() throws EmbeddedServletContainerException { + public void start() throws EmbeddedWebServerException { synchronized (this.monitor) { if (this.started) { return; @@ -169,7 +169,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine failedPorts.iterator().next().getNumber()); } } - throw new EmbeddedServletContainerException( + throw new EmbeddedWebServerException( "Unable to start embedded Undertow", ex); } } @@ -306,7 +306,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine } @Override - public void stop() throws EmbeddedServletContainerException { + public void stop() throws EmbeddedWebServerException { synchronized (this.monitor) { if (!this.started) { return; @@ -317,7 +317,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine this.undertow.stop(); } catch (Exception ex) { - throw new EmbeddedServletContainerException("Unable to stop undertow", + throw new EmbeddedWebServerException("Unable to stop undertow", ex); } } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java index 96f2b54449..18a9fce8e4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java @@ -67,8 +67,8 @@ import org.xnio.Xnio; import org.xnio.XnioWorker; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; +import org.springframework.boot.context.embedded.EmbeddedWebServer; import org.springframework.boot.context.embedded.MimeMappings.Mapping; import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl.ClientAuth; @@ -219,7 +219,7 @@ public class UndertowEmbeddedServletContainerFactory } @Override - public EmbeddedServletContainer getEmbeddedServletContainer( + public EmbeddedWebServer getEmbeddedServletContainer( ServletContextInitializer... initializers) { DeploymentManager manager = createDeploymentManager(initializers); int port = getPort(); diff --git a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java index ada4019519..eb65f5c027 100644 --- a/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/package-info.java @@ -16,7 +16,7 @@ /** * Support for Undertow - * {@link org.springframework.boot.context.embedded.EmbeddedServletContainer + * {@link org.springframework.boot.context.embedded.EmbeddedWebServer * EmbeddedServletContainers}. * * @see org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java index 2e60400771..0970d1133e 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/AbstractEmbeddedServletContainerFactoryTests.java @@ -128,7 +128,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { @Rule public InternalOutputCapture output = new InternalOutputCapture(); - protected EmbeddedServletContainer container; + protected EmbeddedWebServer container; private final HttpClientContext httpClientContext = HttpClientContext.create(); diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java index 8e2b1c5cba..1ddbc5ddef 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/EmbeddedServletContainerMvcIntegrationTests.java @@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; /** * Integration tests for {@link EmbeddedWebApplicationContext} and - * {@link EmbeddedServletContainer}s running Spring MVC. + * {@link EmbeddedWebServer}s running Spring MVC. * * @author Phillip Webb * @author Ivan Sopov @@ -98,7 +98,7 @@ public class EmbeddedServletContainerMvcIntegrationTests { SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); ClientHttpRequest request = clientHttpRequestFactory.createRequest( new URI("http://localhost:" - + context.getEmbeddedServletContainer().getPort() + resourcePath), + + context.getEmbeddedWebServer().getPort() + resourcePath), HttpMethod.GET); ClientHttpResponse response = request.execute(); try { diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java index cd83a52310..af3c28095c 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/MockEmbeddedServletContainerFactory.java @@ -55,7 +55,7 @@ public class MockEmbeddedServletContainerFactory private MockEmbeddedServletContainer container; @Override - public EmbeddedServletContainer getEmbeddedServletContainer( + public EmbeddedWebServer getEmbeddedServletContainer( ServletContextInitializer... initializers) { this.container = spy(new MockEmbeddedServletContainer( mergeInitializers(initializers), getPort())); @@ -80,7 +80,7 @@ public class MockEmbeddedServletContainerFactory : getContainer().getRegisteredFilters().get(index); } - public static class MockEmbeddedServletContainer implements EmbeddedServletContainer { + public static class MockEmbeddedServletContainer implements EmbeddedWebServer { private ServletContext servletContext; @@ -167,7 +167,7 @@ public class MockEmbeddedServletContainerFactory } @Override - public void start() throws EmbeddedServletContainerException { + public void start() throws EmbeddedWebServerException { } @Override diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java index cb4fff0da8..adb88202e7 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactoryTests.java @@ -50,7 +50,7 @@ import org.mockito.InOrder; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactoryTests; -import org.springframework.boot.context.embedded.EmbeddedServletContainerException; +import org.springframework.boot.context.embedded.EmbeddedWebServerException; import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.testutil.InternalOutputCapture; import org.springframework.test.util.ReflectionTestUtils; @@ -335,7 +335,7 @@ public class TomcatEmbeddedServletContainerFactoryTests TomcatEmbeddedServletContainerFactoryTests.this.container.start(); fail(); } - catch (EmbeddedServletContainerException ex) { + catch (EmbeddedWebServerException ex) { // Ignore } } diff --git a/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java b/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java index 4b20f7da43..d8c310e298 100644 --- a/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/system/EmbeddedServerPortFileWriterTests.java @@ -27,9 +27,9 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; -import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; +import org.springframework.boot.context.embedded.EmbeddedWebServer; import org.springframework.util.FileCopyUtils; import org.springframework.util.StringUtils; @@ -120,7 +120,7 @@ public class EmbeddedServerPortFileWriterTests { private EmbeddedServletContainerInitializedEvent mockEvent(String name, int port) { EmbeddedWebApplicationContext applicationContext = mock( EmbeddedWebApplicationContext.class); - EmbeddedServletContainer source = mock(EmbeddedServletContainer.class); + EmbeddedWebServer source = mock(EmbeddedWebServer.class); given(applicationContext.getNamespace()).willReturn(name); given(source.getPort()).willReturn(port); EmbeddedServletContainerInitializedEvent event = new EmbeddedServletContainerInitializedEvent( diff --git a/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterIntegrationTests.java b/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterIntegrationTests.java index 0beb5d6163..417422e56b 100644 --- a/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterIntegrationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/web/support/ErrorPageFilterIntegrationTests.java @@ -93,7 +93,7 @@ public class ErrorPageFilterIntegrationTests { private void doTest(AnnotationConfigEmbeddedWebApplicationContext context, String resourcePath, HttpStatus status) throws Exception { - int port = context.getEmbeddedServletContainer().getPort(); + int port = context.getEmbeddedWebServer().getPort(); RestTemplate template = new RestTemplate(); ResponseEntity entity = template.getForEntity( new URI("http://localhost:" + port + resourcePath), String.class);