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

org.archive.modules.revisit.ServerNotModifiedRevisit 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_ETAG;
import static org.archive.format.warc.WARCConstants.HEADER_KEY_LAST_MODIFIED;
import static org.archive.format.warc.WARCConstants.HEADER_KEY_PAYLOAD_DIGEST;

import java.util.Map;

import org.archive.format.warc.WARCConstants;

public class ServerNotModifiedRevisit extends AbstractProfile {
	
	// From HTTP response
	protected String eTag;
	protected String lastModified;
	
	// Optional. Digest of original capture
	protected String payloadDigest;
	
	/**
	 * Minimal constructor.
	 */
	public ServerNotModifiedRevisit() {
	}
	
		
	@Override
	public String getProfileName() {
		return WARCConstants.PROFILE_REVISIT_NOT_MODIFIED;
	}

	@Override
	public Map getWarcHeaders() {
		Map headers = super.getWarcHeaders();
		
		if (payloadDigest!=null) {
			headers.put(HEADER_KEY_PAYLOAD_DIGEST, payloadDigest);
		}
		
		if (eTag!=null) {
			headers.put(HEADER_KEY_ETAG, eTag);
		}
		
		if (lastModified!=null) {
			headers.put(HEADER_KEY_LAST_MODIFIED, lastModified);
		}
		
		return headers;
	}

	public String getETag() {
		return eTag;
	}


	public void setETag(String eTag) {
		this.eTag = eTag;
	}


	public String getLastModified() {
		return lastModified;
	}


	public void setLastModified(String lastModified) {
		this.lastModified = lastModified;
	}


	public String getPayloadDigest() {
		return payloadDigest;
	}


	public void setPayloadDigest(String payloadDigest) {
		this.payloadDigest = payloadDigest;
	}

	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy