#
luxiaotao1123
2020-11-19 f1750b606591a364aa59904628c7395c0c4ea71b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.zy.common.web;
 
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
 
import javax.servlet.http.HttpServletResponse;
 
/**
 * Created by vincent on 2019-07-30
 */
@Controller
public class RouterController {
 
    @Value("${server.servlet.context-path}")
    private String contextPath;
 
    @RequestMapping("/")
    public void index(HttpServletResponse response) {
        try{
            response.sendRedirect(contextPath+"/views/index.html");
        } catch (Exception ex){
            ex.printStackTrace();
        }
    }
 
    @RequestMapping("/login")
    public void login(HttpServletResponse response) {
        try{
            response.sendRedirect(contextPath+"/views/login.html");
        } catch (Exception ex){
            ex.printStackTrace();
        }
    }
 
    @RequestMapping("/control")
    public void control(HttpServletResponse response) {
        try{
            response.sendRedirect(contextPath+"/views/control.html");
        } catch (Exception ex){
            ex.printStackTrace();
        }
    }
 
    @RequestMapping("/monitor/{cnrId}")
    public void monitor(@PathVariable("cnrId") Integer cnrId,
                        HttpServletResponse response) {
        try{
            String append = cnrId==null?"":("?crnId="+cnrId);
            response.sendRedirect(contextPath+"/views/monitor/monitor.html"+append);
        } catch (Exception ex){
            ex.printStackTrace();
        }
    }
 
}