Quadcap Embeddable Server

com.quadcap.http.client.LinkChecker Class Reference

Inheritance diagram for com.quadcap.http.client.LinkChecker:

DocumentHandler List of all members.

Detailed Description

This class implements a simple link checker, following links in the following tags:.

Definition at line 82 of file LinkChecker.java.

Public Member Functions

 LinkChecker (String url)
void printBadLinks ()
void run () throws Exception
void setBase (String base)
void startDocument ()
void endDocument ()
void ignorableWhitespace (char[] ch, int off, int cnt) throws SAXException
void processingInstruction (String target, String data)
void characters (char[] ch, int off, int len) throws SAXException
void endElement (String tag) throws SAXException
void checkHref (String href, int line)

Package Functions

synchronized void push (String url, int line)
String trim (String url)

Static Package Functions

String parent (String s)

Package Attributes

String base
 uri of the document we're currently fetching and parsing

String urlBase
 base uri of the current document for relative href resolution

String currentUrl
 uri of the document we're currently fetching and parsing

DiGraph links = new DiGraph()
 directed graph of all links found so far (even bad ones...)

ArrayQueue linksToCheck = new ArrayQueue()
 queue of links to check

HashMap allLinks = new HashMap()
 uri -> status for all links

HashMap linksChecked = new HashMap()
 uri -> status for completed links

Parser parser
String host


Constructor & Destructor Documentation

com.quadcap.http.client.LinkChecker.LinkChecker String  url  ) 
 

Definition at line 107 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.host, com.quadcap.http.client.LinkChecker.parser, and com.quadcap.http.client.LinkChecker.push().


Member Function Documentation

void com.quadcap.http.client.LinkChecker.characters char[]  ch,
int  off,
int  len
 

Definition at line 267 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.characters().

Referenced by com.quadcap.http.client.LinkChecker.characters(), and com.quadcap.http.client.LinkChecker.ignorableWhitespace().

void com.quadcap.http.client.LinkChecker.checkHref String  href,
int  line
 

Definition at line 273 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.checkHref(), com.quadcap.http.client.LinkChecker.parent(), and com.quadcap.http.client.LinkChecker.urlBase.

Referenced by com.quadcap.http.client.LinkChecker.checkHref(), and com.quadcap.http.client.LinkChecker.startElement().

void com.quadcap.http.client.LinkChecker.endDocument  ) 
 

Definition at line 231 of file LinkChecker.java.

void com.quadcap.http.client.LinkChecker.endElement String  tag  ) 
 

Definition at line 270 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.endElement().

Referenced by com.quadcap.http.client.LinkChecker.endElement().

void com.quadcap.http.client.LinkChecker.ignorableWhitespace char[]  ch,
int  off,
int  cnt
 

Definition at line 234 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.characters(), and com.quadcap.http.client.LinkChecker.ignorableWhitespace().

Referenced by com.quadcap.http.client.LinkChecker.ignorableWhitespace().

String com.quadcap.http.client.LinkChecker.parent String  s  )  [static, package]
 

Definition at line 303 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.parent().

Referenced by com.quadcap.http.client.LinkChecker.checkHref(), com.quadcap.http.client.LinkChecker.parent(), and com.quadcap.http.client.LinkChecker.setBase().

void com.quadcap.http.client.LinkChecker.printBadLinks  ) 
 

Definition at line 137 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.links, and com.quadcap.http.client.LinkChecker.linksChecked.

Referenced by com.quadcap.http.client.HttpFetcher.check().

void com.quadcap.http.client.LinkChecker.processingInstruction String  target,
String  data
 

Definition at line 240 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.processingInstruction().

Referenced by com.quadcap.http.client.LinkChecker.processingInstruction().

synchronized void com.quadcap.http.client.LinkChecker.push String  url,
int  line
[package]
 

Definition at line 119 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.allLinks, com.quadcap.http.client.LinkChecker.base, com.quadcap.http.client.LinkChecker.currentUrl, com.quadcap.http.client.LinkChecker.host, com.quadcap.http.client.LinkChecker.links, com.quadcap.http.client.LinkChecker.linksToCheck, com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.trim().

