Commit a6153b6e by [zhangzhiwei]

升级采集核心包

parent 650be1b5
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>com.zhiwei</groupId> <groupId>com.zhiwei</groupId>
<artifactId>weibohotcrawler</artifactId> <artifactId>weibohotcrawler</artifactId>
<version>0.0.4-SNAPSHOT</version> <version>0.0.5-SNAPSHOT</version>
<name>weibohotcrawler</name> <name>weibohotcrawler</name>
<description>微博热搜1小时榜单,社会、热点采集程序</description> <description>微博热搜1小时榜单,社会、热点采集程序</description>
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
<dependency> <dependency>
<groupId>com.zhiwei.tools</groupId> <groupId>com.zhiwei.tools</groupId>
<artifactId>zhiwei-tools</artifactId> <artifactId>zhiwei-tools</artifactId>
<version>0.1.1-SNAPSHOT</version> <version>0.1.3-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.zhiwei.crawler</groupId> <groupId>com.zhiwei.crawler</groupId>
<artifactId>crawler-core</artifactId> <artifactId>crawler-core</artifactId>
<version>0.1.1-RELEASE</version> <version>0.3.6-RELEASE</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -6,11 +6,14 @@ import java.util.Map; ...@@ -6,11 +6,14 @@ import java.util.Map;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.zhiwei.tools.httpclient.HttpClientTemplateOK; import com.zhiwei.crawler.core.HttpBoot;
import com.zhiwei.crawler.utils.RequestUtils;
public class HttpClientDemo { public class HttpClientDemo {
private static Logger logger = LoggerFactory.getLogger(HttpClientDemo.class); private static Logger logger = LoggerFactory.getLogger(HttpClientDemo.class);
private static HttpBoot httpBoot = new HttpBoot.Builder().retryTimes(3).build();
public static String executeHttpRequestGet(String url) { public static String executeHttpRequestGet(String url) {
String result = null; String result = null;
...@@ -25,7 +28,7 @@ public class HttpClientDemo { ...@@ -25,7 +28,7 @@ public class HttpClientDemo {
try { try {
// Response response = HttpBoot.syncCall(RequestUtils.wrapGet(url, headerMap)); // Response response = HttpBoot.syncCall(RequestUtils.wrapGet(url, headerMap));
// result = response.body().string(); // result = response.body().string();
result = HttpClientTemplateOK.get(url, null, headerMap); result = httpBoot.syncCall(RequestUtils.wrapGet(url, headerMap)).body().string();
return result; return result;
} catch (Exception e) { } catch (Exception e) {
......
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