vpn 用户管理修改新增修改和删除逻辑
ip地址池增加存在可用ip地址池才在策略展示
This commit is contained in:
@@ -5,7 +5,9 @@ import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import javax.ws.rs.client.Client;
|
||||
@@ -16,8 +18,10 @@ import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriBuilder;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.utils.HttpClientUtils;
|
||||
import org.eclipse.jetty.util.ajax.JSON;
|
||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
|
||||
import org.slf4j.Logger;
|
||||
@@ -624,6 +628,61 @@ public class ConfigServiceUtil {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
public static Map getCGIInfo(String url,String cmd,Map<String, Object> params) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
params.put("cmd", cmd);
|
||||
String recv = getCGI(url, params);
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
resultMap = (Map<String, Object>) JSON.parse(recv);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
public static String getCGI(String url, Map<String, Object> params) throws MaatConvertException{
|
||||
// if(StringUtils.isBlank(searchCondition.getSearchService())){
|
||||
// throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
||||
// }
|
||||
Response response=null;
|
||||
String result = null;
|
||||
try {
|
||||
UriBuilder builder=UriBuilder.fromPath(url);
|
||||
if(params!=null) {
|
||||
for (String param : params.keySet()) {
|
||||
if(!StringUtil.isBlank(param)&¶ms.get(param)!=null) {
|
||||
builder.queryParam(param,params.get(param).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
URI uri=builder.build();
|
||||
logger.info("cgi url:"+uri.toString());
|
||||
//创建连接
|
||||
ClientUtil.initClient();
|
||||
Client client=ClientUtil.getClient();
|
||||
WebTarget wt = client.target(uri);
|
||||
Builder header = wt.request();
|
||||
try {
|
||||
response= header.get();
|
||||
} catch (Exception e) {
|
||||
throw new MaatConvertException("<spring:message code=\"cgi_service_failed\"/>");
|
||||
}
|
||||
if(response !=null && response.getStatus() == 200){
|
||||
result= response.readEntity(String.class);
|
||||
logger.info("cgi info:"+result);
|
||||
}else{
|
||||
if(response!= null) {
|
||||
throw new MaatConvertException("<spring:message code=\"cgi_service_failed\"/>:"+response.readEntity(String.class));
|
||||
}else {
|
||||
throw new MaatConvertException("<spring:message code=\"cgi_service_failed\"/>");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
if (response != null) {
|
||||
response.close();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置全量更新指令下发
|
||||
|
||||
Reference in New Issue
Block a user