Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webmagic
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
webmagic
Commits
abd020b4
Commit
abd020b4
authored
Apr 08, 2017
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some comments
parent
2622b448
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
3 deletions
+6
-3
HttpClientDownloader.java
...s/codecraft/webmagic/downloader/HttpClientDownloader.java
+2
-2
HttpClientRequestContext.java
...decraft/webmagic/downloader/HttpClientRequestContext.java
+1
-0
HttpUriRequestConverter.java
...odecraft/webmagic/downloader/HttpUriRequestConverter.java
+3
-1
No files found.
webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpClientDownloader.java
View file @
abd020b4
...
...
@@ -112,7 +112,7 @@ public class HttpClientDownloader extends AbstractDownloader {
}
protected
Page
handleResponse
(
Request
request
,
String
charset
,
HttpResponse
httpResponse
,
Task
task
)
throws
IOException
{
String
content
=
getContent
(
charset
,
httpResponse
);
String
content
=
get
Response
Content
(
charset
,
httpResponse
);
Page
page
=
new
Page
();
page
.
setRawText
(
content
);
page
.
setUrl
(
new
PlainText
(
request
.
getUrl
()));
...
...
@@ -124,7 +124,7 @@ public class HttpClientDownloader extends AbstractDownloader {
return
page
;
}
private
String
getContent
(
String
charset
,
HttpResponse
httpResponse
)
throws
IOException
{
private
String
get
Response
Content
(
String
charset
,
HttpResponse
httpResponse
)
throws
IOException
{
if
(
charset
==
null
)
{
byte
[]
contentBytes
=
IOUtils
.
toByteArray
(
httpResponse
.
getEntity
().
getContent
());
String
htmlCharset
=
getHtmlCharset
(
httpResponse
,
contentBytes
);
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpClientRequestContext.java
View file @
abd020b4
...
...
@@ -7,6 +7,7 @@ import org.apache.http.client.protocol.HttpClientContext;
* @author code4crafter@gmail.com
* Date: 17/4/8
* Time: 19:43
* @since 0.7.0
*/
public
class
HttpClientRequestContext
{
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/downloader/HttpUriRequestConverter.java
View file @
abd020b4
...
...
@@ -25,7 +25,9 @@ import java.util.Map;
/**
* @author code4crafter@gmail.com
* Date: 17/3/18
* Time: 上午11:28
* Time: 11:28
*
* @since 0.7.0
*/
public
class
HttpUriRequestConverter
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment