Просмотр исходного кода

web服务器启动时复制default.html到webServer目录

zhourui 5 лет назад
Родитель
Сommit
cbdbed4129

+ 14 - 3
o2server/x_console/src/main/java/com/x/server/console/server/web/WebServerTools.java

@@ -58,6 +58,10 @@ public class WebServerTools extends JettySeverTools {
 		 * 创建index.html
 		 */
 		createIndexPage();
+		/**
+		 * copyDefaultHtml
+		 */
+		copyDefaultHtml();
 
 		QueuedThreadPool threadPool = new QueuedThreadPool();
 		threadPool.setMinThreads(WEBSERVER_THREAD_POOL_SIZE_MIN);
@@ -112,6 +116,13 @@ public class WebServerTools extends JettySeverTools {
 		return server;
 	}
 
+	private static void copyDefaultHtml() throws Exception {
+		File file = new File(Config.dir_config(), "default.html");
+		if (file.exists() && file.isFile()) {
+			FileUtils.copyFile(file, new File(Config.base(), "servers/webServer/default.html"));
+		}
+	}
+
 	private static void updateFavicon() throws Exception {
 
 		File file = new File(Config.dir_config(), "favicon.ico");
@@ -189,11 +200,11 @@ public class WebServerTools extends JettySeverTools {
 			map.put("indexPage", Config.portal().getIndexPage());
 			map.put("webSocketEnable", Config.communicate().wsEnable());
 			map.put("urlMapping", Config.portal().getUrlMapping());
-			
+
 			/* 密码规则 */
-		    map.put("passwordRegex",Config.person().getPasswordRegex() );
+			map.put("passwordRegex", Config.person().getPasswordRegex());
 			map.put("passwordRegexHint", Config.person().getPasswordRegexHint());
-		
+
 			FileUtils.writeStringToFile(file, gson.toJson(map), DefaultCharset.charset);
 		}
 	}