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
8774cce7
Commit
8774cce7
authored
Jun 10, 2013
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
files
parent
3d4ad02b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
FilePipeline.java
...ain/java/us/codecraft/webmagic/pipeline/FilePipeline.java
+1
-1
FileCacheQueueSchedular.java
...codecraft/webmagic/schedular/FileCacheQueueSchedular.java
+4
-0
FreemarkerPipeline.java
...va/us/codecraft/webmagic/pipeline/FreemarkerPipeline.java
+2
-4
No files found.
webmagic-core/src/main/java/us/codecraft/webmagic/pipeline/FilePipeline.java
View file @
8774cce7
...
@@ -36,7 +36,7 @@ public class FilePipeline implements Pipeline {
...
@@ -36,7 +36,7 @@ public class FilePipeline implements Pipeline {
String
path
=
this
.
path
+
""
+
domain
+
"/"
;
String
path
=
this
.
path
+
""
+
domain
+
"/"
;
File
file
=
new
File
(
path
);
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
file
.
mkdir
();
file
.
mkdir
s
();
}
}
try
{
try
{
PrintWriter
printWriter
=
new
PrintWriter
(
new
FileWriter
(
path
+
DigestUtils
.
md5Hex
(
page
.
getUrl
().
toString
())
+
".html"
));
PrintWriter
printWriter
=
new
PrintWriter
(
new
FileWriter
(
path
+
DigestUtils
.
md5Hex
(
page
.
getUrl
().
toString
())
+
".html"
));
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/schedular/FileCacheQueueSchedular.java
View file @
8774cce7
...
@@ -59,6 +59,10 @@ public class FileCacheQueueSchedular implements Schedular {
...
@@ -59,6 +59,10 @@ public class FileCacheQueueSchedular implements Schedular {
}
}
private
void
init
()
{
private
void
init
()
{
File
file
=
new
File
(
filePath
);
if
(!
file
.
exists
()){
file
.
mkdirs
();
}
readFile
();
readFile
();
initWriter
();
initWriter
();
initFlushThread
();
initFlushThread
();
...
...
webmagic-plugin/src/main/java/us/codecraft/webmagic/pipeline/FreemarkerPipeline.java
View file @
8774cce7
...
@@ -29,9 +29,6 @@ public class FreemarkerPipeline implements Pipeline {
...
@@ -29,9 +29,6 @@ public class FreemarkerPipeline implements Pipeline {
this
.
template
=
configuration
.
getTemplate
(
template
);
this
.
template
=
configuration
.
getTemplate
(
template
);
this
.
path
=
path
;
this
.
path
=
path
;
File
file
=
new
File
(
path
);
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
file
.
mkdir
();
}
}
}
public
FreemarkerPipeline
(
String
template
)
throws
IOException
{
public
FreemarkerPipeline
(
String
template
)
throws
IOException
{
...
@@ -46,7 +43,7 @@ public class FreemarkerPipeline implements Pipeline {
...
@@ -46,7 +43,7 @@ public class FreemarkerPipeline implements Pipeline {
String
path
=
this
.
path
+
""
+
domain
+
"/"
;
String
path
=
this
.
path
+
""
+
domain
+
"/"
;
File
file
=
new
File
(
path
);
File
file
=
new
File
(
path
);
if
(!
file
.
exists
())
{
if
(!
file
.
exists
())
{
file
.
mkdir
();
file
.
mkdir
s
();
}
}
try
{
try
{
PrintWriter
printWriter
=
new
PrintWriter
(
new
FileWriter
(
path
+
DigestUtils
.
md5Hex
(
page
.
getUrl
().
toString
())
+
".html"
));
PrintWriter
printWriter
=
new
PrintWriter
(
new
FileWriter
(
path
+
DigestUtils
.
md5Hex
(
page
.
getUrl
().
toString
())
+
".html"
));
...
@@ -54,6 +51,7 @@ public class FreemarkerPipeline implements Pipeline {
...
@@ -54,6 +51,7 @@ public class FreemarkerPipeline implements Pipeline {
printWriter
.
close
();
printWriter
.
close
();
}
catch
(
TemplateException
e
)
{
}
catch
(
TemplateException
e
)
{
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
}
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