class ExtractorHTTP extends Extractor {

    @SuppressWarnings("unused")
    private static final long serialVersionUID = 3L;

    public ExtractorHTTP() {
    }

    /** should all HTTP URIs be used to infer a link to the site's root? */
    protected boolean inferRootPage = false; 
    public boolean getInferRootPage() {
        return inferRootPage;
    }
    public void setInferRootPage(boolean inferRootPage) {
        this.inferRootPage = inferRootPage;
    }


    @Override
    protected boolean shouldProcess(CrawlURI uri) {
        if (uri.getFetchStatus() <= 0) {
            return false;
        }
        FetchType ft = uri.getFetchType();
        return (ft == FetchType.HTTP_GET) || (ft == FetchType.HTTP_POST);
    }


    @Override
    protected void extract(CrawlURI curi) {
        // discover headers if present
        addHeaderLink(curi, "Location");
        addContentLocationHeaderLink(curi, "Content-Location");
        addRefreshHeaderLink(curi, "Refresh");

        // try /favicon.ico for every HTTP(S) URI
        addOutlink(curi, "/favicon.ico", LinkContext.INFERRED_MISC, Hop.INFERRED);
        if(getInferRootPage()) {
            addOutlink(curi, "/", LinkContext.INFERRED_MISC, Hop.INFERRED);
        }
    }

    protected void addRefreshHeaderLink(CrawlURI curi, String headerKey) {
        String headerValue = curi.getHttpResponseHeader(headerKey);
        if (headerValue != null) {
            // parsing logic copied from ExtractorHTML meta-refresh handling
            int urlIndex = headerValue.indexOf("=") + 1;
            if (urlIndex > 0) {
                String refreshUri = headerValue.substring(urlIndex);
                addHeaderLink(curi, headerKey, refreshUri);
            }
        }
    }

    protected void addHeaderLink(CrawlURI curi, String headerKey) {
        String headerValue = curi.getHttpResponseHeader(headerKey);
        if (headerValue != null) {
            addHeaderLink(curi, headerKey, headerValue);
        }
    }

    protected void addContentLocationHeaderLink(CrawlURI curi, String headerKey) {<FILL_FUNCTION_BODY>}
    
    protected void addHeaderLink(CrawlURI curi, String headerName, String url) {
        try {
            UURI dest = UURIFactory.getInstance(curi.getUURI(), url);
            LinkContext lc = HTMLLinkContext.get(headerName+":");
            addOutlink(curi, dest.toString(), lc, Hop.REFER);
            numberOfLinksExtracted.incrementAndGet();
        } catch (URIException e) {
            logUriError(e, curi.getUURI(), url);
        }
    }
}

        String headerValue = curi.getHttpResponseHeader(headerKey);
        if (headerValue != null) {
            try {
                UURI dest = UURIFactory.getInstance(curi.getUURI(), headerValue);
                addOutlink(curi, dest.toString(), LinkContext.INFERRED_MISC, Hop.INFERRED);
                numberOfLinksExtracted.incrementAndGet();
            } catch (URIException e) {
                logUriError(e, curi.getUURI(), headerValue);
            }
        }
    
<methods>public non-sealed void <init>() ,public static void add(org.archive.modules.CrawlURI, int, java.lang.String, org.archive.modules.extractor.LinkContext, org.archive.modules.extractor.Hop) throws URIException,public static org.archive.modules.CrawlURI addRelativeToBase(org.archive.modules.CrawlURI, int, java.lang.CharSequence, org.archive.modules.extractor.LinkContext, org.archive.modules.extractor.Hop) throws URIException,public static org.archive.modules.CrawlURI addRelativeToVia(org.archive.modules.CrawlURI, int, java.lang.String, org.archive.modules.extractor.LinkContext, org.archive.modules.extractor.Hop) throws URIException,public org.archive.modules.extractor.ExtractorParameters getExtractorParameters() ,public org.archive.modules.extractor.UriErrorLoggerModule getLoggerModule() ,public void logUriError(URIException, org.archive.net.UURI, java.lang.CharSequence) ,public java.lang.String report() ,public void setExtractorParameters(org.archive.modules.extractor.ExtractorParameters) ,public void setLoggerModule(org.archive.modules.extractor.UriErrorLoggerModule) <variables>public static final org.archive.modules.extractor.ExtractorParameters DEFAULT_PARAMETERS,private static final java.util.logging.Logger LOGGER,protected transient org.archive.modules.extractor.ExtractorParameters extractorParameters,private static final java.util.logging.Logger logger,protected transient org.archive.modules.extractor.UriErrorLoggerModule loggerModule,protected java.util.concurrent.atomic.AtomicLong numberOfLinksExtracted