|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2021 the original author or authors.
|
|
|
|
* Copyright 2012-2022 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -124,7 +124,9 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
|
|
|
|
|
|
|
|
|
|
|
private List<Valve> contextValves = new ArrayList<>();
|
|
|
|
private List<Valve> contextValves = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
private List<LifecycleListener> contextLifecycleListeners = getDefaultLifecycleListeners();
|
|
|
|
private List<LifecycleListener> contextLifecycleListeners = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<LifecycleListener> serverLifecycleListeners = getDefaultServerLifecycleListeners();
|
|
|
|
|
|
|
|
|
|
|
|
private Set<TomcatContextCustomizer> tomcatContextCustomizers = new LinkedHashSet<>();
|
|
|
|
private Set<TomcatContextCustomizer> tomcatContextCustomizers = new LinkedHashSet<>();
|
|
|
|
|
|
|
|
|
|
|
@ -173,7 +175,7 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
|
|
|
super(contextPath, port);
|
|
|
|
super(contextPath, port);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static List<LifecycleListener> getDefaultLifecycleListeners() {
|
|
|
|
private static List<LifecycleListener> getDefaultServerLifecycleListeners() {
|
|
|
|
ArrayList<LifecycleListener> lifecycleListeners = new ArrayList<>();
|
|
|
|
ArrayList<LifecycleListener> lifecycleListeners = new ArrayList<>();
|
|
|
|
if (!NativeDetector.inNativeImage()) {
|
|
|
|
if (!NativeDetector.inNativeImage()) {
|
|
|
|
AprLifecycleListener aprLifecycleListener = new AprLifecycleListener();
|
|
|
|
AprLifecycleListener aprLifecycleListener = new AprLifecycleListener();
|
|
|
@ -192,6 +194,9 @@ public class TomcatServletWebServerFactory extends AbstractServletWebServerFacto
|
|
|
|
Tomcat tomcat = new Tomcat();
|
|
|
|
Tomcat tomcat = new Tomcat();
|
|
|
|
File baseDir = (this.baseDirectory != null) ? this.baseDirectory : createTempDir("tomcat");
|
|
|
|
File baseDir = (this.baseDirectory != null) ? this.baseDirectory : createTempDir("tomcat");
|
|
|
|
tomcat.setBaseDir(baseDir.getAbsolutePath());
|
|
|
|
tomcat.setBaseDir(baseDir.getAbsolutePath());
|
|
|
|
|
|
|
|
for (LifecycleListener listener : this.serverLifecycleListeners) {
|
|
|
|
|
|
|
|
tomcat.getServer().addLifecycleListener(listener);
|
|
|
|
|
|
|
|
}
|
|
|
|
Connector connector = new Connector(this.protocol);
|
|
|
|
Connector connector = new Connector(this.protocol);
|
|
|
|
connector.setThrowOnFailure(true);
|
|
|
|
connector.setThrowOnFailure(true);
|
|
|
|
tomcat.getService().addConnector(connector);
|
|
|
|
tomcat.getService().addConnector(connector);
|
|
|
|