网站HTTP配置增加区域ip配置信息处理。

This commit is contained in:
zhangwei
2018-05-28 15:47:33 +08:00
parent 317e3ae048
commit da189660d8
6 changed files with 164 additions and 18 deletions

View File

@@ -59,46 +59,88 @@ public class WebsiteController extends BaseController{
public String httpForm(Model model,String ids,CfgIndexInfo entity) {
if(StringUtils.isNotBlank(ids)){
entity = websiteCfgService.getHttpCfg(Long.parseLong(ids));
//设置http各类配置的配置域类型
IpPortCfg ipCfg = new IpPortCfg();
ipCfg.setCfgType(Constants.HTTP_IP_REGION);
entity.setIpPort(ipCfg);
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
entity.setHttpUrl(urlCfg);
HttpReqHeadCfg reqHdrCfg = new HttpReqHeadCfg();
reqHdrCfg.setCfgType(Constants.HTTP_REQ_HEAD_REGION);
entity.setHttpReqHdr(reqHdrCfg);
HttpResHeadCfg resHdrCfg = new HttpResHeadCfg();
resHdrCfg.setCfgType(Constants.HTTP_RES_HEAD_REGION);
entity.setHttpResHdr(resHdrCfg);
HttpBodyCfg reqBodyCfg = new HttpBodyCfg();
reqBodyCfg.setCfgType(Constants.HTTP_REQ_BODY_REGION);
entity.setHttpReqBody(reqBodyCfg);
HttpBodyCfg resBodyCfg = new HttpBodyCfg();
resBodyCfg.setCfgType(Constants.HTTP_RES_BODY_REGION);
entity.setHttpResBody(resBodyCfg);
if(entity.getIpPortList().size()==0){
entity.getIpPortList().add(new IpPortCfg());
entity.getIpPortList().add(ipCfg);
}
if(entity.getHttpUrlList().size()==0){
entity.getHttpUrlList().add(new HttpUrlCfg());
entity.getHttpUrlList().add(urlCfg);
}
if(entity.getHttpReqHdrList().size()==0){
entity.getHttpReqHdrList().add(new HttpReqHeadCfg());
entity.getHttpReqHdrList().add(reqHdrCfg);
}
if(entity.getHttpResHdrList().size()==0){
entity.getHttpResHdrList().add(new HttpResHeadCfg());
entity.getHttpResHdrList().add(resHdrCfg);
}
if(entity.getHttpReqBodyList().size()==0){
entity.getHttpReqBodyList().add(new HttpBodyCfg());
entity.getHttpReqBodyList().add(reqBodyCfg);
}
if(entity.getHttpResBodyList().size()==0){
entity.getHttpResBodyList().add(new HttpBodyCfg());
entity.getHttpResBodyList().add(resBodyCfg);
}
model.addAttribute("areaCfgs", entity.getAreaCfg());
}else{
//设置http各类配置的配置域类型
IpPortCfg ipCfg = new IpPortCfg();
ipCfg.setCfgType(Constants.HTTP_IP_REGION);
entity.setIpPort(ipCfg);
HttpUrlCfg urlCfg = new HttpUrlCfg();
urlCfg.setCfgType(Constants.HTTP_URL_REGION);
entity.setHttpUrl(urlCfg);
HttpReqHeadCfg reqHdrCfg = new HttpReqHeadCfg();
reqHdrCfg.setCfgType(Constants.HTTP_REQ_HEAD_REGION);
entity.setHttpReqHdr(reqHdrCfg);
HttpResHeadCfg resHdrCfg = new HttpResHeadCfg();
resHdrCfg.setCfgType(Constants.HTTP_RES_HEAD_REGION);
entity.setHttpResHdr(resHdrCfg);
HttpBodyCfg reqBodyCfg = new HttpBodyCfg();
reqBodyCfg.setCfgType(Constants.HTTP_REQ_BODY_REGION);
entity.setHttpReqBody(reqBodyCfg);
HttpBodyCfg resBodyCfg = new HttpBodyCfg();
resBodyCfg.setCfgType(Constants.HTTP_RES_BODY_REGION);
entity.setHttpResBody(resBodyCfg);
List<IpPortCfg> ipList=new ArrayList<IpPortCfg>();
ipList.add(new IpPortCfg());
ipList.add(ipCfg);
entity.setIpPortList(ipList);
List<HttpUrlCfg> urlList=new ArrayList<HttpUrlCfg>();
urlList.add(new HttpUrlCfg());
urlList.add(urlCfg);
entity.setHttpUrlList(urlList);
List<HttpReqHeadCfg> reqHdrList=new ArrayList<HttpReqHeadCfg>();
reqHdrList.add(new HttpReqHeadCfg());
reqHdrList.add(reqHdrCfg);
entity.setHttpReqHdrList(reqHdrList);
List<HttpResHeadCfg> resHdrList=new ArrayList<HttpResHeadCfg>();
resHdrList.add(new HttpResHeadCfg());
resHdrList.add(resHdrCfg);
entity.setHttpResHdrList(resHdrList);
List<HttpBodyCfg> reqBodyList=new ArrayList<HttpBodyCfg>();
reqBodyList.add(new HttpBodyCfg());
reqBodyList.add(reqBodyCfg);
entity.setHttpReqBodyList(reqBodyList);
List<HttpBodyCfg> resBodyList=new ArrayList<HttpBodyCfg>();
resBodyList.add(new HttpBodyCfg());
resBodyList.add(resBodyCfg);
entity.setHttpResBodyList(resBodyList);
}
initFormCondition(model,entity);
model.addAttribute("_cfg", entity);
model.addAttribute("_cfg", entity);
return "/cfg/website/httpForm";
}
@RequestMapping(value = {"saveHttpCfg"})