Commit 8619d6a2 authored by Brian Clozel's avatar Brian Clozel

Rename EmbeddedServletContainer -> EmbeddedWebServer

This contract is not specific to servlet containers and should be
reused by all web server implementations (including reactive variants).

Fixes gh-8208
parent 457d0414
...@@ -148,7 +148,7 @@ public class EndpointWebMvcAutoConfiguration ...@@ -148,7 +148,7 @@ public class EndpointWebMvcAutoConfiguration
if (managementPort == ManagementServerPort.DIFFERENT) { if (managementPort == ManagementServerPort.DIFFERENT) {
if (this.applicationContext instanceof EmbeddedWebApplicationContext if (this.applicationContext instanceof EmbeddedWebApplicationContext
&& ((EmbeddedWebApplicationContext) this.applicationContext) && ((EmbeddedWebApplicationContext) this.applicationContext)
.getEmbeddedServletContainer() != null) { .getEmbeddedWebServer() != null) {
createChildManagementContext(); createChildManagementContext();
} }
else { else {
......
...@@ -44,9 +44,9 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura ...@@ -44,9 +44,9 @@ import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfigura
import org.springframework.boot.autoconfigure.web.ErrorAttributes; import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer; 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.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; 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.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
import org.springframework.boot.web.servlet.ErrorPage; import org.springframework.boot.web.servlet.ErrorPage;
...@@ -68,7 +68,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc; ...@@ -68,7 +68,7 @@ import org.springframework.web.servlet.config.annotation.EnableWebMvc;
/** /**
* Configuration triggered from {@link EndpointWebMvcAutoConfiguration} when a new * 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 Dave Syer
* @author Stephane Nicoll * @author Stephane Nicoll
......
...@@ -28,8 +28,8 @@ import org.apache.catalina.session.ManagerBase; ...@@ -28,8 +28,8 @@ import org.apache.catalina.session.ManagerBase;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.boot.actuate.metrics.Metric; 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.EmbeddedWebApplicationContext;
import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware; import org.springframework.context.ApplicationContextAware;
...@@ -58,10 +58,10 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa ...@@ -58,10 +58,10 @@ public class TomcatPublicMetrics implements PublicMetrics, ApplicationContextAwa
} }
private Manager getManager(EmbeddedWebApplicationContext applicationContext) { private Manager getManager(EmbeddedWebApplicationContext applicationContext) {
EmbeddedServletContainer embeddedServletContainer = applicationContext EmbeddedWebServer embeddedWebServer = applicationContext
.getEmbeddedServletContainer(); .getEmbeddedWebServer();
if (embeddedServletContainer instanceof TomcatEmbeddedServletContainer) { if (embeddedWebServer instanceof TomcatEmbeddedServletContainer) {
return getManager((TomcatEmbeddedServletContainer) embeddedServletContainer); return getManager((TomcatEmbeddedServletContainer) embeddedWebServer);
} }
return null; return null;
} }
......
...@@ -62,10 +62,10 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfi ...@@ -62,10 +62,10 @@ import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfi
import org.springframework.boot.autoconfigure.web.ServerProperties; import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration; import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; 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.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent; 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.ServerPortInfoApplicationContextInitializer;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
...@@ -351,7 +351,7 @@ public class EndpointWebMvcAutoConfigurationTests { ...@@ -351,7 +351,7 @@ public class EndpointWebMvcAutoConfigurationTests {
this.applicationContext.register(RootConfig.class, EndpointConfig.class, this.applicationContext.register(RootConfig.class, EndpointConfig.class,
BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class, BaseConfiguration.class, EndpointWebMvcAutoConfiguration.class,
ErrorMvcAutoConfiguration.class); ErrorMvcAutoConfiguration.class);
this.thrown.expect(EmbeddedServletContainerException.class); this.thrown.expect(EmbeddedWebServerException.class);
this.applicationContext.refresh(); this.applicationContext.refresh();
} }
finally { finally {
...@@ -887,7 +887,7 @@ public class EndpointWebMvcAutoConfigurationTests { ...@@ -887,7 +887,7 @@ public class EndpointWebMvcAutoConfigurationTests {
private ApplicationContext rootContext; private ApplicationContext rootContext;
private EmbeddedServletContainer servletContainer; private EmbeddedWebServer servletContainer;
GrabManagementPort(ApplicationContext rootContext) { GrabManagementPort(ApplicationContext rootContext) {
this.rootContext = rootContext; this.rootContext = rootContext;
...@@ -900,7 +900,7 @@ public class EndpointWebMvcAutoConfigurationTests { ...@@ -900,7 +900,7 @@ public class EndpointWebMvcAutoConfigurationTests {
} }
} }
public EmbeddedServletContainer getServletContainer() { public EmbeddedWebServer getServletContainer() {
return this.servletContainer; return this.servletContainer;
} }
......
...@@ -23,7 +23,7 @@ import org.junit.Rule; ...@@ -23,7 +23,7 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; 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.ExampleServlet;
import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
...@@ -66,7 +66,7 @@ public class SkipSslVerificationHttpRequestFactoryTests { ...@@ -66,7 +66,7 @@ public class SkipSslVerificationHttpRequestFactoryTests {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory( TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory(
0); 0);
factory.setSsl(getSsl("password", "classpath:test.jks")); factory.setSsl(getSsl("password", "classpath:test.jks"));
EmbeddedServletContainer container = factory.getEmbeddedServletContainer( EmbeddedWebServer container = factory.getEmbeddedServletContainer(
new ServletRegistrationBean(new ExampleServlet(), "/hello")); new ServletRegistrationBean(new ExampleServlet(), "/hello"));
container.start(); container.start();
return "https://localhost:" + container.getPort() + "/hello"; return "https://localhost:" + container.getPort() + "/hello";
......
...@@ -128,7 +128,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests { ...@@ -128,7 +128,7 @@ public class SpringApplicationAdminJmxAutoConfigurationTests {
assertThat(this.mBeanServer.getAttribute(createDefaultObjectName(), assertThat(this.mBeanServer.getAttribute(createDefaultObjectName(),
"EmbeddedWebApplication")).isEqualTo(Boolean.TRUE); "EmbeddedWebApplication")).isEqualTo(Boolean.TRUE);
int expected = ((EmbeddedWebApplicationContext) this.context) int expected = ((EmbeddedWebApplicationContext) this.context)
.getEmbeddedServletContainer().getPort(); .getEmbeddedWebServer().getPort();
String actual = getProperty(createDefaultObjectName(), "local.server.port"); String actual = getProperty(createDefaultObjectName(), "local.server.port");
assertThat(actual).isEqualTo(String.valueOf(expected)); assertThat(actual).isEqualTo(String.valueOf(expected));
} }
......
...@@ -64,7 +64,7 @@ public class MustacheAutoConfigurationIntegrationTests { ...@@ -64,7 +64,7 @@ public class MustacheAutoConfigurationIntegrationTests {
@Before @Before
public void init() { public void init() {
this.port = this.context.getEmbeddedServletContainer().getPort(); this.port = this.context.getEmbeddedWebServer().getPort();
} }
@Test @Test
......
...@@ -70,7 +70,7 @@ public class MustacheWebIntegrationTests { ...@@ -70,7 +70,7 @@ public class MustacheWebIntegrationTests {
@Before @Before
public void init() { public void init() {
this.port = this.context.getEmbeddedServletContainer().getPort(); this.port = this.context.getEmbeddedWebServer().getPort();
} }
@Test @Test
......
...@@ -64,7 +64,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests { ...@@ -64,7 +64,7 @@ public class SecurityFilterAutoConfigurationEarlyInitializationTests {
"security.user.password:password"); "security.user.password:password");
context.register(Config.class); context.register(Config.class);
context.refresh(); context.refresh();
int port = context.getEmbeddedServletContainer().getPort(); int port = context.getEmbeddedWebServer().getPort();
new TestRestTemplate("user", "password") new TestRestTemplate("user", "password")
.getForEntity("http://localhost:" + port, Object.class); .getForEntity("http://localhost:" + port, Object.class);
// If early initialization occurred a ConverterNotFoundException is thrown // If early initialization occurred a ConverterNotFoundException is thrown
......
...@@ -399,7 +399,7 @@ public class OAuth2AutoConfigurationTests { ...@@ -399,7 +399,7 @@ public class OAuth2AutoConfigurationTests {
private void verifyAuthentication(ClientDetails config, HttpStatus finalStatus) { private void verifyAuthentication(ClientDetails config, HttpStatus finalStatus) {
String baseUrl = "http://localhost:" String baseUrl = "http://localhost:"
+ this.context.getEmbeddedServletContainer().getPort(); + this.context.getEmbeddedWebServer().getPort();
TestRestTemplate rest = new TestRestTemplate(); TestRestTemplate rest = new TestRestTemplate();
// First, verify the web endpoint can't be reached // First, verify the web endpoint can't be reached
assertEndpointUnauthorized(baseUrl, rest); assertEndpointUnauthorized(baseUrl, rest);
......
...@@ -22,8 +22,8 @@ import javax.servlet.ServletContextListener; ...@@ -22,8 +22,8 @@ import javax.servlet.ServletContextListener;
import org.junit.Test; import org.junit.Test;
import org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext; 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.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
...@@ -36,7 +36,7 @@ import static org.mockito.Mockito.mock; ...@@ -36,7 +36,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify; 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 * correctly
* *
* @author Andy Wilkinson * @author Andy Wilkinson
......
...@@ -139,7 +139,7 @@ public class MultipartAutoConfigurationTests { ...@@ -139,7 +139,7 @@ public class MultipartAutoConfigurationTests {
this.context = new AnnotationConfigEmbeddedWebApplicationContext( this.context = new AnnotationConfigEmbeddedWebApplicationContext(
ContainerWithEverythingTomcat.class, BaseConfiguration.class); ContainerWithEverythingTomcat.class, BaseConfiguration.class);
new RestTemplate().getForObject("http://localhost:" new RestTemplate().getForObject("http://localhost:"
+ this.context.getEmbeddedServletContainer().getPort() + "/", + this.context.getEmbeddedWebServer().getPort() + "/",
String.class); String.class);
this.context.getBean(MultipartConfigElement.class); this.context.getBean(MultipartConfigElement.class);
assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs( assertThat(this.context.getBean(StandardServletMultipartResolver.class)).isSameAs(
...@@ -208,7 +208,7 @@ public class MultipartAutoConfigurationTests { ...@@ -208,7 +208,7 @@ public class MultipartAutoConfigurationTests {
HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory();
ClientHttpRequest request = requestFactory.createRequest( ClientHttpRequest request = requestFactory.createRequest(
new URI("http://localhost:" new URI("http://localhost:"
+ this.context.getEmbeddedServletContainer().getPort() + "/"), + this.context.getEmbeddedWebServer().getPort() + "/"),
HttpMethod.GET); HttpMethod.GET);
ClientHttpResponse response = request.execute(); ClientHttpResponse response = request.execute();
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND); assertThat(response.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
...@@ -217,7 +217,7 @@ public class MultipartAutoConfigurationTests { ...@@ -217,7 +217,7 @@ public class MultipartAutoConfigurationTests {
private void verifyServletWorks() { private void verifyServletWorks() {
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
String url = "http://localhost:" String url = "http://localhost:"
+ this.context.getEmbeddedServletContainer().getPort() + "/"; + this.context.getEmbeddedWebServer().getPort() + "/";
assertThat(restTemplate.getForObject(url, String.class)).isEqualTo("Hello"); assertThat(restTemplate.getForObject(url, String.class)).isEqualTo("Hello");
} }
......
...@@ -16,7 +16,7 @@ class Example implements CommandLineRunner { ...@@ -16,7 +16,7 @@ class Example implements CommandLineRunner {
} }
void run(String... args) { 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 def world = new RESTClient("http://localhost:" + port).get(path:"/").data.text
print "Hello " + world print "Hello " + world
} }
......
...@@ -246,7 +246,7 @@ public class LocalDevToolsAutoConfigurationTests { ...@@ -246,7 +246,7 @@ public class LocalDevToolsAutoConfigurationTests {
public void devToolsSwitchesJspServletToDevelopmentMode() { public void devToolsSwitchesJspServletToDevelopmentMode() {
this.context = initializeAndRun(Config.class); this.context = initializeAndRun(Config.class);
TomcatEmbeddedServletContainer tomcatContainer = (TomcatEmbeddedServletContainer) ((EmbeddedWebApplicationContext) this.context) TomcatEmbeddedServletContainer tomcatContainer = (TomcatEmbeddedServletContainer) ((EmbeddedWebApplicationContext) this.context)
.getEmbeddedServletContainer(); .getEmbeddedWebServer();
Container context = tomcatContainer.getTomcat().getHost().findChildren()[0]; Container context = tomcatContainer.getTomcat().getHost().findChildren()[0];
StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp"); StandardWrapper jspServletWrapper = (StandardWrapper) context.findChild("jsp");
EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils EmbeddedServletOptions options = (EmbeddedServletOptions) ReflectionTestUtils
......
...@@ -571,7 +571,7 @@ To scan for a free port (using OS natives to prevent clashes) use `server.port=0 ...@@ -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]] [[howto-discover-the-http-port-at-runtime]]
=== 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 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 that and be sure that it has initialized is to add a `@Bean` of type
`ApplicationListener<EmbeddedServletContainerInitializedEvent>` and pull the container `ApplicationListener<EmbeddedServletContainerInitializedEvent>` and pull the container
out of the event when it is published. out of the event when it is published.
......
...@@ -41,7 +41,7 @@ public class TomcatLegacyCookieProcessorExampleTests { ...@@ -41,7 +41,7 @@ public class TomcatLegacyCookieProcessorExampleTests {
EmbeddedWebApplicationContext applicationContext = (EmbeddedWebApplicationContext) new SpringApplication( EmbeddedWebApplicationContext applicationContext = (EmbeddedWebApplicationContext) new SpringApplication(
TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run(); TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run();
Context context = (Context) ((TomcatEmbeddedServletContainer) applicationContext Context context = (Context) ((TomcatEmbeddedServletContainer) applicationContext
.getEmbeddedServletContainer()).getTomcat().getHost().findChildren()[0]; .getEmbeddedWebServer()).getTomcat().getHost().findChildren()[0];
assertThat(context.getCookieProcessor()) assertThat(context.getCookieProcessor())
.isInstanceOf(LegacyCookieProcessor.class); .isInstanceOf(LegacyCookieProcessor.class);
} }
......
...@@ -90,7 +90,7 @@ public class SampleTomcatApplicationTests { ...@@ -90,7 +90,7 @@ public class SampleTomcatApplicationTests {
public void testTimeout() throws Exception { public void testTimeout() throws Exception {
EmbeddedWebApplicationContext context = (EmbeddedWebApplicationContext) this.applicationContext; EmbeddedWebApplicationContext context = (EmbeddedWebApplicationContext) this.applicationContext;
TomcatEmbeddedServletContainer embeddedServletContainer = (TomcatEmbeddedServletContainer) context TomcatEmbeddedServletContainer embeddedServletContainer = (TomcatEmbeddedServletContainer) context
.getEmbeddedServletContainer(); .getEmbeddedWebServer();
ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat() ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat()
.getConnector().getProtocolHandler(); .getConnector().getProtocolHandler();
int timeout = ((AbstractProtocol<?>) protocolHandler).getConnectionTimeout(); int timeout = ((AbstractProtocol<?>) protocolHandler).getConnectionTimeout();
......
...@@ -184,7 +184,7 @@ public abstract class AbstractEmbeddedServletContainerFactory ...@@ -184,7 +184,7 @@ public abstract class AbstractEmbeddedServletContainerFactory
return tempDir; return tempDir;
} }
catch (IOException ex) { catch (IOException ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to create tempDir. java.io.tmpdir is set to " "Unable to create tempDir. java.io.tmpdir is set to "
+ System.getProperty("java.io.tmpdir"), + System.getProperty("java.io.tmpdir"),
ex); ex);
......
...@@ -23,12 +23,12 @@ import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletCon ...@@ -23,12 +23,12 @@ import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletCon
import org.springframework.boot.web.servlet.ServletContextInitializer; 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 * Implementations are encouraged to extend
* {@link AbstractEmbeddedServletContainerFactory} when possible. * {@link AbstractEmbeddedServletContainerFactory} when possible.
* *
* @author Phillip Webb * @author Phillip Webb
* @see EmbeddedServletContainer * @see EmbeddedWebServer
* @see AbstractEmbeddedServletContainerFactory * @see AbstractEmbeddedServletContainerFactory
* @see JettyEmbeddedServletContainerFactory * @see JettyEmbeddedServletContainerFactory
* @see TomcatEmbeddedServletContainerFactory * @see TomcatEmbeddedServletContainerFactory
...@@ -37,16 +37,16 @@ import org.springframework.boot.web.servlet.ServletContextInitializer; ...@@ -37,16 +37,16 @@ import org.springframework.boot.web.servlet.ServletContextInitializer;
public interface EmbeddedServletContainerFactory { 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 * 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). * {@link ApplicationContext} has been fully refreshed).
* @param initializers {@link ServletContextInitializer}s that should be applied as * @param initializers {@link ServletContextInitializer}s that should be applied as
* the container starts * the container starts
* @return a fully configured and started {@link EmbeddedServletContainer} * @return a fully configured and started {@link EmbeddedWebServer}
* @see EmbeddedServletContainer#stop() * @see EmbeddedWebServer#stop()
*/ */
EmbeddedServletContainer getEmbeddedServletContainer( EmbeddedWebServer getEmbeddedServletContainer(
ServletContextInitializer... initializers); ServletContextInitializer... initializers);
} }
...@@ -20,7 +20,7 @@ import org.springframework.context.ApplicationEvent; ...@@ -20,7 +20,7 @@ import org.springframework.context.ApplicationEvent;
/** /**
* Event to be published after the context is refreshed and the * 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 * 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. * the server and stop and start it if they want to.
* *
...@@ -33,26 +33,26 @@ public class EmbeddedServletContainerInitializedEvent extends ApplicationEvent { ...@@ -33,26 +33,26 @@ public class EmbeddedServletContainerInitializedEvent extends ApplicationEvent {
public EmbeddedServletContainerInitializedEvent( public EmbeddedServletContainerInitializedEvent(
EmbeddedWebApplicationContext applicationContext, EmbeddedWebApplicationContext applicationContext,
EmbeddedServletContainer source) { EmbeddedWebServer source) {
super(source); super(source);
this.applicationContext = applicationContext; this.applicationContext = applicationContext;
} }
/** /**
* Access the {@link EmbeddedServletContainer}. * Access the {@link EmbeddedWebServer}.
* @return the embedded servlet container * @return the embedded servlet container
*/ */
public EmbeddedServletContainer getEmbeddedServletContainer() { public EmbeddedWebServer getEmbeddedServletContainer() {
return getSource(); 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 * @return the embedded servlet container
*/ */
@Override @Override
public EmbeddedServletContainer getSource() { public EmbeddedWebServer getSource() {
return (EmbeddedServletContainer) super.getSource(); return (EmbeddedWebServer) super.getSource();
} }
/** /**
......
...@@ -57,7 +57,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils; ...@@ -57,7 +57,7 @@ import org.springframework.web.context.support.WebApplicationContextUtils;
* A {@link WebApplicationContext} that can be used to bootstrap itself from a contained * A {@link WebApplicationContext} that can be used to bootstrap itself from a contained
* {@link EmbeddedServletContainerFactory} bean. * {@link EmbeddedServletContainerFactory} bean.
* <p> * <p>
* 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 * searching for a single {@link EmbeddedServletContainerFactory} bean within the
* {@link ApplicationContext} itself. The {@link EmbeddedServletContainerFactory} is free * {@link ApplicationContext} itself. The {@link EmbeddedServletContainerFactory} is free
* to use standard Spring concepts (such as dependency injection, lifecycle callbacks and * to use standard Spring concepts (such as dependency injection, lifecycle callbacks and
...@@ -99,7 +99,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext ...@@ -99,7 +99,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
*/ */
public static final String DISPATCHER_SERVLET_NAME = "dispatcherServlet"; public static final String DISPATCHER_SERVLET_NAME = "dispatcherServlet";
private volatile EmbeddedServletContainer embeddedServletContainer; private volatile EmbeddedWebServer embeddedWebServer;
private ServletConfig servletConfig; private ServletConfig servletConfig;
...@@ -142,7 +142,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext ...@@ -142,7 +142,7 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
@Override @Override
protected void finishRefresh() { protected void finishRefresh() {
super.finishRefresh(); super.finishRefresh();
EmbeddedServletContainer localContainer = startEmbeddedServletContainer(); EmbeddedWebServer localContainer = startEmbeddedServletContainer();
if (localContainer != null) { if (localContainer != null) {
publishEvent( publishEvent(
new EmbeddedServletContainerInitializedEvent(this, localContainer)); new EmbeddedServletContainerInitializedEvent(this, localContainer));
...@@ -156,11 +156,11 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext ...@@ -156,11 +156,11 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
} }
private void createEmbeddedServletContainer() { private void createEmbeddedServletContainer() {
EmbeddedServletContainer localContainer = this.embeddedServletContainer; EmbeddedWebServer localContainer = this.embeddedWebServer;
ServletContext localServletContext = getServletContext(); ServletContext localServletContext = getServletContext();
if (localContainer == null && localServletContext == null) { if (localContainer == null && localServletContext == null) {
EmbeddedServletContainerFactory containerFactory = getEmbeddedServletContainerFactory(); EmbeddedServletContainerFactory containerFactory = getEmbeddedServletContainerFactory();
this.embeddedServletContainer = containerFactory this.embeddedWebServer = containerFactory
.getEmbeddedServletContainer(getSelfInitializer()); .getEmbeddedServletContainer(getSelfInitializer());
} }
else if (localServletContext != null) { else if (localServletContext != null) {
...@@ -291,8 +291,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext ...@@ -291,8 +291,8 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
} }
} }
private EmbeddedServletContainer startEmbeddedServletContainer() { private EmbeddedWebServer startEmbeddedServletContainer() {
EmbeddedServletContainer localContainer = this.embeddedServletContainer; EmbeddedWebServer localContainer = this.embeddedWebServer;
if (localContainer != null) { if (localContainer != null) {
localContainer.start(); localContainer.start();
} }
...@@ -300,11 +300,11 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext ...@@ -300,11 +300,11 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext
} }
private void stopAndReleaseEmbeddedServletContainer() { private void stopAndReleaseEmbeddedServletContainer() {
EmbeddedServletContainer localContainer = this.embeddedServletContainer; EmbeddedWebServer localContainer = this.embeddedWebServer;
if (localContainer != null) { if (localContainer != null) {
try { try {
localContainer.stop(); localContainer.stop();
this.embeddedServletContainer = null; this.embeddedWebServer = null;
} }
catch (Exception ex) { catch (Exception ex) {
throw new IllegalStateException(ex); throw new IllegalStateException(ex);
...@@ -341,12 +341,12 @@ public class EmbeddedWebApplicationContext extends GenericWebApplicationContext ...@@ -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. * {@code null} if the container has not yet been created.
* @return the embedded servlet container * @return the embedded servlet container
*/ */
public EmbeddedServletContainer getEmbeddedServletContainer() { public EmbeddedWebServer getEmbeddedWebServer() {
return this.embeddedServletContainer; return this.embeddedWebServer;
} }
/** /**
......
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
package org.springframework.boot.context.embedded; package org.springframework.boot.context.embedded;
/** /**
* Simple interface that represents a fully configured embedded servlet container (for * Simple interface that represents a fully configured embedded web server (for
* example Tomcat or Jetty). Allows the container to be {@link #start() started} and * example Tomcat or Jetty). Allows the server to be {@link #start() started} and
* {@link #stop() stopped}. * {@link #stop() stopped}.
* <p> * <p>
* Instances of this class are usually obtained via a * Instances of this class are usually obtained via a
...@@ -28,21 +28,21 @@ package org.springframework.boot.context.embedded; ...@@ -28,21 +28,21 @@ package org.springframework.boot.context.embedded;
* @author Dave Syer * @author Dave Syer
* @see EmbeddedServletContainerFactory * @see EmbeddedServletContainerFactory
*/ */
public interface EmbeddedServletContainer { public interface EmbeddedWebServer {
/** /**
* Starts the embedded servlet container. Calling this method on an already started * Starts the embedded servlet container. Calling this method on an already started
* container has no effect. * 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 * Stops the embedded servlet container. Calling this method on an already stopped
* container has no effect. * 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. * Return the port this server is listening on.
......
...@@ -22,9 +22,9 @@ package org.springframework.boot.context.embedded; ...@@ -22,9 +22,9 @@ package org.springframework.boot.context.embedded;
* @author Phillip Webb * @author Phillip Webb
*/ */
@SuppressWarnings("serial") @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); super(message, cause);
} }
......
...@@ -23,7 +23,7 @@ package org.springframework.boot.context.embedded; ...@@ -23,7 +23,7 @@ package org.springframework.boot.context.embedded;
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.4.0 * @since 1.4.0
*/ */
public class PortInUseException extends EmbeddedServletContainerException { public class PortInUseException extends EmbeddedWebServerException {
private final int port; private final int port;
......
...@@ -33,7 +33,7 @@ import org.springframework.util.StringUtils; ...@@ -33,7 +33,7 @@ import org.springframework.util.StringUtils;
/** /**
* {@link ApplicationContextInitializer} that sets {@link Environment} properties for the * {@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 * property {@literal "local.server.port"} can be injected directly into tests using
* {@link Value @Value} or obtained via the {@link Environment}. * {@link Value @Value} or obtained via the {@link Environment}.
* <p> * <p>
......
...@@ -19,7 +19,7 @@ package org.springframework.boot.context.embedded; ...@@ -19,7 +19,7 @@ package org.springframework.boot.context.embedded;
import java.security.KeyStore; 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. * be used when file based key stores cannot be used.
* *
* @author Phillip Webb * @author Phillip Webb
......
...@@ -28,15 +28,15 @@ import org.eclipse.jetty.server.Server; ...@@ -28,15 +28,15 @@ import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.HandlerWrapper; import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedWebServerException;
import org.springframework.boot.context.embedded.PortInUseException; import org.springframework.boot.context.embedded.PortInUseException;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils; import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils; 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 * Usually this class should be created using the
* {@link JettyEmbeddedServletContainerFactory} and not directly. * {@link JettyEmbeddedServletContainerFactory} and not directly.
* *
...@@ -46,7 +46,7 @@ import org.springframework.util.StringUtils; ...@@ -46,7 +46,7 @@ import org.springframework.util.StringUtils;
* @author Eddú Meléndez * @author Eddú Meléndez
* @see JettyEmbeddedServletContainerFactory * @see JettyEmbeddedServletContainerFactory
*/ */
public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { public class JettyEmbeddedServletContainer implements EmbeddedWebServer {
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(JettyEmbeddedServletContainer.class); .getLog(JettyEmbeddedServletContainer.class);
...@@ -96,7 +96,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { ...@@ -96,7 +96,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
catch (Exception ex) { catch (Exception ex) {
// Ensure process isn't left running // Ensure process isn't left running
stopSilently(); stopSilently();
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to start embedded Jetty servlet container", ex); "Unable to start embedded Jetty servlet container", ex);
} }
} }
...@@ -112,7 +112,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { ...@@ -112,7 +112,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
} }
@Override @Override
public void start() throws EmbeddedServletContainerException { public void start() throws EmbeddedWebServerException {
synchronized (this.monitor) { synchronized (this.monitor) {
if (this.started) { if (this.started) {
return; return;
...@@ -143,11 +143,11 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { ...@@ -143,11 +143,11 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
JettyEmbeddedServletContainer.logger JettyEmbeddedServletContainer.logger
.info("Jetty started on port(s) " + getActualPortsDescription()); .info("Jetty started on port(s) " + getActualPortsDescription());
} }
catch (EmbeddedServletContainerException ex) { catch (EmbeddedWebServerException ex) {
throw ex; throw ex;
} }
catch (Exception ex) { catch (Exception ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to start embedded Jetty servlet container", ex); "Unable to start embedded Jetty servlet container", ex);
} }
} }
...@@ -216,7 +216,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer { ...@@ -216,7 +216,7 @@ public class JettyEmbeddedServletContainer implements EmbeddedServletContainer {
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} }
catch (Exception ex) { catch (Exception ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to stop embedded Jetty servlet container", ex); "Unable to stop embedded Jetty servlet container", ex);
} }
} }
......
...@@ -65,9 +65,9 @@ import org.eclipse.jetty.webapp.WebAppContext; ...@@ -65,9 +65,9 @@ import org.eclipse.jetty.webapp.WebAppContext;
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.Compression; 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.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.MimeMappings;
import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl;
import org.springframework.boot.context.embedded.Ssl.ClientAuth; import org.springframework.boot.context.embedded.Ssl.ClientAuth;
...@@ -149,7 +149,7 @@ public class JettyEmbeddedServletContainerFactory ...@@ -149,7 +149,7 @@ public class JettyEmbeddedServletContainerFactory
} }
@Override @Override
public EmbeddedServletContainer getEmbeddedServletContainer( public EmbeddedWebServer getEmbeddedServletContainer(
ServletContextInitializer... initializers) { ServletContextInitializer... initializers) {
JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext(); JettyEmbeddedWebAppContext context = new JettyEmbeddedWebAppContext();
int port = (getPort() >= 0 ? getPort() : 0); int port = (getPort() >= 0 ? getPort() : 0);
...@@ -291,7 +291,7 @@ public class JettyEmbeddedServletContainerFactory ...@@ -291,7 +291,7 @@ public class JettyEmbeddedServletContainerFactory
factory.setKeyStoreResource(Resource.newResource(url)); factory.setKeyStoreResource(Resource.newResource(url));
} }
catch (IOException ex) { catch (IOException ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Could not find key store '" + ssl.getKeyStore() + "'", ex); "Could not find key store '" + ssl.getKeyStore() + "'", ex);
} }
if (ssl.getKeyStoreType() != null) { if (ssl.getKeyStoreType() != null) {
...@@ -312,7 +312,7 @@ public class JettyEmbeddedServletContainerFactory ...@@ -312,7 +312,7 @@ public class JettyEmbeddedServletContainerFactory
factory.setTrustStoreResource(Resource.newResource(url)); factory.setTrustStoreResource(Resource.newResource(url));
} }
catch (IOException ex) { catch (IOException ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Could not find trust store '" + ssl.getTrustStore() + "'", ex); "Could not find trust store '" + ssl.getTrustStore() + "'", ex);
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/** /**
* Support for Jetty * Support for Jetty
* {@link org.springframework.boot.context.embedded.EmbeddedServletContainer * {@link org.springframework.boot.context.embedded.EmbeddedWebServer
* EmbeddedServletContainers}. * EmbeddedServletContainers}.
* *
* @see org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory * @see org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory
......
...@@ -18,7 +18,7 @@ package org.springframework.boot.context.embedded.tomcat; ...@@ -18,7 +18,7 @@ package org.springframework.boot.context.embedded.tomcat;
import org.apache.catalina.connector.Connector; 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 * A {@code ConnectorStartFailedException} is thrown when a Tomcat {@link Connector} fails
...@@ -27,7 +27,7 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerExcepti ...@@ -27,7 +27,7 @@ import org.springframework.boot.context.embedded.EmbeddedServletContainerExcepti
* @author Andy Wilkinson * @author Andy Wilkinson
* @since 1.4.1 * @since 1.4.1
*/ */
public class ConnectorStartFailedException extends EmbeddedServletContainerException { public class ConnectorStartFailedException extends EmbeddedWebServerException {
private final int port; private final int port;
......
...@@ -34,12 +34,12 @@ import org.apache.commons.logging.Log; ...@@ -34,12 +34,12 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.naming.ContextBindings; import org.apache.naming.ContextBindings;
import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedWebServerException;
import org.springframework.util.Assert; 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 * Usually this class should be created using the
* {@link TomcatEmbeddedServletContainerFactory} and not directly. * {@link TomcatEmbeddedServletContainerFactory} and not directly.
* *
...@@ -47,7 +47,7 @@ import org.springframework.util.Assert; ...@@ -47,7 +47,7 @@ import org.springframework.util.Assert;
* @author Dave Syer * @author Dave Syer
* @see TomcatEmbeddedServletContainerFactory * @see TomcatEmbeddedServletContainerFactory
*/ */
public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer { public class TomcatEmbeddedServletContainer implements EmbeddedWebServer {
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(TomcatEmbeddedServletContainer.class); .getLog(TomcatEmbeddedServletContainer.class);
...@@ -84,7 +84,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -84,7 +84,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
initialize(); initialize();
} }
private void initialize() throws EmbeddedServletContainerException { private void initialize() throws EmbeddedWebServerException {
TomcatEmbeddedServletContainer.logger TomcatEmbeddedServletContainer.logger
.info("Tomcat initialized with port(s): " + getPortsDescription(false)); .info("Tomcat initialized with port(s): " + getPortsDescription(false));
synchronized (this.monitor) { synchronized (this.monitor) {
...@@ -114,7 +114,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -114,7 +114,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
startDaemonAwaitThread(); startDaemonAwaitThread();
} }
catch (Exception ex) { catch (Exception ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to start embedded Tomcat", ex); "Unable to start embedded Tomcat", ex);
} }
} }
...@@ -175,7 +175,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -175,7 +175,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
} }
@Override @Override
public void start() throws EmbeddedServletContainerException { public void start() throws EmbeddedWebServerException {
synchronized (this.monitor) { synchronized (this.monitor) {
if (this.started) { if (this.started) {
return; return;
...@@ -196,7 +196,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -196,7 +196,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
throw ex; throw ex;
} }
catch (Exception ex) { catch (Exception ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to start embedded Tomcat servlet container", ex); "Unable to start embedded Tomcat servlet container", ex);
} }
finally { finally {
...@@ -267,7 +267,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -267,7 +267,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
} }
catch (Exception ex) { catch (Exception ex) {
TomcatEmbeddedServletContainer.logger.error("Cannot start connector: ", ex); TomcatEmbeddedServletContainer.logger.error("Cannot start connector: ", ex);
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to start embedded Tomcat connectors", ex); "Unable to start embedded Tomcat connectors", ex);
} }
} }
...@@ -277,7 +277,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -277,7 +277,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
} }
@Override @Override
public void stop() throws EmbeddedServletContainerException { public void stop() throws EmbeddedWebServerException {
synchronized (this.monitor) { synchronized (this.monitor) {
if (!this.started) { if (!this.started) {
return; return;
...@@ -293,7 +293,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer ...@@ -293,7 +293,7 @@ public class TomcatEmbeddedServletContainer implements EmbeddedServletContainer
} }
} }
catch (Exception ex) { catch (Exception ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to stop embedded Tomcat", ex); "Unable to stop embedded Tomcat", ex);
} }
finally { finally {
......
...@@ -57,9 +57,9 @@ import org.apache.tomcat.util.net.SSLHostConfig; ...@@ -57,9 +57,9 @@ import org.apache.tomcat.util.net.SSLHostConfig;
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.Compression; 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.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.MimeMappings;
import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl;
import org.springframework.boot.context.embedded.Ssl.ClientAuth; import org.springframework.boot.context.embedded.Ssl.ClientAuth;
...@@ -156,7 +156,7 @@ public class TomcatEmbeddedServletContainerFactory ...@@ -156,7 +156,7 @@ public class TomcatEmbeddedServletContainerFactory
} }
@Override @Override
public EmbeddedServletContainer getEmbeddedServletContainer( public EmbeddedWebServer getEmbeddedServletContainer(
ServletContextInitializer... initializers) { ServletContextInitializer... initializers) {
Tomcat tomcat = new Tomcat(); Tomcat tomcat = new Tomcat();
File baseDir = (this.baseDirectory != null ? this.baseDirectory File baseDir = (this.baseDirectory != null ? this.baseDirectory
...@@ -414,7 +414,7 @@ public class TomcatEmbeddedServletContainerFactory ...@@ -414,7 +414,7 @@ public class TomcatEmbeddedServletContainerFactory
protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString()); protocol.setKeystoreFile(ResourceUtils.getURL(ssl.getKeyStore()).toString());
} }
catch (FileNotFoundException ex) { catch (FileNotFoundException ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Could not load key store: " + ex.getMessage(), ex); "Could not load key store: " + ex.getMessage(), ex);
} }
if (ssl.getKeyStoreType() != null) { if (ssl.getKeyStoreType() != null) {
...@@ -433,7 +433,7 @@ public class TomcatEmbeddedServletContainerFactory ...@@ -433,7 +433,7 @@ public class TomcatEmbeddedServletContainerFactory
ResourceUtils.getURL(ssl.getTrustStore()).toString()); ResourceUtils.getURL(ssl.getTrustStore()).toString());
} }
catch (FileNotFoundException ex) { catch (FileNotFoundException ex) {
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Could not load trust store: " + ex.getMessage(), ex); "Could not load trust store: " + ex.getMessage(), ex);
} }
} }
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/** /**
* Support for Tomcat * Support for Tomcat
* {@link org.springframework.boot.context.embedded.EmbeddedServletContainer * {@link org.springframework.boot.context.embedded.EmbeddedWebServer
* EmbeddedServletContainers}. * EmbeddedServletContainers}.
* *
* @see org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory * @see org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory
......
...@@ -44,8 +44,8 @@ import org.apache.commons.logging.LogFactory; ...@@ -44,8 +44,8 @@ import org.apache.commons.logging.LogFactory;
import org.xnio.channels.BoundChannel; import org.xnio.channels.BoundChannel;
import org.springframework.boot.context.embedded.Compression; import org.springframework.boot.context.embedded.Compression;
import org.springframework.boot.context.embedded.EmbeddedServletContainer; import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerException; import org.springframework.boot.context.embedded.EmbeddedWebServerException;
import org.springframework.boot.context.embedded.PortInUseException; import org.springframework.boot.context.embedded.PortInUseException;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.util.MimeType; import org.springframework.util.MimeType;
...@@ -54,7 +54,7 @@ import org.springframework.util.ReflectionUtils; ...@@ -54,7 +54,7 @@ import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils; 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 * server. Typically this class should be created using
* {@link UndertowEmbeddedServletContainerFactory} and not directly. * {@link UndertowEmbeddedServletContainerFactory} and not directly.
* *
...@@ -65,7 +65,7 @@ import org.springframework.util.StringUtils; ...@@ -65,7 +65,7 @@ import org.springframework.util.StringUtils;
* @since 1.2.0 * @since 1.2.0
* @see UndertowEmbeddedServletContainerFactory * @see UndertowEmbeddedServletContainerFactory
*/ */
public class UndertowEmbeddedServletContainer implements EmbeddedServletContainer { public class UndertowEmbeddedServletContainer implements EmbeddedWebServer {
private static final Log logger = LogFactory private static final Log logger = LogFactory
.getLog(UndertowEmbeddedServletContainer.class); .getLog(UndertowEmbeddedServletContainer.class);
...@@ -142,7 +142,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine ...@@ -142,7 +142,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
} }
@Override @Override
public void start() throws EmbeddedServletContainerException { public void start() throws EmbeddedWebServerException {
synchronized (this.monitor) { synchronized (this.monitor) {
if (this.started) { if (this.started) {
return; return;
...@@ -169,7 +169,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine ...@@ -169,7 +169,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
failedPorts.iterator().next().getNumber()); failedPorts.iterator().next().getNumber());
} }
} }
throw new EmbeddedServletContainerException( throw new EmbeddedWebServerException(
"Unable to start embedded Undertow", ex); "Unable to start embedded Undertow", ex);
} }
} }
...@@ -306,7 +306,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine ...@@ -306,7 +306,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
} }
@Override @Override
public void stop() throws EmbeddedServletContainerException { public void stop() throws EmbeddedWebServerException {
synchronized (this.monitor) { synchronized (this.monitor) {
if (!this.started) { if (!this.started) {
return; return;
...@@ -317,7 +317,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine ...@@ -317,7 +317,7 @@ public class UndertowEmbeddedServletContainer implements EmbeddedServletContaine
this.undertow.stop(); this.undertow.stop();
} }
catch (Exception ex) { catch (Exception ex) {
throw new EmbeddedServletContainerException("Unable to stop undertow", throw new EmbeddedWebServerException("Unable to stop undertow",
ex); ex);
} }
} }
......
...@@ -67,8 +67,8 @@ import org.xnio.Xnio; ...@@ -67,8 +67,8 @@ import org.xnio.Xnio;
import org.xnio.XnioWorker; import org.xnio.XnioWorker;
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; 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.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.boot.context.embedded.MimeMappings.Mapping; import org.springframework.boot.context.embedded.MimeMappings.Mapping;
import org.springframework.boot.context.embedded.Ssl; import org.springframework.boot.context.embedded.Ssl;
import org.springframework.boot.context.embedded.Ssl.ClientAuth; import org.springframework.boot.context.embedded.Ssl.ClientAuth;
...@@ -219,7 +219,7 @@ public class UndertowEmbeddedServletContainerFactory ...@@ -219,7 +219,7 @@ public class UndertowEmbeddedServletContainerFactory
} }
@Override @Override
public EmbeddedServletContainer getEmbeddedServletContainer( public EmbeddedWebServer getEmbeddedServletContainer(
ServletContextInitializer... initializers) { ServletContextInitializer... initializers) {
DeploymentManager manager = createDeploymentManager(initializers); DeploymentManager manager = createDeploymentManager(initializers);
int port = getPort(); int port = getPort();
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/** /**
* Support for Undertow * Support for Undertow
* {@link org.springframework.boot.context.embedded.EmbeddedServletContainer * {@link org.springframework.boot.context.embedded.EmbeddedWebServer
* EmbeddedServletContainers}. * EmbeddedServletContainers}.
* *
* @see org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory * @see org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory
......
...@@ -128,7 +128,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests { ...@@ -128,7 +128,7 @@ public abstract class AbstractEmbeddedServletContainerFactoryTests {
@Rule @Rule
public InternalOutputCapture output = new InternalOutputCapture(); public InternalOutputCapture output = new InternalOutputCapture();
protected EmbeddedServletContainer container; protected EmbeddedWebServer container;
private final HttpClientContext httpClientContext = HttpClientContext.create(); private final HttpClientContext httpClientContext = HttpClientContext.create();
......
...@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -46,7 +46,7 @@ import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Integration tests for {@link EmbeddedWebApplicationContext} and * Integration tests for {@link EmbeddedWebApplicationContext} and
* {@link EmbeddedServletContainer}s running Spring MVC. * {@link EmbeddedWebServer}s running Spring MVC.
* *
* @author Phillip Webb * @author Phillip Webb
* @author Ivan Sopov * @author Ivan Sopov
...@@ -98,7 +98,7 @@ public class EmbeddedServletContainerMvcIntegrationTests { ...@@ -98,7 +98,7 @@ public class EmbeddedServletContainerMvcIntegrationTests {
SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory(); SimpleClientHttpRequestFactory clientHttpRequestFactory = new SimpleClientHttpRequestFactory();
ClientHttpRequest request = clientHttpRequestFactory.createRequest( ClientHttpRequest request = clientHttpRequestFactory.createRequest(
new URI("http://localhost:" new URI("http://localhost:"
+ context.getEmbeddedServletContainer().getPort() + resourcePath), + context.getEmbeddedWebServer().getPort() + resourcePath),
HttpMethod.GET); HttpMethod.GET);
ClientHttpResponse response = request.execute(); ClientHttpResponse response = request.execute();
try { try {
......
...@@ -55,7 +55,7 @@ public class MockEmbeddedServletContainerFactory ...@@ -55,7 +55,7 @@ public class MockEmbeddedServletContainerFactory
private MockEmbeddedServletContainer container; private MockEmbeddedServletContainer container;
@Override @Override
public EmbeddedServletContainer getEmbeddedServletContainer( public EmbeddedWebServer getEmbeddedServletContainer(
ServletContextInitializer... initializers) { ServletContextInitializer... initializers) {
this.container = spy(new MockEmbeddedServletContainer( this.container = spy(new MockEmbeddedServletContainer(
mergeInitializers(initializers), getPort())); mergeInitializers(initializers), getPort()));
...@@ -80,7 +80,7 @@ public class MockEmbeddedServletContainerFactory ...@@ -80,7 +80,7 @@ public class MockEmbeddedServletContainerFactory
: getContainer().getRegisteredFilters().get(index); : getContainer().getRegisteredFilters().get(index);
} }
public static class MockEmbeddedServletContainer implements EmbeddedServletContainer { public static class MockEmbeddedServletContainer implements EmbeddedWebServer {
private ServletContext servletContext; private ServletContext servletContext;
...@@ -167,7 +167,7 @@ public class MockEmbeddedServletContainerFactory ...@@ -167,7 +167,7 @@ public class MockEmbeddedServletContainerFactory
} }
@Override @Override
public void start() throws EmbeddedServletContainerException { public void start() throws EmbeddedWebServerException {
} }
@Override @Override
......
...@@ -50,7 +50,7 @@ import org.mockito.InOrder; ...@@ -50,7 +50,7 @@ import org.mockito.InOrder;
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory; import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.AbstractEmbeddedServletContainerFactoryTests; 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.context.embedded.Ssl;
import org.springframework.boot.testutil.InternalOutputCapture; import org.springframework.boot.testutil.InternalOutputCapture;
import org.springframework.test.util.ReflectionTestUtils; import org.springframework.test.util.ReflectionTestUtils;
...@@ -335,7 +335,7 @@ public class TomcatEmbeddedServletContainerFactoryTests ...@@ -335,7 +335,7 @@ public class TomcatEmbeddedServletContainerFactoryTests
TomcatEmbeddedServletContainerFactoryTests.this.container.start(); TomcatEmbeddedServletContainerFactoryTests.this.container.start();
fail(); fail();
} }
catch (EmbeddedServletContainerException ex) { catch (EmbeddedWebServerException ex) {
// Ignore // Ignore
} }
} }
......
...@@ -27,9 +27,9 @@ import org.junit.Rule; ...@@ -27,9 +27,9 @@ import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TemporaryFolder; 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.EmbeddedServletContainerInitializedEvent;
import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext; import org.springframework.boot.context.embedded.EmbeddedWebApplicationContext;
import org.springframework.boot.context.embedded.EmbeddedWebServer;
import org.springframework.util.FileCopyUtils; import org.springframework.util.FileCopyUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -120,7 +120,7 @@ public class EmbeddedServerPortFileWriterTests { ...@@ -120,7 +120,7 @@ public class EmbeddedServerPortFileWriterTests {
private EmbeddedServletContainerInitializedEvent mockEvent(String name, int port) { private EmbeddedServletContainerInitializedEvent mockEvent(String name, int port) {
EmbeddedWebApplicationContext applicationContext = mock( EmbeddedWebApplicationContext applicationContext = mock(
EmbeddedWebApplicationContext.class); EmbeddedWebApplicationContext.class);
EmbeddedServletContainer source = mock(EmbeddedServletContainer.class); EmbeddedWebServer source = mock(EmbeddedWebServer.class);
given(applicationContext.getNamespace()).willReturn(name); given(applicationContext.getNamespace()).willReturn(name);
given(source.getPort()).willReturn(port); given(source.getPort()).willReturn(port);
EmbeddedServletContainerInitializedEvent event = new EmbeddedServletContainerInitializedEvent( EmbeddedServletContainerInitializedEvent event = new EmbeddedServletContainerInitializedEvent(
......
...@@ -93,7 +93,7 @@ public class ErrorPageFilterIntegrationTests { ...@@ -93,7 +93,7 @@ public class ErrorPageFilterIntegrationTests {
private void doTest(AnnotationConfigEmbeddedWebApplicationContext context, private void doTest(AnnotationConfigEmbeddedWebApplicationContext context,
String resourcePath, HttpStatus status) throws Exception { String resourcePath, HttpStatus status) throws Exception {
int port = context.getEmbeddedServletContainer().getPort(); int port = context.getEmbeddedWebServer().getPort();
RestTemplate template = new RestTemplate(); RestTemplate template = new RestTemplate();
ResponseEntity<String> entity = template.getForEntity( ResponseEntity<String> entity = template.getForEntity(
new URI("http://localhost:" + port + resourcePath), String.class); new URI("http://localhost:" + port + resourcePath), String.class);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment