Java Doc for FetchHTTP.java in  » Web-Crawler » heritrix » org » archive » crawler » fetcher » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Crawler » heritrix » org.archive.crawler.fetcher 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.archive.crawler.framework.Processor
   org.archive.crawler.fetcher.FetchHTTP

FetchHTTP
public class FetchHTTP extends Processor implements CoreAttributeConstants,FetchStatusCodes,CrawlStatusListener(Code)
HTTP fetcher that uses Apache Jakarta Commons HttpClient library.
author:
   Gordon Mohr
author:
   Igor Ranitovic
author:
   others
version:
   $Id: FetchHTTP.java 5093 2007-04-24 21:48:34Z gojomo $

Inner Class :class PostRestore implements Runnable

Field Summary
final public static  StringATTR_ACCEPT_HEADERS
    
final public static  StringATTR_BDB_COOKIES
    
final public static  StringATTR_DEFAULT_ENCODING
    
final public static  StringATTR_DIGEST_ALGORITHM
    
final public static  StringATTR_DIGEST_CONTENT
    
final public static  StringATTR_FETCH_BANDWIDTH_MAX
    
final public static  StringATTR_HTTP_PROXY_HOST
    
final public static  StringATTR_HTTP_PROXY_PORT
    
final public static  StringATTR_IGNORE_COOKIES
    
final public static  StringATTR_LOAD_COOKIES
    
final public static  StringATTR_LOCAL_ADDRESS
    
final public static  StringATTR_MAX_LENGTH_BYTES
    
final public static  StringATTR_MIDFETCH_DECIDE_RULES
     Rules to apply mid-fetch, just after receipt of the response headers before we start to download body.
final public static  StringATTR_SAVE_COOKIES
    
final public static  StringATTR_SEND_CONNECTION_CLOSE
    
final public static  StringATTR_SEND_IF_MODIFIED_SINCE
    
final public static  StringATTR_SEND_IF_NONE_MATCH
    
final public static  StringATTR_SEND_RANGE
    
final public static  StringATTR_SEND_REFERER
    
final public static  StringATTR_SOTIMEOUT_MS
    
final public static  StringATTR_TIMEOUT_SECONDS
    
final public static  StringATTR_TRUST
     SSL trust level setting attribute name.
final public static  StringCOOKIEDB_NAME
    
final public static  StringDEFAULT_DIGEST_ALGORITHM
     Default algorithm to use for message disgesting.
static  BooleanDEFAULT_DIGEST_CONTENT
     Default whether to perform on-the-fly digest hashing of content-bodies.
public static  String[]DIGEST_ALGORITHMS
    
final public static  StringHTTPS_SCHEME
    
final public static  StringHTTP_SCHEME
    
final public static  StringMD5
    
final public static  StringRANGE
    
final public static  StringRANGE_PREFIX
    
final public static  StringREFERER
    
final static  StringSERVER_CACHE_KEY
    
final public static  StringSHA1
     The different digest algorithms to choose between, SHA-1 or MD-5 at the moment.
final static  StringSSL_FACTORY_KEY
    
protected  DatabasecookieDb
    

Constructor Summary
public  FetchHTTP(String name)
     Constructor.

Method Summary
protected  voidaddResponseContent(HttpMethod method, CrawlURI curi)
     This method populates curi with response status and content type.
protected  booleancheckMidfetchAbort(CrawlURI curi, HttpRecorderMethod method, HttpConnection conn)
    
protected  voidcleanupHttp()
     Perform any final cleanup related to the HttpClient instance.
protected  voidconfigureHttp()
    
protected  HostConfigurationconfigureMethod(CrawlURI curi, HttpMethod method)
     Configure the HttpMethod setting options and headers.
public  voidcrawlCheckpoint(File checkpointDir)
    
public  voidcrawlEnded(String sExitMessage)
    
public  voidcrawlEnding(String sExitMessage)
    
public  voidcrawlPaused(String statusMessage)
    
public  voidcrawlPausing(String statusMessage)
    
public  voidcrawlResuming(String statusMessage)
    
public  voidcrawlStarted(String message)
    
protected  voiddoAbort(CrawlURI curi, HttpMethod method, String annotation)
    
public  voidfinalTasks()
    
protected  ObjectgetAttributeEither(CrawlURI curi, String key)
     Get a value either from inside the CrawlURI instance, or from settings (module attributes).
protected  AuthSchemegetAuthScheme(HttpMethod method, CrawlURI curi)
    
Parameters:
  method - Method that got a 401.
Parameters:
  curi - CrawlURI that got a 401.
