Merge branch '1.5.x'
This commit is contained in:
commit
a1ba2de06b
|
@ -27,6 +27,7 @@ import javax.naming.NamingException;
|
||||||
import org.apache.catalina.Container;
|
import org.apache.catalina.Container;
|
||||||
import org.apache.catalina.Context;
|
import org.apache.catalina.Context;
|
||||||
import org.apache.catalina.Engine;
|
import org.apache.catalina.Engine;
|
||||||
|
import org.apache.catalina.Lifecycle;
|
||||||
import org.apache.catalina.LifecycleException;
|
import org.apache.catalina.LifecycleException;
|
||||||
import org.apache.catalina.LifecycleState;
|
import org.apache.catalina.LifecycleState;
|
||||||
import org.apache.catalina.Service;
|
import org.apache.catalina.Service;
|
||||||
|
@ -92,8 +93,15 @@ public class TomcatWebServer implements WebServer {
|
||||||
try {
|
try {
|
||||||
addInstanceIdToEngineName();
|
addInstanceIdToEngineName();
|
||||||
|
|
||||||
// Remove service connectors so that protocol binding doesn't happen yet
|
Context context = findContext();
|
||||||
removeServiceConnectors();
|
context.addLifecycleListener((event) -> {
|
||||||
|
if (context.equals(event.getSource())
|
||||||
|
&& Lifecycle.START_EVENT.equals(event.getType())) {
|
||||||
|
// Remove service connectors so that protocol binding doesn't
|
||||||
|
// happen when the service is started.
|
||||||
|
removeServiceConnectors();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Start the server to trigger initialization listeners
|
// Start the server to trigger initialization listeners
|
||||||
this.tomcat.start();
|
this.tomcat.start();
|
||||||
|
@ -101,7 +109,6 @@ public class TomcatWebServer implements WebServer {
|
||||||
// We can re-throw failure exception directly in the main thread
|
// We can re-throw failure exception directly in the main thread
|
||||||
rethrowDeferredStartupExceptions();
|
rethrowDeferredStartupExceptions();
|
||||||
|
|
||||||
Context context = findContext();
|
|
||||||
try {
|
try {
|
||||||
ContextBindings.bindClassLoader(context, context.getNamingToken(),
|
ContextBindings.bindClassLoader(context, context.getNamingToken(),
|
||||||
getClass().getClassLoader());
|
getClass().getClassLoader());
|
||||||
|
|
|
@ -801,6 +801,21 @@ public abstract class AbstractServletWebServerFactoryTests {
|
||||||
assertThat(sessionCookieConfig.getMaxAge()).isEqualTo(60);
|
assertThat(sessionCookieConfig.getMaxAge()).isEqualTo(60);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void sslSessionTracking() {
|
||||||
|
AbstractServletWebServerFactory factory = getFactory();
|
||||||
|
Ssl ssl = new Ssl();
|
||||||
|
ssl.setEnabled(true);
|
||||||
|
ssl.setKeyStore("src/test/resources/test.jks");
|
||||||
|
ssl.setKeyPassword("password");
|
||||||
|
factory.setSsl(ssl);
|
||||||
|
factory.getSession().setTrackingModes(EnumSet.of(SessionTrackingMode.SSL));
|
||||||
|
AtomicReference<ServletContext> contextReference = new AtomicReference<>();
|
||||||
|
this.webServer = factory.getWebServer(contextReference::set);
|
||||||
|
assertThat(contextReference.get().getEffectiveSessionTrackingModes())
|
||||||
|
.isEqualTo(EnumSet.of(javax.servlet.SessionTrackingMode.SSL));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void compressionOfResponseToGetRequest() throws Exception {
|
public void compressionOfResponseToGetRequest() throws Exception {
|
||||||
assertThat(doTestCompression(10000, null, null)).isTrue();
|
assertThat(doTestCompression(10000, null, null)).isTrue();
|
||||||
|
|
Loading…
Reference in New Issue