소스 검색

visit root path tip

MaxKey 2 년 전
부모
커밋
03a8ae6f04

+ 4 - 37
maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java

@@ -1,5 +1,5 @@
 /*
- * Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
+ * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,19 +17,9 @@
 
 package org.maxkey.web.contorller;
 
-import java.io.IOException;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.maxkey.configuration.ApplicationConfig;
-import org.maxkey.entity.Institutions;
-import org.maxkey.web.WebConstants;
 import org.maxkey.web.WebContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.servlet.ModelAndView;
@@ -42,35 +32,12 @@ import org.springframework.web.servlet.ModelAndView;
 @Controller
 public class IndexEndpoint {
 	private static Logger _logger = LoggerFactory.getLogger(IndexEndpoint.class);
-	
-	@Autowired
-  	ApplicationConfig applicationConfig;
-	
-	@RequestMapping(value={"/forwardindex"})
-	public ModelAndView forwardindex(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException {
-		_logger.debug("IndexEndpoint /forwardindex.");
-		Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST);
-        String defaultUri = inst.getDefaultUri();
-        if (defaultUri != null && !defaultUri.equals("")) {
-            _logger.debug("defaultUri " + defaultUri);
-            return WebContext.redirect(defaultUri);
-        }
-        _logger.debug("Uri /appList");
-		return  new ModelAndView("/appList");
-	}
-	
-	@RequestMapping(value={"/index"})
-	public ModelAndView home(HttpServletRequest request,
-            HttpServletResponse response) throws ServletException, IOException {
-		_logger.debug("home /index.");
-		return  new ModelAndView("index");
-	}
-	
+
 	@RequestMapping(value={"/"})
 	public ModelAndView index() {
 		_logger.debug("IndexEndpoint /.");
-		return  new ModelAndView("index");
+		return  new ModelAndView("index")
+				.addObject("appVersion", WebContext.properties.getProperty("application.formatted-version"));
 		
 	}
 	

+ 21 - 0
maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html >
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <link rel="shortcut icon" type="image/x-icon" href="<@base />/static/favicon.ico"/>
+    <base href="<@base />"/>
+    <title>MaxKey Single Sign-On</title>
+</head>
+<body>
+    <center>
+        <hr>
+        Maxkey Community  Edition <br>
+        Single   Sign  On ( SSO ) <br>
+        Version ${appVersion}<br>
+        <br>
+        ©Copyright 2018 - ${.now?string["yyyy"]} https://www.maxkey.top/<br>
+        Licensed under the Apache License, Version 2.0 <br>
+        <hr>
+    </center>
+</body>
+</html>

+ 44 - 0
maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java

@@ -0,0 +1,44 @@
+/*
+ * Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ 
+
+package org.maxkey.web.contorller;
+
+import org.maxkey.web.WebContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+/**
+ * Index
+ * @author Crystal.Sea
+ *
+ */
+@Controller
+public class IndexEndpoint {
+	private static Logger _logger = LoggerFactory.getLogger(IndexEndpoint.class);
+
+	@RequestMapping(value={"/"})
+	public ModelAndView index() {
+		_logger.debug("IndexEndpoint /.");
+		return  new ModelAndView("index")
+				.addObject("appVersion", WebContext.properties.getProperty("application.formatted-version"));
+		
+	}
+	
+}

+ 12 - 0
maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties

@@ -206,6 +206,18 @@ maxkey.swagger.title                            =MaxKey\u5355\u70b9\u767b\u5f55\
 maxkey.swagger.description                      =MaxKey\u5355\u70b9\u767b\u5f55\u8ba4\u8bc1\u7cfb\u7edfAPI\u6587\u6863
 maxkey.swagger.version                          =${application.formatted-version}
 
+############################################################################
+#freemarker configuration                                                  #
+############################################################################
+spring.freemarker.template-loader-path          =classpath:/templates/views
+spring.freemarker.cache                         =false
+spring.freemarker.charset                       =UTF-8
+spring.freemarker.check-template-location       =true
+spring.freemarker.content-type                  =text/html
+spring.freemarker.expose-request-attributes     =false
+spring.freemarker.expose-session-attributes     =false
+spring.freemarker.request-context-attribute     =request
+spring.freemarker.suffix                        =.ftl
 
 ############################################################################
 #static resources configuration                                            #

BIN
maxkey-webs/maxkey-web-mgt/src/main/resources/static/favicon.ico


+ 21 - 0
maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl

@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html >
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+    <link rel="shortcut icon" type="image/x-icon" href="<@base />/static/favicon.ico"/>
+    <base href="<@base />"/>
+    <title>MaxKey Single Sign-On</title>
+</head>
+<body>
+    <center>
+        <hr>
+        Maxkey Community  Edition <br>
+        Single   Sign  On ( SSO ) <br>
+        Version ${appVersion}<br>
+        <br>
+        ©Copyright 2018 - ${.now?string["yyyy"]} https://www.maxkey.top/<br>
+        Licensed under the Apache License, Version 2.0 <br>
+        <hr>
+    </center>
+</body>
+</html>