Commit 6ed3ae61 authored by jim's avatar jim

release

parent 17eb5a06
package com.edgec.browserbackend.common.utils; package com.edgec.browserbackend.common.utils;
import com.edgec.browserbackend.common.commons.utils.NotifyUtils; import com.edgec.browserbackend.common.commons.utils.NotifyUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpHost; import org.apache.http.HttpHost;
...@@ -43,6 +44,7 @@ public class Trans { ...@@ -43,6 +44,7 @@ public class Trans {
/** /**
* 主入口方法 * 主入口方法
*
* @param args * @param args
*/ */
public static void main(String[] args) { public static void main(String[] args) {
...@@ -56,7 +58,7 @@ public class Trans { ...@@ -56,7 +58,7 @@ public class Trans {
httpClient.getCredentialsProvider().setCredentials( httpClient.getCredentialsProvider().setCredentials(
new AuthScope(host, port), new AuthScope(host, port),
new UsernamePasswordCredentials(username, password)); new UsernamePasswordCredentials(username, password));
HttpHost proxy = new HttpHost(host,port); HttpHost proxy = new HttpHost(host, port);
httpClient.getParams().setParameter(ConnRouteParams.DEFAULT_PROXY, proxy); httpClient.getParams().setParameter(ConnRouteParams.DEFAULT_PROXY, proxy);
return httpClient; return httpClient;
} }
...@@ -76,13 +78,11 @@ public class Trans { ...@@ -76,13 +78,11 @@ public class Trans {
HttpEntity entry = response.getEntity(); HttpEntity entry = response.getEntity();
if(entry != null) if (entry != null) {
{
InputStreamReader is = new InputStreamReader(entry.getContent()); InputStreamReader is = new InputStreamReader(entry.getContent());
BufferedReader br = new BufferedReader(is); BufferedReader br = new BufferedReader(is);
String str = null; String str = null;
while((str = br.readLine()) != null) while ((str = br.readLine()) != null) {
{
sb.append(str.trim()); sb.append(str.trim());
} }
br.close(); br.close();
...@@ -96,6 +96,8 @@ public class Trans { ...@@ -96,6 +96,8 @@ public class Trans {
NotifyUtils.sendMessage("防关联浏览器 ip " + host + " 代理异常", e, NotifyUtils.MsgType.WEBHOOK); NotifyUtils.sendMessage("防关联浏览器 ip " + host + " 代理异常", e, NotifyUtils.MsgType.WEBHOOK);
logger.error(e.getMessage(), e); logger.error(e.getMessage(), e);
return ""; return "";
} finally {
httpGet.releaseConnection();
} }
return sb.toString(); return sb.toString();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment