diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/Container.java b/servlet-core/src/main/java/tech/smartboot/servlet/Container.java
index 7dac0db4..e2636bb5 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/Container.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/Container.java
@@ -142,7 +142,7 @@ public void handleRequest(HandlerContext handlerContext) {
private void loadAndInstallPlugins() {
plugins.add(new Plugin() {
@Override
- public void onContainerStopped(ServletContextRuntime containerRuntime) {
+ public void onServletContextStopped(ServletContextRuntime containerRuntime) {
LOGGER.info("remove servletContextRuntime:{} from runtimes", containerRuntime.getContextPath());
runtimes.remove(containerRuntime);
}
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/ServletContextRuntime.java b/servlet-core/src/main/java/tech/smartboot/servlet/ServletContextRuntime.java
index 81c27ea5..d288f881 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/ServletContextRuntime.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/ServletContextRuntime.java
@@ -141,7 +141,7 @@ public void start() throws Throwable {
try {
//有些场景下ServletContainerInitializer初始化依赖当前容器的类加载器
Thread.currentThread().setContextClassLoader(deploymentInfo.getClassLoader());
- plugins.forEach(plugin -> plugin.willStartContainer(this));
+ plugins.forEach(plugin -> plugin.willStartServletContext(this));
DeploymentInfo deploymentInfo = servletContext.getDeploymentInfo();
@@ -166,10 +166,10 @@ public void start() throws Throwable {
initFilter(deploymentInfo);
started = true;
deploymentInfo.amazing();
- plugins.forEach(plugin -> plugin.onContainerStartSuccess(this));
+ plugins.forEach(plugin -> plugin.onServletContextStartSuccess(this));
} catch (Exception e) {
e.printStackTrace();
- plugins.forEach(plugin -> plugin.whenContainerStartError(this, e));
+ plugins.forEach(plugin -> plugin.whenServletContextStartError(this, e));
throw e;
} finally {
Thread.currentThread().setContextClassLoader(currentClassLoader);
@@ -320,12 +320,12 @@ private void initFilter(DeploymentInfo deploymentInfo) throws Exception {
}
public void stop() {
- plugins.forEach(plugin -> plugin.willStopContainer(this));
+ plugins.forEach(plugin -> plugin.willStopServletContext(this));
deploymentInfo.getServlets().values().stream().filter(ServletInfo::initialized).forEach(servletInfo -> servletInfo.getServlet().destroy());
ServletContextEvent event = deploymentInfo.getServletContextListeners().isEmpty() ? null : new ServletContextEvent(servletContext);
deploymentInfo.getServletContextListeners().forEach(servletContextListener -> servletContextListener.getListener().contextDestroyed(event));
- plugins.forEach(plugin -> plugin.onContainerStopped(this));
+ plugins.forEach(plugin -> plugin.onServletContextStopped(this));
}
public DispatcherProvider getDispatcherProvider() {
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/Plugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/Plugin.java
index 6f1927e4..d9c83bf1 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/Plugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/Plugin.java
@@ -71,9 +71,9 @@ public void addServletContext(ServletContextRuntime runtime) {
/**
* servlet容器被启动成功之后被调用
*
- * @param servletContextRuntime 当前启动成功的子容器
+ * @param runtime 当前启动成功的子容器
*/
- public void onContainerStartSuccess(ServletContextRuntime servletContextRuntime) {
+ public void onServletContextStartSuccess(ServletContextRuntime runtime) {
// LOGGER.info("plugin:[" + pluginName() + "] do nothing for container: " + servletContextRuntime.getContextPath() + " when start success!");
}
@@ -81,36 +81,36 @@ public void onContainerStartSuccess(ServletContextRuntime servletContextRuntime)
/**
* servlet子容器启动前被调用
*
- * @param containerRuntime 当前即将被启动的子容器
+ * @param runtime 当前即将被启动的子容器
*/
- public void willStartContainer(ServletContextRuntime containerRuntime) {
+ public void willStartServletContext(ServletContextRuntime runtime) {
// LOGGER.info("plugin:[" + pluginName() + "] do nothing for container: " + containerRuntime.getContextPath() + " before start!");
}
/**
* servlet子容器启动失败时被调用
*
- * @param containerRuntime 当前启动失败的子容器
+ * @param runtime 当前启动失败的子容器
*/
- public void whenContainerStartError(ServletContextRuntime containerRuntime, Throwable throwable) {
+ public void whenServletContextStartError(ServletContextRuntime runtime, Throwable throwable) {
// LOGGER.info("plugin:[" + pluginName() + "] do nothing for container: " + containerRuntime.getContextPath() + " when start error!");
}
/**
* 即将消耗子容器
*
- * @param containerRuntime 即将被消耗的子容器
+ * @param runtime 即将被消耗的子容器
*/
- public void willStopContainer(ServletContextRuntime containerRuntime) {
+ public void willStopServletContext(ServletContextRuntime runtime) {
// LOGGER.info("plugin:[" + pluginName() + "]do nothing for container: " + containerRuntime.getContextPath() + " before stop!");
}
/**
* 子容器已销毁
*
- * @param containerRuntime 当前被消耗的子容器
+ * @param runtime 当前被消耗的子容器
*/
- public void onContainerStopped(ServletContextRuntime containerRuntime) {
+ public void onServletContextStopped(ServletContextRuntime runtime) {
// LOGGER.info("plugin:[" + pluginName() + "] do nothing for container: " + containerRuntime.getContextPath() + " when stop!");
}
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/contact/ContactPlugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/contact/ContactPlugin.java
index eb4351f2..10c34b6d 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/contact/ContactPlugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/contact/ContactPlugin.java
@@ -19,7 +19,7 @@
public class ContactPlugin extends Plugin {
@Override
- public void onContainerStartSuccess(ServletContextRuntime servletContextRuntime) {
+ public void onServletContextStartSuccess(ServletContextRuntime servletContextRuntime) {
System.out.println();
System.out.println("\033[1mTechnical Support:\033[0m");
System.out.println(" · Document: https://smartboot.tech]");
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/dispatcher/DispatcherPlugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/dispatcher/DispatcherPlugin.java
index 1e03249f..4a45c054 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/dispatcher/DispatcherPlugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/dispatcher/DispatcherPlugin.java
@@ -20,7 +20,7 @@
public class DispatcherPlugin extends Plugin {
@Override
- public void willStartContainer(ServletContextRuntime containerRuntime) {
+ public void willStartServletContext(ServletContextRuntime containerRuntime) {
containerRuntime.setDispatcherProvider(new DispatcherProviderImpl());
}
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/license/LicensePlugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/license/LicensePlugin.java
index 4faae07e..83fa3d07 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/license/LicensePlugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/license/LicensePlugin.java
@@ -93,7 +93,7 @@ public void addServletContext(ServletContextRuntime runtime) {
}
@Override
- public void willStartContainer(ServletContextRuntime containerRuntime) {
+ public void willStartServletContext(ServletContextRuntime containerRuntime) {
containerRuntime.setFaviconProvider(runtime -> {
});
}
@@ -121,7 +121,7 @@ private void loadLicense() {
licenseTO = loadLicense(entity);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
System.out.println(":: Licensed to " + ConsoleColors.BOLD + ConsoleColors.ANSI_UNDERLINE_ON + ConsoleColors.BLUE + licenseTO.getApplicant() + ConsoleColors.ANSI_RESET + " until " + ConsoleColors.BOLD + ConsoleColors.ANSI_UNDERLINE_ON + ConsoleColors.BLUE + sdf.format(new Date(licenseTO.getExpireTime())) + ConsoleColors.ANSI_RESET);
- System.out.println(":: SN: " + ConsoleColors.BOLD + ConsoleColors.ANSI_UNDERLINE_ON + licenseTO.getSn() + ConsoleColors.RESET);
+ System.out.println(":: License ID: " + ConsoleColors.BOLD + ConsoleColors.ANSI_UNDERLINE_ON + licenseTO.getSn() + ConsoleColors.RESET);
System.out.println(":: Copyright© " + licenseTO.getVendor() + " ,E-mail: " + licenseTO.getContact());
if (licenseTO.getTrialDuration() > 0) {
System.out.println(ConsoleColors.RED + ":: Trial: " + licenseTO.getTrialDuration() + " minutes" + ConsoleColors.RESET);
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/mapping/MappingPlugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/mapping/MappingPlugin.java
index 32cbdb13..f5183d14 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/mapping/MappingPlugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/mapping/MappingPlugin.java
@@ -15,7 +15,7 @@
public class MappingPlugin extends Plugin {
@Override
- public void onContainerStartSuccess(ServletContextRuntime servletContextRuntime) {
+ public void onServletContextStartSuccess(ServletContextRuntime servletContextRuntime) {
MappingProviderImpl provider = new MappingProviderImpl(servletContextRuntime.getServletContext().getContextPath().length());
servletContextRuntime.setMappingProvider(provider);
servletContextRuntime.getDeploymentInfo().getServletMappings().forEach(mapping -> {
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/session/SessionPlugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/session/SessionPlugin.java
index 5f62ca6d..71e9c499 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/session/SessionPlugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/session/SessionPlugin.java
@@ -26,7 +26,7 @@ public void initPlugin(Container container) {
}
@Override
- public void willStartContainer(ServletContextRuntime containerRuntime) {
+ public void willStartServletContext(ServletContextRuntime containerRuntime) {
SessionProviderImpl sessionProvider = new SessionProviderImpl();
sessionProvider.setMaxInactiveInterval(containerRuntime.getDeploymentInfo().getSessionTimeout());
containerRuntime.setSessionProvider(sessionProvider);
diff --git a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketPlugin.java b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketPlugin.java
index 865f0f36..40fcbade 100644
--- a/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketPlugin.java
+++ b/servlet-core/src/main/java/tech/smartboot/servlet/plugins/websocket/WebsocketPlugin.java
@@ -28,7 +28,7 @@ public class WebsocketPlugin extends Plugin {
@Override
- public void willStartContainer(ServletContextRuntime containerRuntime) {
+ public void willStartServletContext(ServletContextRuntime containerRuntime) {
containerRuntime.setWebsocketProvider(new WebsocketProviderImpl());
containerRuntime.getServletContext().setAttribute(ServerContainer.class.getName(), containerRuntime.getWebsocketProvider().getWebSocketServerContainer());
diff --git a/springboot-demo/pom.xml b/springboot-demo/pom.xml
index 0889af97..94debf36 100644
--- a/springboot-demo/pom.xml
+++ b/springboot-demo/pom.xml
@@ -63,11 +63,11 @@
2.2
-
- org.springframework.boot
- spring-boot-starter-undertow
- 3.3.1
-
+
+
+
+
+