Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

*) direct access to responseheaders of sbQueue.Entry removed to make it more http independent

theli7a35b8e2379e
diff --git a/htroot/IndexCreateIndexingQueue_p.java b/htroot/IndexCreateIndexingQueue_p.java
index b3fd74b86..8c1bbb321 100644
--- a/htroot/IndexCreateIndexingQueue_p.java
+++ b/htroot/IndexCreateIndexingQueue_p.java
@@ -161,7 +161,7 @@ public class IndexCreateIndexingQueue_p {
prop.put("indexing-queue_list_"+entryCount+"_dark", (inProcess)? 2: ((dark) ? 1 : 0));
prop.put("indexing-queue_list_"+entryCount+"_initiator", ((initiator == null) ? "proxy" : wikiCode.replaceHTML(initiator.getName())));
prop.put("indexing-queue_list_"+entryCount+"_depth", pcentry.depth());
- prop.put("indexing-queue_list_"+entryCount+"_modified", (pcentry.responseHeader() == null) ? "" : daydate(pcentry.responseHeader().lastModified()));
+ prop.put("indexing-queue_list_"+entryCount+"_modified", pcentry.getModificationDate());
prop.put("indexing-queue_list_"+entryCount+"_anchor", (pcentry.anchorName()==null)?"":wikiCode.replaceHTML(pcentry.anchorName()));
prop.put("indexing-queue_list_"+entryCount+"_url", wikiCode.replaceHTML(pcentry.normalizedURLString()));
prop.put("indexing-queue_list_"+entryCount+"_size", bytesToString(entrySize));
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index 555b04e0a..fea42ed2d 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -1396,11 +1396,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
private plasmaParserDocument parseResource(plasmaSwitchboardQueue.Entry entry, String initiatorHash) throws InterruptedException {
plasmaParserDocument document = null;
- // the http header that belongs to this entry
- httpHeader entryRespHeader = entry.responseHeader();
-
// the mimetype of this entry
- String mimeType = (entryRespHeader == null)?null:entryRespHeader.mime();
+ String mimeType = entry.getMimeType();
// the parser logger
serverLog parserLogger = parser.getLogger();
@@ -1465,7 +1462,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
", maxDepth=" + ((entry.profile() == null) ? "null" : Integer.toString(entry.profile().generalDepth())) +
", filter=" + ((entry.profile() == null) ? "null" : entry.profile().generalFilter()) +
", initiatorHash=" + initiatorPeerHash +
- ", responseHeader=" + ((entry.responseHeader() == null) ? "null" : entry.responseHeader().toString()) +
+ //", responseHeader=" + ((entry.responseHeader() == null) ? "null" : entry.responseHeader().toString()) +
", url=" + entry.url()); // DEBUG
/* =========================================================================
@@ -1480,12 +1477,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
parsingEndTime = System.currentTimeMillis();
// getting the document date
- Date docDate = null;
- if (entry.responseHeader() != null) {
- docDate = entry.responseHeader().lastModified();
- if (docDate == null) docDate = entry.responseHeader().date();
- }
- if (docDate == null) docDate = new Date();
+ Date docDate = entry.getModificationDate();
/* =========================================================================
* put anchors on crawl stack
diff --git a/source/de/anomic/plasma/plasmaSwitchboardQueue.java b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
index de6552a08..eaa0e5c9c 100644
--- a/source/de/anomic/plasma/plasmaSwitchboardQueue.java
+++ b/source/de/anomic/plasma/plasmaSwitchboardQueue.java
@@ -306,7 +306,7 @@ public class plasmaSwitchboardQueue {
return profileEntry;
}
- public httpHeader responseHeader() {
+ private httpHeader responseHeader() {
if (responseHeader == null) try {
responseHeader = htCache.getCachedResponse(indexURL.urlHash(url));
} catch (IOException e) {
@@ -316,6 +316,24 @@ public class plasmaSwitchboardQueue {
return responseHeader;
}
+ public String getMimeType() {
+ httpHeader headers = this.responseHeader();
+ return (headers == null) ? null : headers.mime();
+ }
+
+ public Date getModificationDate() {
+ Date docDate = null;
+
+ httpHeader headers = this.responseHeader();
+ if (headers != null) {
+ docDate = headers.lastModified();
+ if (docDate == null) docDate = headers.date();
+ }
+ if (docDate == null) docDate = new Date();
+
+ return docDate;
+ }
+
public URL referrerURL() {
if (referrerURL == null) {
if ((referrerHash == null) || (referrerHash.equals(indexURL.dummyHash))) return null;