class ReportGenResource extends JobRelatedResource {
    protected String reportClass;

    @Override
    public void init(Context ctx, Request req, Response res) throws ResourceException {
        super.init(ctx, req, res);
        getVariants().add(new Variant(MediaType.TEXT_PLAIN));
        reportClass = (String)req.getAttributes().get("reportClass");
    }

    @Override
    protected Representation get(Variant variant) throws ResourceException {<FILL_FUNCTION_BODY>}
}

        // generate report
        if (cj == null || cj.getCrawlController() == null) {
            throw new ResourceException(500);
        }
        File f = cj.getCrawlController().getStatisticsTracker().writeReportFile(reportClass);
        if (f==null) {
            throw new ResourceException(500);
        }
        // redirect
        String relative = JobResource.getHrefPath(f, cj);
        if(relative!=null) {
            getResponse().redirectSeeOther("../"+relative+"?m="+f.lastModified());
            return new StringRepresentation("");
        } else {
            return new StringRepresentation(
                    "Report dumped to "+f.getAbsolutePath()
                    +" (outside job directory)");
        }
    
<methods>public non-sealed void <init>() ,public void init(Context, Request, Response) <variables>protected static HashSet<java.lang.String> HIDDEN_PROPS,private static final java.util.logging.Logger LOGGER,protected IdentityHashMap<java.lang.Object,java.lang.String> beanToNameMap,protected org.archive.crawler.framework.CrawlJob cj