From 29abbecdf31845f9c6e561b5e3bf490961fc2bdf Mon Sep 17 00:00:00 2001 From: Noah Levitt Date: Mon, 2 Jul 2012 10:30:27 -0700 Subject: [PATCH] make data key "httpResponseHeaders" a constant --- .../java/org/archive/modules/CoreAttributeConstants.java | 2 ++ modules/src/main/java/org/archive/modules/CrawlURI.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/src/main/java/org/archive/modules/CoreAttributeConstants.java b/modules/src/main/java/org/archive/modules/CoreAttributeConstants.java index 8f6d389e..0e5c3cc5 100644 --- a/modules/src/main/java/org/archive/modules/CoreAttributeConstants.java +++ b/modules/src/main/java/org/archive/modules/CoreAttributeConstants.java @@ -114,4 +114,6 @@ public interface CoreAttributeConstants { public static final String A_FTP_FETCH_STATUS = "ftp-fetch-status"; public static final String A_WHOIS_SERVER_IP = "whois-server-ip"; + + public static final String A_HTTP_RESPONSE_HEADERS = "http-response-headers"; } diff --git a/modules/src/main/java/org/archive/modules/CrawlURI.java b/modules/src/main/java/org/archive/modules/CrawlURI.java index e635cf03..6babe611 100644 --- a/modules/src/main/java/org/archive/modules/CrawlURI.java +++ b/modules/src/main/java/org/archive/modules/CrawlURI.java @@ -26,6 +26,7 @@ import static org.archive.modules.CoreAttributeConstants.A_FETCH_COMPLETED_TIME; import static org.archive.modules.CoreAttributeConstants.A_FORCE_RETIRE; import static org.archive.modules.CoreAttributeConstants.A_HERITABLE_KEYS; import static org.archive.modules.CoreAttributeConstants.A_HTML_BASE; +import static org.archive.modules.CoreAttributeConstants.A_HTTP_RESPONSE_HEADERS; import static org.archive.modules.CoreAttributeConstants.A_NONFATAL_ERRORS; import static org.archive.modules.CoreAttributeConstants.A_PREREQUISITE_URI; import static org.archive.modules.CoreAttributeConstants.A_SOURCE_TAG; @@ -1862,7 +1863,7 @@ implements Reporter, Serializable, OverlayContext { */ public String getHttpResponseHeader(String key) { @SuppressWarnings("unchecked") - Map httpResponseHeaders = (Map) getData().get("httpResponseHeaders"); + Map httpResponseHeaders = (Map) getData().get(A_HTTP_RESPONSE_HEADERS); if (httpResponseHeaders == null) { return null; } @@ -1871,10 +1872,10 @@ implements Reporter, Serializable, OverlayContext { public void putHttpResponseHeader(String key, String value) { @SuppressWarnings("unchecked") - Map httpResponseHeaders = (Map) getData().get("httpResponseHeaders"); + Map httpResponseHeaders = (Map) getData().get(A_HTTP_RESPONSE_HEADERS); if (httpResponseHeaders == null) { httpResponseHeaders = new HashMap(); - getData().put("httpResponseHeaders", httpResponseHeaders); + getData().put(A_HTTP_RESPONSE_HEADERS, httpResponseHeaders); } httpResponseHeaders.put(key.toLowerCase(), value); }