Skip to content

Commit

Permalink
*) direct access to responseheaders of sbQueue.Entry removed to make …
Browse files Browse the repository at this point in the history
…it more http independent

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2487 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
theli committed Sep 4, 2006
1 parent ffbf416 commit 7a35b8e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
2 changes: 1 addition & 1 deletion htroot/IndexCreateIndexingQueue_p.java
Expand Up @@ -161,7 +161,7 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
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));
Expand Down
14 changes: 3 additions & 11 deletions source/de/anomic/plasma/plasmaSwitchboard.java
Expand Up @@ -1396,11 +1396,8 @@ public boolean remoteTriggeredCrawlJob() {
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();
Expand Down Expand Up @@ -1465,7 +1462,7 @@ private void processResourceStack(plasmaSwitchboardQueue.Entry entry) throws Int
", 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

/* =========================================================================
Expand All @@ -1480,12 +1477,7 @@ private void processResourceStack(plasmaSwitchboardQueue.Entry entry) throws Int
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
Expand Down
20 changes: 19 additions & 1 deletion source/de/anomic/plasma/plasmaSwitchboardQueue.java
Expand Up @@ -306,7 +306,7 @@ public plasmaCrawlProfile.entry profile() {
return profileEntry;
}

public httpHeader responseHeader() {
private httpHeader responseHeader() {
if (responseHeader == null) try {
responseHeader = htCache.getCachedResponse(indexURL.urlHash(url));
} catch (IOException e) {
Expand All @@ -316,6 +316,24 @@ public httpHeader responseHeader() {
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;
Expand Down

0 comments on commit 7a35b8e

Please sign in to comment.