下面列出了org.springframework.http.MediaType#TEXT_HTML_VALUE 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@RequestMapping(value = "list.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.LIST)
public String list(String group) {
List<NodeModel> nodeModels = nodeService.list();
//
if (nodeModels != null && StrUtil.isNotEmpty(group)) {
// 筛选
List<NodeModel> filterList = nodeModels.stream().filter(nodeModel -> StrUtil.equals(group, nodeModel.getGroup())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(filterList)) {
// 如果传入的分组找到了节点,就返回 否则返回全部
nodeModels = filterList;
}
}
setAttribute("array", nodeModels);
// 获取所有的ssh 名称
JSONObject sshName = new JSONObject();
List<SshModel> sshModels = sshService.list();
if (sshModels != null) {
sshModels.forEach(sshModel -> sshName.put(sshModel.getId(), sshModel.getName()));
}
setAttribute("sshName", sshName);
// group
HashSet<String> allGroup = nodeService.getAllGroup();
setAttribute("groups", allGroup);
return "node/list";
}
@RequestMapping(value = "terminal.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.TERMINAL)
public String terminal(String id) {
SshModel sshModel = sshService.getItem(id);
setAttribute("item", sshModel);
return "node/ssh/terminal";
}
@GetMapping(
value = "/",
produces = MediaType.TEXT_HTML_VALUE
)
public String getHtml(@RequestHeader("User-Agent") String userAgentString) {
return doHTML(userAgentString);
}
/**
* 保存Tomcat信息
*
* @param id tomcat的id,如果id非空则更新,如果id是空则保存
* @return 操作结果
*/
@RequestMapping(value = "save", method = RequestMethod.POST, produces = MediaType.TEXT_HTML_VALUE)
@ResponseBody
@OptLog(UserOperateLogV1.OptType.Save_Tomcat)
@Feature(method = MethodFeature.EDIT)
public String save(String id) {
NodeModel nodeModel = getNode();
if (StrUtil.isEmpty(id)) {
return tomcatService.addTomcat(nodeModel, getRequest());
} else {
// 修改Tomcat信息
return tomcatService.updateTomcat(nodeModel, getRequest());
}
}
/**
* 展示监控页面
*
* @return page
*/
@RequestMapping(value = "log.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.LOG)
public String list() {
// 所有节点
List<NodeModel> nodeModels = nodeService.list();
setAttribute("nodeArray", nodeModels);
//通知方式
JSONArray notifyTypeArray = BaseEnum.toJSONArray(MonitorModel.NotifyType.class);
setAttribute("notifyTypeArray", notifyTypeArray);
return "monitor/loglist";
}
/**
* 登录页面
*
* @return login
*/
@RequestMapping(value = "login.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@NotLogin
public String login() {
if (userService.userListEmpty()) {
// 调整到初始化也
return BaseJpomInterceptor.getRedirect(getRequest(), "/install.html");
}
// 是否显示验证码
setAttribute("showCode", showCode());
return "login";
}
/**
* 查询文件列表
*
* @return 文件列表
*/
@RequestMapping(value = "getFileList", method = RequestMethod.POST, produces = MediaType.TEXT_HTML_VALUE)
@ResponseBody
@Feature(method = MethodFeature.FILE)
public String getFileList() {
return tomcatService.getFileList(getNode(), getRequest());
}
/**
* 删除tomcat
*
* @return 操作结果
*/
@RequestMapping(value = "delete", method = RequestMethod.POST, produces = MediaType.TEXT_HTML_VALUE)
@ResponseBody
@OptLog(UserOperateLogV1.OptType.Del_Tomcat)
@Feature(method = MethodFeature.DEL)
public String delete() {
return tomcatService.delete(getNode(), getRequest());
}
@RequestMapping(value = "item.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.EDIT)
public String setting(String type) {
List<String> ngxDirectory = whitelistDirectoryService.getNgxDirectory(getNode());
setAttribute("nginx", ngxDirectory);
setAttribute("type", type);
JSONObject data = NodeForward.requestData(getNode(), NodeUrl.System_Nginx_item_data, getRequest(), JSONObject.class);
setAttribute("data", data);
return "node/system/nginxSetting";
}
/**
* 修改监控
*
* @param id id
* @return json
*/
@RequestMapping(value = "edit.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.EDIT)
public String edit(String id) {
MonitorModel monitorModel = null;
if (StrUtil.isNotEmpty(id)) {
monitorModel = monitorService.getItem(id);
}
setAttribute("model", monitorModel);
//监控周期
JSONArray cycleArray = Cycle.getJSONArray();
setAttribute("cycleArray", cycleArray);
List<NodeModel> nodeModels = nodeService.listAndProject();
setAttribute("nodeModels", nodeModels);
//
List<UserModel> list = userService.list(false);
JSONArray jsonArray = new JSONArray();
list.forEach(userModel -> {
JSONObject jsonObject = new JSONObject();
jsonObject.put("title", userModel.getName());
jsonObject.put("value", userModel.getId());
if (StrUtil.isEmpty(userModel.getEmail()) && StrUtil.isEmpty(userModel.getDingDing())) {
jsonObject.put("disabled", true);
}
jsonArray.add(jsonObject);
});
setAttribute("userLists", jsonArray);
return "monitor/edit";
}
/**
* tomcat 日志管理
*
* @param id tomcat id
* @return 项目管理面
*/
@RequestMapping(value = "console", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.LOG)
public String console(String id) {
setAttribute("id", id);
return "node/tomcat/console";
}
@RequestMapping(value = "dynamicData.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.EDIT)
public String list() {
Map<ClassFeature, DynamicData> dynamicDataMap = DynamicData.getDynamicDataMap();
setAttribute("dynamicDataMap", dynamicDataMap);
return "user/role/dynamicData";
}
@RequestMapping(value = "/{id}.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView Item(@PathVariable("id") long id) {
return new ModelAndView("item", "item", itemRepository.findById(id).get());
}
@RequestMapping(produces = MediaType.TEXT_HTML_VALUE)
@ResponseBody
public String invokeHtml() {
return "<h1 style=\"color:red\">" + getDelegate().invoke() + "</h1>";
}
@RequestMapping(value = "/{id}.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView Item(@PathVariable("id") long id) {
return new ModelAndView("item", "item", itemRepository.findById(id).get());
}
@RequestMapping(value = "/searchForm.html", produces = MediaType.TEXT_HTML_VALUE)
public ModelAndView searchForm() {
return new ModelAndView("searchForm");
}
@ApiOperation(value = "Show shop mail template preview")
@Secured({"ROLE_SMADMIN","ROLE_SMSHOPADMIN","ROLE_SMSHOPUSER","ROLE_SMSUBSHOPUSER"})
@RequestMapping(value = "/shops/{shopId}/mail/{template}/preview", method = RequestMethod.GET, produces = { MediaType.TEXT_HTML_VALUE, MediaType.TEXT_PLAIN_VALUE })
@ResponseBody
ResponseEntity<String> getShopMail(@ApiParam(value = "Shop ID", required = true) @PathVariable("shopId") long shopId, @ApiParam(value = "Mail template code", required = true) @PathVariable("template") String template, @ApiParam(value = "Order details to use") @RequestParam(value = "order", required = false) String order, @ApiParam(value = "Order delivery details to use") @RequestParam(value = "delivery", required = false) String delivery, @ApiParam(value = "Customer details to use") @RequestParam(value = "customer", required = false) String customer, @ApiParam(value = "Format to generate email", allowableValues = "html,txt") @RequestParam(value = "format", required = false, defaultValue = "html") String format) throws Exception;
@GetMapping(path = "/", produces = MediaType.TEXT_HTML_VALUE)
public String index() {
return "index";
}
@GetMapping(path = "/{username}/vehicle.html", produces = MediaType.TEXT_HTML_VALUE)
public String VehicleDetailsHtml(@PathVariable String username) {
VehicleDetails details = this.userVehicleService.getVehicleDetails(username);
String makeAndModel = details.getMake() + " " + details.getModel();
return "<html><body><h1>" + makeAndModel + "</h1></body></html>";
}
@RequestMapping(value = "list.html", method = RequestMethod.GET, produces = MediaType.TEXT_HTML_VALUE)
@Feature(method = MethodFeature.LIST)
public String list() {
return "user/role/list";
}