Referenced by com.quadcap.http.client.LinkChecker.LinkChecker(), and com.quadcap.http.client.LinkChecker.push().

void com.quadcap.http.client.LinkChecker.run  )  throws Exception
 

Definition at line 158 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.allLinks, com.quadcap.http.client.LinkChecker.currentUrl, com.quadcap.http.client.LinkChecker.links, com.quadcap.http.client.LinkChecker.linksChecked, com.quadcap.http.client.LinkChecker.linksToCheck, com.quadcap.http.client.LinkChecker.parser, com.quadcap.util.text.Scanner.parseUntil(), com.quadcap.http.client.LinkChecker.setBase(), org.xml.sax.InputSource.setSystemId(), com.quadcap.util.text.Scanner.skipUntil(), and com.quadcap.util.text.Scanner.skipWhile().

Referenced by com.quadcap.http.client.HttpFetcher.check().

void com.quadcap.http.client.LinkChecker.setBase String  base  ) 
 

Definition at line 222 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.parent(), com.quadcap.http.client.LinkChecker.setBase(), and com.quadcap.http.client.LinkChecker.urlBase.

Referenced by com.quadcap.http.client.LinkChecker.run(), and com.quadcap.http.client.LinkChecker.setBase().

void com.quadcap.http.client.LinkChecker.setDocumentLocator locator  ) 
 

Definition at line 243 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.setDocumentLocator().

Referenced by com.quadcap.http.client.LinkChecker.setDocumentLocator().

void com.quadcap.http.client.LinkChecker.startDocument  ) 
 

Definition at line 228 of file LinkChecker.java.

void com.quadcap.http.client.LinkChecker.startElement String  tag,
attrs
 

Definition at line 246 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.checkHref(), com.quadcap.http.client.LinkChecker.parser, com.quadcap.http.client.LinkChecker.startElement(), and com.quadcap.http.client.LinkChecker.urlBase.

Referenced by com.quadcap.http.client.LinkChecker.startElement().

String com.quadcap.http.client.LinkChecker.trim String  url  )  [package]
 

Definition at line 130 of file LinkChecker.java.

References com.quadcap.http.client.LinkChecker.host, and com.quadcap.http.client.LinkChecker.trim().

Referenced by com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.trim().


Member Data Documentation

HashMap com.quadcap.http.client.LinkChecker.allLinks = new HashMap() [package]
 

uri -> status for all links

Definition at line 99 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.run().

String com.quadcap.http.client.LinkChecker.base [package]
 

uri of the document we're currently fetching and parsing

Definition at line 84 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.push().

String com.quadcap.http.client.LinkChecker.currentUrl [package]
 

uri of the document we're currently fetching and parsing

Definition at line 90 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.run().

String com.quadcap.http.client.LinkChecker.host [package]
 

Definition at line 105 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.LinkChecker(), com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.trim().

DiGraph com.quadcap.http.client.LinkChecker.links = new DiGraph() [package]
 

directed graph of all links found so far (even bad ones...)

Definition at line 93 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.printBadLinks(), com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.run().

HashMap com.quadcap.http.client.LinkChecker.linksChecked = new HashMap() [package]
 

uri -> status for completed links

Definition at line 102 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.printBadLinks(), and com.quadcap.http.client.LinkChecker.run().

ArrayQueue com.quadcap.http.client.LinkChecker.linksToCheck = new ArrayQueue() [package]
 

queue of links to check

Definition at line 96 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.push(), and com.quadcap.http.client.LinkChecker.run().

Parser com.quadcap.http.client.LinkChecker.parser [package]
 

Definition at line 104 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.LinkChecker(), com.quadcap.http.client.LinkChecker.run(), and com.quadcap.http.client.LinkChecker.startElement().

String com.quadcap.http.client.LinkChecker.urlBase [package]
 

base uri of the current document for relative href resolution

Definition at line 87 of file LinkChecker.java.

Referenced by com.quadcap.http.client.LinkChecker.checkHref(), com.quadcap.http.client.LinkChecker.setBase(), and com.quadcap.http.client.LinkChecker.startElement().