From 56481656c7de11cdca69c1a7dd69db176ffd9ecd Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 08 五月 2021 12:49:30 +0800 Subject: [PATCH] 华为屏蔽金币任务中的看海量视频,新增广告平台概率控制 --- src/main/java/com/yeshi/buwan/util/HttpUtil.java | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/yeshi/buwan/util/HttpUtil.java b/src/main/java/com/yeshi/buwan/util/HttpUtil.java index e7abef6..56a6794 100644 --- a/src/main/java/com/yeshi/buwan/util/HttpUtil.java +++ b/src/main/java/com/yeshi/buwan/util/HttpUtil.java @@ -36,6 +36,22 @@ return ""; } + + public static String defaultGet(String url) { + HttpClient client = new HttpClient(); + GetMethod method = new GetMethod(url); + try { + client.executeMethod(method); + method.getStatusCode(); + return method.getResponseBodyAsString(); + } catch (HttpException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return ""; + } + public static String get(String url, Map<String, String> map) { HttpClient client = new HttpClient(); // client.getHostConfiguration().setProxy("192.168.1.122", 8888); @@ -88,6 +104,7 @@ public static InputStream getAsInputStream(String url) { HttpClient client = new HttpClient(); + client.getHttpConnectionManager().getParams().setConnectionTimeout(5000); GetMethod method = new GetMethod(url); try { client.executeMethod(method); -- Gitblit v1.8.0