mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-11-09 23:43:29 +00:00
[HER-1698] report generation gives text of path, without showing report
* JobResource.java
make getHrefPath public static utility method
* ReportGenResource.java
use getHrefPath so '/anypath/' URLs are used where needed
This commit is contained in:
1 parent
a7a990b638
commit
9b211165df
2 files changed
+13
-4
No files matched your search
@@ -355,7 +355,7 @@ public class JobResource extends Resource {
|
||||
* @param f File
|
||||
*/
|
||||
protected void printLinkedFile(PrintWriter pw, File f, String linktext, String queryString) {
|
||||
String relativePath = getHrefPath(f);
|
||||
String relativePath = JobResource.getHrefPath(f,cj);
|
||||
pw.println("<a href='"
|
||||
+ relativePath
|
||||
+ ((queryString==null) ? "" : "?" + queryString)
|
||||
@@ -368,7 +368,16 @@ public class JobResource extends Resource {
|
||||
}
|
||||
}
|
||||
|
||||
protected String getHrefPath(File f) {
|
||||
/**
|
||||
* Get a usable HrefPath, relative to the JobResource, for the given
|
||||
* file. Assumes usual helper resources ('jobdir/', 'anypath/') at
|
||||
* the usual locations.
|
||||
*
|
||||
* @param f File to provide an href (suitable for clicking or redirection)
|
||||
* @param cj CrawlJob for calculating jobdir-relative path if possible
|
||||
* @return String path suitable as href or Location header
|
||||
*/
|
||||
public static String getHrefPath(File f, CrawlJob cj) {
|
||||
String jobDirRelative = cj.jobDirRelativePath(f);
|
||||
if(jobDirRelative!=null) {
|
||||
return "jobdir/"+jobDirRelative;
|
||||
|
||||
@@ -52,9 +52,9 @@ public class ReportGenResource extends JobRelatedResource {
|
||||
throw new ResourceException(500);
|
||||
}
|
||||
// redirect
|
||||
String relative = cj.jobDirRelativePath(f);
|
||||
String relative = JobResource.getHrefPath(f,cj);
|
||||
if(relative!=null) {
|
||||
getResponse().redirectSeeOther("../jobdir/"+relative+"?m="+f.lastModified());
|
||||
getResponse().redirectSeeOther("../"+relative+"?m="+f.lastModified());
|
||||
return new StringRepresentation("");
|
||||
} else {
|
||||
return new StringRepresentation(
|
||||
|
||||
Reference in new issue
Block a user