protected  HttpClientgetHttp()
    
protected  DecideRulegetMidfetchRule(Object o)
    
protected  voidhandle401(HttpMethod method, CrawlURI curi)
     Server is looking for basic/digest auth credentials (RFC2617).
public  voidinitialTasks()
    
protected  voidinnerProcess(CrawlURI curi)
    
protected  voidlistUsedFiles(List<String> list)
    
public  voidloadCookies(String cookiesFile)
     Load cookies from a file before the first fetch.

The file is a text file in the Netscape's 'cookies.txt' file format.
Example entry of cookies.txt file:

www.archive.org FALSE / FALSE 1074567117 details-visit texts-cralond

Each line has 7 tab-separated fields:

  • 1.
  • public  voidloadCookies()
         Load cookies from the file specified in the order file.

    The file is a text file in the Netscape's 'cookies.txt' file format.
    Example entry of cookies.txt file:

    www.archive.org FALSE / FALSE 1074567117 details-visit texts-cralond

    Each line has 7 tab-separated fields:

  • 1.
  • public  Stringreport()
        
    public  voidsaveCookies()
         Saves cookies to the file specified in the order file.
    public  voidsaveCookies(String saveCookiesFile)
         Saves cookies to a file.
    protected  voidsetConditionalGetHeader(CrawlURI curi, HttpMethod method, String setting, String sourceHeader, String targetHeader)
         Set the given conditional-GET header, if the setting is enabled and a suitable value is available in the URI history.
    protected  voidsetSizes(CrawlURI curi, HttpRecorder rec)
        

    Field Detail
    ATTR_ACCEPT_HEADERS
    final public static String ATTR_ACCEPT_HEADERS(Code)



    ATTR_BDB_COOKIES
    final public static String ATTR_BDB_COOKIES(Code)



    ATTR_DEFAULT_ENCODING
    final public static String ATTR_DEFAULT_ENCODING(Code)



    ATTR_DIGEST_ALGORITHM
    final public static String ATTR_DIGEST_ALGORITHM(Code)



    ATTR_DIGEST_CONTENT
    final public static String ATTR_DIGEST_CONTENT(Code)



    ATTR_FETCH_BANDWIDTH_MAX
    final public static String ATTR_FETCH_BANDWIDTH_MAX(Code)



    ATTR_HTTP_PROXY_HOST
    final public static String ATTR_HTTP_PROXY_HOST(Code)



    ATTR_HTTP_PROXY_PORT
    final public static String ATTR_HTTP_PROXY_PORT(Code)



    ATTR_IGNORE_COOKIES
    final public static String ATTR_IGNORE_COOKIES(Code)



    ATTR_LOAD_COOKIES
    final public static String ATTR_LOAD_COOKIES(Code)



    ATTR_LOCAL_ADDRESS
    final public static String ATTR_LOCAL_ADDRESS(Code)



    ATTR_MAX_LENGTH_BYTES
    final public static String ATTR_MAX_LENGTH_BYTES(Code)



    ATTR_MIDFETCH_DECIDE_RULES
    final public static String ATTR_MIDFETCH_DECIDE_RULES(Code)
    Rules to apply mid-fetch, just after receipt of the response headers before we start to download body.



    ATTR_SAVE_COOKIES
    final public static String ATTR_SAVE_COOKIES(Code)



    ATTR_SEND_CONNECTION_CLOSE
    final public static String ATTR_SEND_CONNECTION_CLOSE(Code)



    ATTR_SEND_IF_MODIFIED_SINCE
    final public static String ATTR_SEND_IF_MODIFIED_SINCE(Code)



    ATTR_SEND_IF_NONE_MATCH
    final public static String ATTR_SEND_IF_NONE_MATCH(Code)



    ATTR_SEND_RANGE
    final public static String ATTR_SEND_RANGE(Code)



    ATTR_SEND_REFERER
    final public static String ATTR_SEND_REFERER(Code)



    ATTR_SOTIMEOUT_MS
    final public static String ATTR_SOTIMEOUT_MS(Code)



    ATTR_TIMEOUT_SECONDS
    final public static String ATTR_TIMEOUT_SECONDS(Code)



    ATTR_TRUST
    final public static String ATTR_TRUST(Code)
    SSL trust level setting attribute name.



    COOKIEDB_NAME
    final public static String COOKIEDB_NAME(Code)
    Name of cookie BDB Database



    DEFAULT_DIGEST_ALGORITHM
    final public static String DEFAULT_DIGEST_ALGORITHM(Code)
    Default algorithm to use for message disgesting.



    DEFAULT_DIGEST_CONTENT
    static Boolean DEFAULT_DIGEST_CONTENT(Code)
    Default whether to perform on-the-fly digest hashing of content-bodies.



    DIGEST_ALGORITHMS
    public static String[] DIGEST_ALGORITHMS(Code)



    HTTPS_SCHEME
    final public static String HTTPS_SCHEME(Code)



    HTTP_SCHEME
    final public static String HTTP_SCHEME(Code)



    MD5
    final public static String MD5(Code)



    RANGE
    final public static String RANGE(Code)



    RANGE_PREFIX
    final public static String RANGE_PREFIX(Code)



    REFERER
    final public static String REFERER(Code)



    SERVER_CACHE_KEY
    final static String SERVER_CACHE_KEY(Code)



    SHA1
    final public static String SHA1(Code)
    The different digest algorithms to choose between, SHA-1 or MD-5 at the moment.



    SSL_FACTORY_KEY
    final static String SSL_FACTORY_KEY(Code)



    cookieDb
    protected Database cookieDb(Code)
    Database backing cookie map, if using BDB




    Constructor Detail
    FetchHTTP
    public FetchHTTP(String name)(Code)
    Constructor.
    Parameters:
      name - Name of this processor.




    Method Detail
    addResponseContent
    protected void addResponseContent(HttpMethod method, CrawlURI curi)(Code)
    This method populates curi with response status and content type.
    Parameters:
      curi - CrawlURI to populate.
    Parameters:
      method - Method to get response status and headers from.



    checkMidfetchAbort
    protected boolean checkMidfetchAbort(CrawlURI curi, HttpRecorderMethod method, HttpConnection conn)(Code)



    cleanupHttp
    protected void cleanupHttp()(Code)
    Perform any final cleanup related to the HttpClient instance.



    configureHttp
    protected void configureHttp() throws RuntimeException(Code)



    configureMethod
    protected HostConfiguration configureMethod(CrawlURI curi, HttpMethod method)(Code)
    Configure the HttpMethod setting options and headers.
    Parameters:
      curi - CrawlURI from which we pull configuration.
    Parameters:
      method - The Method to configure.



    crawlCheckpoint
    public void crawlCheckpoint(File checkpointDir)(Code)



    crawlEnded
    public void crawlEnded(String sExitMessage)(Code)



    crawlEnding
    public void crawlEnding(String sExitMessage)(Code)



    crawlPaused
    public void crawlPaused(String statusMessage)(Code)



    crawlPausing
    public void crawlPausing(String statusMessage)(Code)



    crawlResuming
    public void crawlResuming(String statusMessage)(Code)



    crawlStarted
    public void crawlStarted(String message)(Code)



    doAbort
    protected void doAbort(CrawlURI curi, HttpMethod method, String annotation)(Code)



    finalTasks
    public void finalTasks()(Code)



    getAttributeEither
    protected Object getAttributeEither(CrawlURI curi, String key)(Code)
    Get a value either from inside the CrawlURI instance, or from settings (module attributes).
    Parameters:
      curi - CrawlURI to consult
    Parameters:
      key - key to lookup value from either CrawlURI (preferred) or settings



    getAuthScheme
    protected AuthScheme getAuthScheme(HttpMethod method, CrawlURI curi)(Code)

    Parameters:
      method - Method that got a 401.
    Parameters:
      curi - CrawlURI that got a 401. Returns first wholesome authscheme found else null.



    getHttp
    protected HttpClient getHttp()(Code)
    Returns the http instance.



    getMidfetchRule
    protected DecideRule getMidfetchRule(Object o)(Code)



    handle401
    protected void handle401(HttpMethod method, CrawlURI curi)(Code)
    Server is looking for basic/digest auth credentials (RFC2617). If we have any, put them into the CrawlURI and have it come around again. Presence of the credential serves as flag to frontier to requeue promptly. If we already tried this domain and still got a 401, then our credentials are bad. Remove them and let this curi die.
    Parameters:
      method - Method that got a 401.
    Parameters:
      curi - CrawlURI that got a 401.



    initialTasks
    public void initialTasks()(Code)



    innerProcess
    protected void innerProcess(CrawlURI curi) throws InterruptedException(Code)



    listUsedFiles
    protected void listUsedFiles(List<String> list)(Code)



    loadCookies
    public void loadCookies(String cookiesFile)(Code)
    Load cookies from a file before the first fetch.

    The file is a text file in the Netscape's 'cookies.txt' file format.
    Example entry of cookies.txt file:

    www.archive.org FALSE / FALSE 1074567117 details-visit texts-cralond

    Each line has 7 tab-separated fields:

  • 1. DOMAIN: The domain that created and have access to the cookie value.
  • 2. FLAG: A TRUE or FALSE value indicating if hosts within the given domain can access the cookie value.
  • 3. PATH: The path within the domain that the cookie value is valid for.
  • 4. SECURE: A TRUE or FALSE value indicating if to use a secure connection to access the cookie value.
  • 5. EXPIRATION: The expiration time of the cookie value (unix style.)
  • 6. NAME: The name of the cookie value
  • 7. VALUE: The cookie value
    Parameters:
      cookiesFile - file in the Netscape's 'cookies.txt' format.



  • loadCookies
    public void loadCookies()(Code)
    Load cookies from the file specified in the order file.

    The file is a text file in the Netscape's 'cookies.txt' file format.
    Example entry of cookies.txt file:

    www.archive.org FALSE / FALSE 1074567117 details-visit texts-cralond

    Each line has 7 tab-separated fields:

  • 1. DOMAIN: The domain that created and have access to the cookie value.
  • 2. FLAG: A TRUE or FALSE value indicating if hosts within the given domain can access the cookie value.
  • 3. PATH: The path within the domain that the cookie value is valid for.
  • 4. SECURE: A TRUE or FALSE value indicating if to use a secure connection to access the cookie value.
  • 5. EXPIRATION: The expiration time of the cookie value (unix style.)
  • 6. NAME: The name of the cookie value
  • 7. VALUE: The cookie value



  • report
    public String report()(Code)



    saveCookies
    public void saveCookies()(Code)
    Saves cookies to the file specified in the order file. Output file is in the Netscape 'cookies.txt' format.



    saveCookies
    public void saveCookies(String saveCookiesFile)(Code)
    Saves cookies to a file. Output file is in the Netscape 'cookies.txt' format.
    Parameters:
      saveCookiesFile - output file.



    setConditionalGetHeader
    protected void setConditionalGetHeader(CrawlURI curi, HttpMethod method, String setting, String sourceHeader, String targetHeader)(Code)
    Set the given conditional-GET header, if the setting is enabled and a suitable value is available in the URI history.
    Parameters:
      curi - source CrawlURI
    Parameters:
      method - HTTP operation pending
    Parameters:
      setting - true/false enablement setting name to consult
    Parameters:
      sourceHeader - header to consult in URI history
    Parameters:
      targetHeader - header to set if possible



    setSizes
    protected void setSizes(CrawlURI curi, HttpRecorder rec)(Code)
    Update CrawlURI internal sizes based on current transaction (and in the case of 304s, history)
    Parameters:
      curi - CrawlURI
    Parameters:
      rec - HttpRecorder



    Fields inherited from org.archive.crawler.framework.Processor
    final public static String ATTR_DECIDE_RULES(Code)(Java Doc)
    final public static String ATTR_ENABLED(Code)(Java Doc)
    protected String attrDecideRules(Code)(Java Doc)

    Methods inherited from org.archive.crawler.framework.Processor
    protected void checkForInterrupt() throws InterruptedException(Code)(Java Doc)
    protected void finalTasks()(Code)(Java Doc)
    public CrawlController getController()(Code)(Java Doc)
    protected DecideRule getDecideRule(Object o)(Code)(Java Doc)
    public Processor getDefaultNextProcessor(CrawlURI curi)(Code)(Java Doc)
    protected void initialTasks()(Code)(Java Doc)
    protected void innerProcess(CrawlURI curi) throws InterruptedException(Code)(Java Doc)
    protected void innerRejectProcess(CrawlURI curi) throws InterruptedException(Code)(Java Doc)
    protected boolean isContentToProcess(CrawlURI curi)(Code)(Java Doc)
    protected boolean isExpectedMimeType(String contentType, String expectedPrefix)(Code)(Java Doc)
    protected boolean isHttpTransactionContentToProcess(CrawlURI curi)(Code)(Java Doc)
    public void kickUpdate()(Code)(Java Doc)
    final public void process(CrawlURI curi) throws InterruptedException(Code)(Java Doc)
    public String report()(Code)(Java Doc)
    protected boolean rulesAccept(Object o)(Code)(Java Doc)
    protected boolean rulesAccept(DecideRule rule, Object o)(Code)(Java Doc)
    public void setDefaultNextProcessor(Processor nextProcessor)(Code)(Java Doc)
    public Processor spawn(int serialNum)(Code)(Java Doc)

    www.java2java.com | Contact Us
    Copyright 2009 - 12 Demo Source and Support. All rights reserved.
    All other trademarks are property of their respective owners.