配置下发类漏掉两个方法的response异常判断
拦截强度只有拦截域名监测增加
This commit is contained in:
@@ -121,8 +121,16 @@ public class ConfigServiceUtil {
|
|||||||
logger.info("getId url:"+url);
|
logger.info("getId url:"+url);
|
||||||
//获取响应结果
|
//获取响应结果
|
||||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
||||||
Response response= header.get();
|
Response response=null;
|
||||||
if( response.getStatus() == 200){
|
try {
|
||||||
|
response= header.get();
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
|
}
|
||||||
|
if(response != null && response.getStatus() == 200){
|
||||||
logger.info("get result success");
|
logger.info("get result success");
|
||||||
result= response.readEntity(String.class);
|
result= response.readEntity(String.class);
|
||||||
// result = "{\"status\":200,\"businessCode\":2000,\"reason\":\"数据获取操作成功\","
|
// result = "{\"status\":200,\"businessCode\":2000,\"reason\":\"数据获取操作成功\","
|
||||||
@@ -134,14 +142,26 @@ public class ConfigServiceUtil {
|
|||||||
if(!StringUtil.isEmpty(bean.getData())){
|
if(!StringUtil.isEmpty(bean.getData())){
|
||||||
list = bean.getData().getPzIdList();
|
list = bean.getData().getPzIdList();
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
long end=System.currentTimeMillis();
|
long end=System.currentTimeMillis();
|
||||||
logger.warn("get ids finish,cost:"+(end-start));
|
logger.warn("get ids finish,cost:"+(end-start));
|
||||||
return list;
|
return list;
|
||||||
@@ -161,17 +181,31 @@ public class ConfigServiceUtil {
|
|||||||
logger.info("postMaatCfg url:"+url);
|
logger.info("postMaatCfg url:"+url);
|
||||||
//获取响应结果
|
//获取响应结果
|
||||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
||||||
Response response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
Response response=null;
|
||||||
if( response.getStatus() == 200){
|
try {
|
||||||
logger.info("get result success");
|
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
|
}
|
||||||
|
if(response != null && response.getStatus() == 200){
|
||||||
|
logger.info("get result success");
|
||||||
result= response.readEntity(String.class);
|
result= response.readEntity(String.class);
|
||||||
JsonConfig config=new JsonConfig();
|
JsonConfig config=new JsonConfig();
|
||||||
config.setExcludes(new String[]{"configCompileList"});
|
config.setExcludes(new String[]{"configCompileList"});
|
||||||
JSONObject resObject = JSONObject.fromObject(result,config);
|
JSONObject resObject = JSONObject.fromObject(result,config);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -189,14 +223,28 @@ public class ConfigServiceUtil {
|
|||||||
logger.info("postCallbackCfg url:"+url);
|
logger.info("postCallbackCfg url:"+url);
|
||||||
//获取响应结果
|
//获取响应结果
|
||||||
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
||||||
Response response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
Response response=null;
|
||||||
if( response.getStatus() == 200){
|
try {
|
||||||
|
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||||
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
|
}
|
||||||
|
if(response != null && response.getStatus() == 200){
|
||||||
result= response.readEntity(String.class);
|
result= response.readEntity(String.class);
|
||||||
JSONObject resObject = JSONObject.fromObject(result);
|
JSONObject resObject = JSONObject.fromObject(result);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return bean;
|
return bean;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -221,6 +269,9 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response != null && response.getStatus() == 200){
|
if(response != null && response.getStatus() == 200){
|
||||||
@@ -228,8 +279,14 @@ public class ConfigServiceUtil {
|
|||||||
JSONObject resObject = JSONObject.fromObject(result);
|
JSONObject resObject = JSONObject.fromObject(result);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return bean;
|
return bean;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -257,6 +314,9 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.delete();
|
response= header.delete();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response != null && response.getStatus() == 200){
|
if(response != null && response.getStatus() == 200){
|
||||||
@@ -264,8 +324,14 @@ public class ConfigServiceUtil {
|
|||||||
JSONObject resObject = JSONObject.fromObject(result);
|
JSONObject resObject = JSONObject.fromObject(result);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return bean;
|
return bean;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -295,6 +361,9 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response !=null && response.getStatus() == 200){
|
if(response !=null && response.getStatus() == 200){
|
||||||
@@ -302,8 +371,14 @@ public class ConfigServiceUtil {
|
|||||||
JSONObject resObject = JSONObject.fromObject(result);
|
JSONObject resObject = JSONObject.fromObject(result);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -360,6 +435,9 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response !=null && response.getStatus() == 200){
|
if(response !=null && response.getStatus() == 200){
|
||||||
@@ -368,8 +446,14 @@ public class ConfigServiceUtil {
|
|||||||
JSONObject resObject = JSONObject.fromObject(result);
|
JSONObject resObject = JSONObject.fromObject(result);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return bean;
|
return bean;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@@ -393,6 +477,9 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response !=null && response.getStatus() == 200){
|
if(response !=null && response.getStatus() == 200){
|
||||||
@@ -402,8 +489,14 @@ public class ConfigServiceUtil {
|
|||||||
JSONObject resObject = JSONObject.fromObject(result,config);
|
JSONObject resObject = JSONObject.fromObject(result,config);
|
||||||
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
long end=System.currentTimeMillis();
|
long end=System.currentTimeMillis();
|
||||||
logger.warn("postGroupReuseSources end,cost:"+(end-start));
|
logger.warn("postGroupReuseSources end,cost:"+(end-start));
|
||||||
return bean;
|
return bean;
|
||||||
@@ -449,13 +542,22 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.get();
|
response= header.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response !=null && response.getStatus() == 200){
|
if(response !=null && response.getStatus() == 200){
|
||||||
result= response.readEntity(String.class);
|
result= response.readEntity(String.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public static String getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException, UnsupportedEncodingException{
|
public static String getReport(String reportUrl, SearchReport searchCondition) throws MaatConvertException, UnsupportedEncodingException{
|
||||||
@@ -503,13 +605,22 @@ public class ConfigServiceUtil {
|
|||||||
try {
|
try {
|
||||||
response= header.get();
|
response= header.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||||
}
|
}
|
||||||
if(response !=null && response.getStatus() == 200){
|
if(response !=null && response.getStatus() == 200){
|
||||||
result= response.readEntity(String.class);
|
result= response.readEntity(String.class);
|
||||||
}else{
|
}else{
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
|
if (response != null) {
|
||||||
|
response.close();
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -213,7 +213,7 @@
|
|||||||
<shiro:hasPermission name="intercept:${fn:toLowerCase(interceptType)}:config">
|
<shiro:hasPermission name="intercept:${fn:toLowerCase(interceptType)}:config">
|
||||||
<sys:delRow url="${ctx}/proxy/intercept/intercept${interceptType}Form" id="contentTable" label="update"></sys:delRow>
|
<sys:delRow url="${ctx}/proxy/intercept/intercept${interceptType}Form" id="contentTable" label="update"></sys:delRow>
|
||||||
<sys:delRow url="${ctx}/proxy/intercept/updateIntercept${interceptType}Valid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
<sys:delRow url="${ctx}/proxy/intercept/updateIntercept${interceptType}Valid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||||
<sys:delRow url="${ctx}/proxy/intercept/exportIpAddr?functionId=${cfg.functionId }&audit=${audit}" searchUrl="${ctx}/proxy/intercept/${fn:toLowerCase(interceptType)}/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow>
|
<sys:delRow url="${ctx}/proxy/intercept/exportIpAddr?functionId=${cfg.functionId }" searchUrl="${ctx}/proxy/intercept/${fn:toLowerCase(interceptType)}/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow>
|
||||||
</shiro:hasPermission>
|
</shiro:hasPermission>
|
||||||
<shiro:hasPermission name="intercept:${fn:toLowerCase(interceptType)}:confirm">
|
<shiro:hasPermission name="intercept:${fn:toLowerCase(interceptType)}:confirm">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
@@ -485,11 +485,13 @@
|
|||||||
</c:if>
|
</c:if>
|
||||||
<c:if test="${cfg.functionId eq 201 }">
|
<c:if test="${cfg.functionId eq 201 }">
|
||||||
<td>
|
<td>
|
||||||
<c:forEach items="${fns:getDictList('INTERCEPT_DOMAIN_INTENSITY') }" var="intentsityC">
|
<c:if test="${cfg.action eq 1 }">
|
||||||
<c:if test="${intentsityC.itemCode eq indexCfg.userRegion5 }">
|
<c:forEach items="${fns:getDictList('INTERCEPT_DOMAIN_INTENSITY') }" var="intentsityC">
|
||||||
<spring:message code="${intentsityC.itemValue }"/>
|
<c:if test="${intentsityC.itemCode eq indexCfg.userRegion5 }">
|
||||||
</c:if>
|
<spring:message code="${intentsityC.itemValue }"/>
|
||||||
</c:forEach>
|
</c:if>
|
||||||
|
</c:forEach>
|
||||||
|
</c:if>
|
||||||
</td>
|
</td>
|
||||||
</c:if>
|
</c:if>
|
||||||
<td>
|
<td>
|
||||||
|
|||||||
@@ -197,7 +197,7 @@
|
|||||||
<shiro:hasPermission name="iplist:config">
|
<shiro:hasPermission name="iplist:config">
|
||||||
<sys:delRow url="${ctx}/ntc/iplist/form" id="contentTable" label="update"></sys:delRow>
|
<sys:delRow url="${ctx}/ntc/iplist/form" id="contentTable" label="update"></sys:delRow>
|
||||||
<sys:delRow url="${ctx}/ntc/iplist/updateValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
<sys:delRow url="${ctx}/ntc/iplist/updateValid?isValid=-1&functionId=${cfg.functionId }" id="contentTable" label="delete"></sys:delRow>
|
||||||
<sys:delRow url="${ctx}/ntc/iplist/exportIpAddr?functionId=${cfg.functionId }&audit=${audit}" searchUrl="${ctx}/ntc/iplist/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow>
|
<sys:delRow url="${ctx}/ntc/iplist/exportIpAddr?functionId=${cfg.functionId }" searchUrl="${ctx}/ntc/iplist/list?functionId=${cfg.functionId}" id="contentTable" maxRow="10000" label="export"></sys:delRow>
|
||||||
</shiro:hasPermission>
|
</shiro:hasPermission>
|
||||||
<shiro:hasPermission name="iplist:confirm">
|
<shiro:hasPermission name="iplist:confirm">
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
|
|||||||
Reference in New Issue
Block a user