package com.cn.hnust.controller;import java.util.ArrayList;import java.util.Collections;import java.util.Comparator;import java.util.HashMap;import java.util.List;import java.util.Map;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestBody;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.ResponseBody;import com.alibaba.fastjson.JSONArray;import com.alibaba.fastjson.JSONObject;@Controller@RequestMapping("/json")public class JsonController { //设置数据源 @RequestMapping() @ResponseBody public Map list(HttpServletRequest request,HttpServletResponse response) { response.setHeader("Access-Control-Allow-Headers", "accept, content-type"); response.setHeader("Access-Control-Allow-Methods", "POST"); response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Accept", "application/json"); response.setHeader("Content-Type", "application/json"); response.setHeader("Authorization", "Bearer eyJrIjoidGFIOW41aHRoMXZ5aTkxcDBNYUxteDk3TU9zVUhoSkUiLCJuIjoiZ3JhZmFuYV90ZXN0IiwiaWQiOjF9"); Map map = new HashMap (); map.put("result", "200 ok"); return map; } //设置参数 @RequestMapping("/search") @ResponseBody public List search(HttpServletRequest request,HttpServletResponse response) { response.setHeader("Access-Control-Allow-Headers", "accept, content-type"); response.setHeader("Access-Control-Allow-Methods", "POST"); response.setHeader("Access-Control-Allow-Origin", "*"); response.setHeader("Accept", "application/json"); response.setHeader("Content-Type", "application/json"); response.setHeader("Authorization", "Bearer eyJrIjoidGFIOW41aHRoMXZ5aTkxcDBNYUxteDk3TU9zVUhoSkUiLCJuIjoiZ3JhZmFuYV90ZXN0IiwiaWQiOjF9"); List result = new ArrayList (); result.add("CPU"); result.add("RAM"); result.add("LOAD"); result.add("SWAP"); result.add("DISK"); result.add("NET"); return result; } //查询 @RequestMapping("/query") @ResponseBody public List query(@RequestBody Map params, HttpServletRequest request,HttpServletResponse response) { List