some comments

master
yihua.huang 2017-04-08 20:16:17 +08:00
parent 2622b448b8
commit abd020b45b
3 changed files with 6 additions and 3 deletions

View File

@ -112,7 +112,7 @@ public class HttpClientDownloader extends AbstractDownloader {
} }
protected Page handleResponse(Request request, String charset, HttpResponse httpResponse, Task task) throws IOException { protected Page handleResponse(Request request, String charset, HttpResponse httpResponse, Task task) throws IOException {
String content = getContent(charset, httpResponse); String content = getResponseContent(charset, httpResponse);
Page page = new Page(); Page page = new Page();
page.setRawText(content); page.setRawText(content);
page.setUrl(new PlainText(request.getUrl())); page.setUrl(new PlainText(request.getUrl()));
@ -124,7 +124,7 @@ public class HttpClientDownloader extends AbstractDownloader {
return page; return page;
} }
private String getContent(String charset, HttpResponse httpResponse) throws IOException { private String getResponseContent(String charset, HttpResponse httpResponse) throws IOException {
if (charset == null) { if (charset == null) {
byte[] contentBytes = IOUtils.toByteArray(httpResponse.getEntity().getContent()); byte[] contentBytes = IOUtils.toByteArray(httpResponse.getEntity().getContent());
String htmlCharset = getHtmlCharset(httpResponse, contentBytes); String htmlCharset = getHtmlCharset(httpResponse, contentBytes);

View File

@ -7,6 +7,7 @@ import org.apache.http.client.protocol.HttpClientContext;
* @author code4crafter@gmail.com * @author code4crafter@gmail.com
* Date: 17/4/8 * Date: 17/4/8
* Time: 19:43 * Time: 19:43
* @since 0.7.0
*/ */
public class HttpClientRequestContext { public class HttpClientRequestContext {

View File

@ -25,7 +25,9 @@ import java.util.Map;
/** /**
* @author code4crafter@gmail.com * @author code4crafter@gmail.com
* Date: 17/3/18 * Date: 17/3/18
* Time: 11:28 * Time: 11:28
*
* @since 0.7.0
*/ */
public class HttpUriRequestConverter { public class HttpUriRequestConverter {