GrayNginxSwitchCtrl.java 1.4 KB
package com.ui.ctrl;

import com.ui.http.HttpRestClient;
import com.ui.model.BaseResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.Map;

/**
 * 灰度的nginx切换
 *
 * @author craig.qin 2018-1-10
 */
@Controller
@RequestMapping("/grayNginxSwitch")
public class GrayNginxSwitchCtrl {

    @Autowired
    HttpRestClient httpRestClient;

    @RequestMapping(value = "/toGrayNginxSwitch")
    public ModelAndView toGrayNginxSwitch() {
        ModelAndView mdv = new ModelAndView("switch/switch_nginx_gray");
        return mdv;
    }

    /**
     * 展示配置文件信息
     *
     */
    @RequestMapping(value = "/viewGrayNginxCurrentConf")
    @ResponseBody
    public BaseResponse viewGrayNginxCurrentConf() {
        return  httpRestClient.defaultGet( "/grayNginxSwitch/viewGrayNginxCurrentConf", BaseResponse.class, null);
    }

    /**
     * 解析当前配置,绘图用
     *
     */
    @RequestMapping(value = "/getGrayNginxStatus")
    @ResponseBody
    public BaseResponse getGrayNginxStatus() {
        return  httpRestClient.defaultGet( "/grayNginxSwitch/getGrayNginxStatus", BaseResponse.class, null);
    }




}