⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seedrecord.java

📁 这是个爬虫和lucece相结合最好了
💻 JAVA
字号:
/* SeedRecord *  * $Id: SeedRecord.java 4671 2006-09-26 23:47:15Z paul_jack $ * * Created on June 12, 2005 *  * Copyright (C) 2005 Internet Archive. * * This file is part of the Heritrix web crawler (crawler.archive.org). * * Heritrix is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * any later version. * * Heritrix is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU Lesser Public License for more details. * * You should have received a copy of the GNU Lesser Public License * along with Heritrix; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA * */package org.archive.crawler.admin;import java.io.Serializable;import org.archive.crawler.datamodel.CandidateURI;import org.archive.crawler.datamodel.CoreAttributeConstants;import org.archive.crawler.datamodel.CrawlURI;/** * Record of all interesting info about the most-recent * processing of a specific seed. *  * @author gojomo */public class SeedRecord implements CoreAttributeConstants, Serializable {    private static final long serialVersionUID = -8455358640509744478L;    private final String uri;    private int statusCode;    private final String disposition;    private String redirectUri;        /**     * Create a record from the given CrawlURI and disposition string     *      * @param curi CrawlURI, already processed as reported to StatisticsTracker     * @param disposition descriptive disposition string     *      */    public SeedRecord(CrawlURI curi, String disposition) {        super();        this.uri = curi.toString();        this.statusCode = curi.getFetchStatus();        this.disposition = disposition;        if (statusCode==301 || statusCode == 302) {            for (CandidateURI cauri: curi.getOutCandidates()) {                if("location:".equalsIgnoreCase(cauri.getViaContext().                		toString())) {                    redirectUri = cauri.toString();                }            }        }    }        /**     * Constructor for when a CrawlURI is unavailable; such     * as when considering seeds not yet passed through as     * CrawlURIs.      *      * @param uri     * @param disposition     */    public SeedRecord(String uri, String disposition) {    	this(uri, disposition, -1, null);    }    /**     * Create a record from the given URI, disposition, HTTP status code,     * and redirect URI.     * @param uri     * @param disposition     * @param statusCode     * @param redirectUri     */    public SeedRecord(String uri, String disposition, int statusCode,    		String redirectUri) {        super();        this.uri = uri;        this.statusCode = statusCode;        this.disposition = disposition;        this.redirectUri = redirectUri;            }    /**     * @return Returns the disposition.     */    public String getDisposition() {        return disposition;    }    /**     * @return Returns the redirectUri.     */    public String getRedirectUri() {        return redirectUri;    }    /**     * @return Returns the statusCode.     */    public int getStatusCode() {        return statusCode;    }    /**     * @return Returns the uri.     */    public String getUri() {        return uri;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -