Merge branch '1.5.x' into 2.0.x

pull/13211/head
Andy Wilkinson 7 years ago
commit 73e525a280

@ -304,6 +304,7 @@ public class UndertowServletWebServer implements WebServer {
this.started = false; this.started = false;
try { try {
this.manager.stop(); this.manager.stop();
this.manager.undeploy();
this.undertow.stop(); this.undertow.stop();
} }
catch (Exception ex) { catch (Exception ex) {

@ -55,6 +55,8 @@ import javax.servlet.FilterChain;
import javax.servlet.FilterConfig; import javax.servlet.FilterConfig;
import javax.servlet.GenericServlet; import javax.servlet.GenericServlet;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.ServletException; import javax.servlet.ServletException;
import javax.servlet.ServletRequest; import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse; import javax.servlet.ServletResponse;
@ -1038,6 +1040,17 @@ public abstract class AbstractServletWebServerFactoryTests {
assertThat(servletContext.getSessionCookieConfig().getMaxAge()).isEqualTo(60); assertThat(servletContext.getSessionCookieConfig().getMaxAge()).isEqualTo(60);
} }
@Test
public void servletContextListenerContextDestroyedIsCalledWhenContainerIsStopped()
throws Exception {
ServletContextListener listener = mock(ServletContextListener.class);
this.webServer = getFactory()
.getWebServer((servletContext) -> servletContext.addListener(listener));
this.webServer.start();
this.webServer.stop();
verify(listener).contextDestroyed(any(ServletContextEvent.class));
}
protected abstract void addConnector(int port, protected abstract void addConnector(int port,
AbstractServletWebServerFactory factory); AbstractServletWebServerFactory factory);

Loading…
Cancel
Save