All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.archive.modules.revisit.IdenticalPayloadDigestRevisit Maven / Gradle / Ivy

Go to download

This project contains some of the configurable modules used within the Heritrix application to crawl the web. The modules in this project can be used in applications other than Heritrix, however.

There is a newer version: 3.5.0
Show newest version
package org.archive.modules.revisit;

import static org.archive.format.warc.WARCConstants.HEADER_KEY_PAYLOAD_DIGEST;
import static org.archive.format.warc.WARCConstants.HEADER_KEY_REFERS_TO_TARGET_URI;

import java.util.Map;

import org.archive.format.warc.WARCConstants;

public class IdenticalPayloadDigestRevisit extends AbstractProfile {

	protected final String payloadDigest;
	protected String refersToTargetURI;
		
	/**
	 * Minimal constructor.
	 * @param payloadDigest The digest of the original record
	 */
	public IdenticalPayloadDigestRevisit(String payloadDigest) {
		if (payloadDigest==null) {
			throw new NullPointerException("PayloadDigest may not be null");
		}
		this.payloadDigest = payloadDigest;
	}
	
		
	@Override
	public String getProfileName() {
		return WARCConstants.PROFILE_REVISIT_IDENTICAL_DIGEST;
	}

	@Override
	public Map getWarcHeaders() {
		Map headers = super.getWarcHeaders();
		
		headers.put(HEADER_KEY_PAYLOAD_DIGEST, payloadDigest); 
		
		if (refersToTargetURI!=null) {
			headers.put(HEADER_KEY_REFERS_TO_TARGET_URI, refersToTargetURI);
		}
		
	
		return headers;
	}


	public String getRefersToTargetURI() {
		return refersToTargetURI;
	}


	public void setRefersToTargetURI(String refersToTargetURI) {
		this.refersToTargetURI = refersToTargetURI;
	}


	public String getPayloadDigest() {
		return payloadDigest;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy