FileDocCategorySizeDatePackage
IndexLink.javaAPI DocExample2365Mon Feb 23 21:29:56 GMT 2004com.develop.ss

IndexLink

public class IndexLink extends Object

Fields Summary
private com.meterware.httpunit.WebConversation
conversation
private IndexLinks
suite
private String
name
static Logger
log
Constructors Summary
public IndexLink(String name, com.meterware.httpunit.WebConversation conversation, IndexLinks suite)



         
    this.name = name;
    if ((name == null) || (conversation == null) || (suite == null)) {
      throw new IllegalArgumentException("LinkTest constructor requires non-null args");
    }
    this.conversation = conversation;
    this.suite = suite;
  
Methods Summary
private voidaddToIndex(com.meterware.httpunit.WebResponse response)

    Document d = new Document();
    HTMLParser parser = new HTMLParser(response.getInputStream());
    d.add(Field.UnIndexed("url", response.getURL().toExternalForm()));
    d.add(Field.UnIndexed("summary", parser.getSummary()));
    d.add(Field.Text("title", parser.getTitle()));
    d.add(Field.Text("contents", parser.getReader()));
    suite.addToIndex(d);
  
public voidcheckLink()

    WebResponse response = null;
    try {
      response = conversation.getResponse(this.name);
    } catch (HttpNotFoundException hnfe) {
      //this.log("HTTP " + hnfe.getResponseCode() + " " + this.name);
    }
    if (!isIndexable(response)) {
      return;
    }
    addToIndex(response);
    WebLink[] links = response.getLinks();
    for (int i = 0; i < links.length; i++) {
      WebLink link = links[i];
      suite.considerNewLink(this.name, link);
    }

  
private booleanisIndexable(com.meterware.httpunit.WebResponse response)

    return response.getContentType().equals("text/html") || response.getContentType().equals("text/ascii");