|
@@ -0,0 +1,60 @@
|
|
|
|
+package edu.nju.controller;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
|
+import org.springframework.stereotype.Controller;
|
|
|
|
+import org.springframework.web.bind.annotation.CrossOrigin;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
|
+import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.PrintWriter;
|
|
|
|
+
|
|
|
|
+@Controller
|
|
|
|
+@RequestMapping(value = "/setting")
|
|
|
|
+@CrossOrigin(origins = "*", maxAge = 3600, allowCredentials = "true")
|
|
|
|
+public class SettingController {
|
|
|
|
+
|
|
|
|
+ @Value("${thirdPartTool.mainsite.host}")
|
|
|
|
+ private String mainSiteHost;
|
|
|
|
+ @Value("${thirdPartTool.mainsite.port}")
|
|
|
|
+ private String mainSitePort;
|
|
|
|
+ @Value("${thirdPartTool.mainsite.path}")
|
|
|
|
+ private String mainSitePath;
|
|
|
|
+ @Value("${this.server.ip}")
|
|
|
|
+ private String serverHost;
|
|
|
|
+ @Value("${this.server.port}")
|
|
|
|
+ private String serverPort;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/mainsite", method = RequestMethod.GET)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public void getMainSitePath(HttpServletResponse response) {
|
|
|
|
+ try {
|
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
|
+ out.print(mainSiteHost+":"+mainSitePort+mainSitePath);
|
|
|
|
+ out.flush();
|
|
|
|
+ out.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @RequestMapping(value = "/crowdtest", method = RequestMethod.GET)
|
|
|
|
+ @ResponseBody
|
|
|
|
+ public void getCrowdtestUrl(HttpServletResponse response) {
|
|
|
|
+ try {
|
|
|
|
+ PrintWriter out = response.getWriter();
|
|
|
|
+ out.print(serverHost+":"+serverPort);
|
|
|
|
+ out.flush();
|
|
|
|
+ out.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ // TODO Auto-generated catch block
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|