mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-09 23:43:29 +00:00
Fixes from trial guide testing
* StatisticsTracker.java
allow Crawl Summary report to complete even pre-launch
* BeanBrowseResource.java, ScriptResource.java
add page title, backlink to job
* EngineResource.java, PagedRepresentation.java
better in-page labeling
This commit is contained in:
1 parent
c2b82efb89
commit
27783e87ab
5 files changed
+32
-11
No files matched your search
@@ -989,7 +989,7 @@ public class StatisticsTracker
|
||||
for (Iterator<String> i = getSeedsIterator();i.hasNext();) {
|
||||
SeedRecord sr = processedSeedsRecords.get(i.next());
|
||||
seedsTotal++;
|
||||
if((sr.getStatusCode() > 0)) {
|
||||
if(sr!=null &&(sr.getStatusCode() > 0)) {
|
||||
seedsCrawled++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.archive.spring.PathSharingContext;
|
||||
import org.archive.util.TextUtils;
|
||||
import org.restlet.Context;
|
||||
import org.restlet.data.CharacterSet;
|
||||
import org.restlet.data.Form;
|
||||
@@ -128,9 +129,10 @@ public class BeanBrowseResource extends JobRelatedResource {
|
||||
|
||||
protected void writeHtml(Writer writer) {
|
||||
PrintWriter pw = new PrintWriter(writer);
|
||||
|
||||
|
||||
pw.println("<h1>Crawl beans in built job <i>"+cj.getShortName()+"</i></h1>");
|
||||
pw.println("<head><title>Crawl beans in "+cj.getShortName()+"</title></head>");
|
||||
pw.println("<h1>Crawl beans in built job <i><a href='/engine/job/"
|
||||
+TextUtils.urlEscape(cj.getShortName())
|
||||
+"'>"+cj.getShortName()+"</a></i></h1>");
|
||||
pw.println("Enter a bean path of the form <i>beanName</i>, <i>beanName.property</i>, <i>beanName.property[indexOrKey]</i>, etc.");
|
||||
pw.println("<form method='POST'><input type='text' name='beanPath' style='width:400px' value='"+beanPath+"'/>");
|
||||
pw.println("<input type='submit' value='view'/></form>");
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package org.archive.crawler.restlet;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.Writer;
|
||||
@@ -79,6 +80,12 @@ public class EngineResource extends Resource {
|
||||
protected void writeHtml(Writer writer) {
|
||||
Engine engine = getEngine();
|
||||
String engineTitle = "Heritrix Engine "+engine.getHeritrixVersion();
|
||||
File jobsDir = engine.getJobsDir();
|
||||
try {
|
||||
jobsDir = jobsDir.getCanonicalFile();
|
||||
} catch (IOException ioe) {
|
||||
// live with the noncanonical file
|
||||
}
|
||||
String baseRef = getRequest().getResourceRef().getBaseRef().toString();
|
||||
if(!baseRef.endsWith("/")) {
|
||||
baseRef += "/";
|
||||
@@ -91,21 +98,28 @@ public class EngineResource extends Resource {
|
||||
|
||||
pw.println("<b>Memory: </b>");
|
||||
pw.println(engine.heapReport());
|
||||
|
||||
pw.println("<h2>Browse <a href='jobsdir'>Jobs Directory</a></h2>");
|
||||
pw.println("<br/><br/>");
|
||||
pw.println("<b>Jobs Directory</b>: <a href='jobsdir'>"+jobsDir.getAbsolutePath()+"</a></h2>");
|
||||
|
||||
ArrayList<CrawlJob> jobs = new ArrayList<CrawlJob>();
|
||||
jobs.addAll(engine.getJobConfigs().values());
|
||||
|
||||
pw.println("<form method=\'POST\'><h2>Job Configs ("+jobs.size()+")");
|
||||
pw.println("<form method=\'POST\'><h2>Job Directories ("+jobs.size()+")");
|
||||
pw.println("<input style='width:6em' type='submit' name='action' value='rescan'>");
|
||||
pw.println("</h2></form>");
|
||||
Collections.sort(jobs);
|
||||
pw.println("<ul>");
|
||||
for(CrawlJob cj: jobs) {
|
||||
pw.println("<li>");
|
||||
cj.writeHtmlTo(pw,"job/");
|
||||
pw.println("</li>");
|
||||
}
|
||||
pw.println("</ul>");
|
||||
pw.println(
|
||||
"To create a new job, use the 'copy' functionality on " +
|
||||
"an existing job's detail page, or create a new job " +
|
||||
"directory outside this interface and use the 'rescan' " +
|
||||
"button.");
|
||||
pw.println("</body>");
|
||||
pw.flush();
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ public class PagedRepresentation extends CharacterRepresentation {
|
||||
loadLines();
|
||||
|
||||
PrintWriter pw = new PrintWriter(writer);
|
||||
pw.println(file);
|
||||
pw.println("<b>Paged view:</b> "+file);
|
||||
emitControls(pw);
|
||||
|
||||
pw.println("<pre>");
|
||||
@@ -198,7 +198,7 @@ public class PagedRepresentation extends CharacterRepresentation {
|
||||
pw.println("</td>");
|
||||
|
||||
pw.println("<td style='text-align:right'>");
|
||||
pw.println("<a href='"+getControlUri(position,lineCount,false)+"'>normal</a>");
|
||||
pw.println("<a href='"+getControlUri(position,lineCount,false)+"'>forward</a>");
|
||||
pw.println("| <b>reversed</b>");
|
||||
} else {
|
||||
pw.print("<td style='text-align:left'>");
|
||||
@@ -224,7 +224,7 @@ public class PagedRepresentation extends CharacterRepresentation {
|
||||
pw.println("'>end »</a>");
|
||||
pw.println("</td>");
|
||||
|
||||
pw.println("<td style='text-align:right'><b>normal</b>");
|
||||
pw.println("<td style='text-align:right'><b>forward</b>");
|
||||
pw.println("| <a href='"+getControlUri(position,lineCount,true)+"'>reversed</a>");
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import javax.script.ScriptException;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.archive.util.TextUtils;
|
||||
import org.restlet.Context;
|
||||
import org.restlet.data.CharacterSet;
|
||||
import org.restlet.data.Form;
|
||||
@@ -122,7 +123,11 @@ public class ScriptResource extends JobRelatedResource {
|
||||
|
||||
protected void writeHtml(Writer writer) {
|
||||
PrintWriter pw = new PrintWriter(writer);
|
||||
pw.println("<h1>Execute script for job <i>"+cj.getShortName()+"</i></h1>");
|
||||
pw.println("<head><title>Script in "+cj.getShortName()+"</title></head>");
|
||||
pw.println("<h1>Execute script for job <i><a href='/engine/job/"
|
||||
+TextUtils.urlEscape(cj.getShortName())
|
||||
+"'>"+cj.getShortName()+"</a></i></h1>");
|
||||
|
||||
// output of previous script, if any
|
||||
|
||||
if(ex!=null) {
|
||||
|
||||
Reference in new issue
Block a user