ca.intelliware.amakihi.actor.http
Class VirtualBrowser

java.lang.Object
  |
  +--ca.intelliware.amakihi.actor.http.VirtualBrowser
All Implemented Interfaces:
Browser

public class VirtualBrowser
extends java.lang.Object
implements Browser

This class acts like a browser of web content.

Version:
$Revision: 1.10 $
Author:
Intelliware Development

Constructor Summary
VirtualBrowser()
           
VirtualBrowser(HttpClient client)
           
 
Method Summary
 void addHeader(java.lang.String name, java.lang.String value)
           
protected  NameValuePair createCookieHeader(java.net.URL url)
           
protected  Anchor findAnchor(org.w3c.dom.Element input)
          Find the anchor element that corresponds to the input anchor.
protected  Form findForm(org.w3c.dom.Element input)
           
 int followLink(org.w3c.dom.Element element)
           
protected  int followLink(java.net.URL url, java.lang.String referrer)
           
protected  int get(java.lang.String urlAsString)
           
 boolean getCoarseGrainedPerformanceMeasure()
           
 Window getCurrentWindow()
           
 boolean getDownloadResources()
          Gets a flag indicating whether or not the external resources should be downloaded.
protected  NameValuePair[] getHeaders(java.net.URL url, NameValuePair[] pairs)
          Generate HTTP headers.
 java.lang.String getTagName()
          Gets the tagName
protected static ca.intelliware.amakihi.actor.http.VirtualBrowser.Result isMatchOnAttributes(org.w3c.dom.Element inputElement, org.w3c.dom.Element potentialMatch, java.lang.String attributeName)
           
 int open(java.lang.String urlAsString)
           
protected  int processResponse(java.net.URL url, Response response)
           
protected  void removeWindow(Window window)
           
protected  void saveCookies(java.net.URL url, Response response)
           
protected  Response send(java.net.URL url, Request.Method method, NameValuePair[] parameters, NameValuePair[] additionalHeaders)
           
 void setCoarseGrainedPerformanceMeasure(boolean coarse)
           
 void setDownloadResources(boolean downloadResources)
          Sets the downloadResources
 void setTagName(java.lang.String tagName)
           
 int submitForm(org.w3c.dom.Element element)
           
protected  int submitForm(Form form, org.w3c.dom.Element element)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VirtualBrowser

public VirtualBrowser()

VirtualBrowser

public VirtualBrowser(HttpClient client)
Method Detail

findForm

protected Form findForm(org.w3c.dom.Element input)
                 throws org.xml.sax.SAXException,
                        java.io.IOException

findAnchor

protected Anchor findAnchor(org.w3c.dom.Element input)
                     throws java.io.IOException,
                            org.xml.sax.SAXException

Find the anchor element that corresponds to the input anchor.


submitForm

public int submitForm(org.w3c.dom.Element element)
               throws java.io.IOException,
                      org.xml.sax.SAXException
Specified by:
submitForm in interface Browser

submitForm

protected int submitForm(Form form,
                         org.w3c.dom.Element element)
                  throws java.io.IOException

followLink

public int followLink(org.w3c.dom.Element element)
               throws java.io.IOException,
                      org.xml.sax.SAXException
Specified by:
followLink in interface Browser

followLink

protected int followLink(java.net.URL url,
                         java.lang.String referrer)
                  throws java.io.IOException

isMatchOnAttributes

protected static ca.intelliware.amakihi.actor.http.VirtualBrowser.Result isMatchOnAttributes(org.w3c.dom.Element inputElement,
                                                                                             org.w3c.dom.Element potentialMatch,
                                                                                             java.lang.String attributeName)

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Specified by:
addHeader in interface Browser

open

public int open(java.lang.String urlAsString)
         throws java.io.IOException
Specified by:
open in interface Browser

get

protected int get(java.lang.String urlAsString)
           throws java.io.IOException

processResponse

protected int processResponse(java.net.URL url,
                              Response response)
                       throws java.io.IOException

send

protected Response send(java.net.URL url,
                        Request.Method method,
                        NameValuePair[] parameters,
                        NameValuePair[] additionalHeaders)
                 throws java.io.IOException

saveCookies

protected void saveCookies(java.net.URL url,
                           Response response)

getHeaders

protected NameValuePair[] getHeaders(java.net.URL url,
                                     NameValuePair[] pairs)

Generate HTTP headers.


createCookieHeader

protected NameValuePair createCookieHeader(java.net.URL url)

setTagName

public void setTagName(java.lang.String tagName)
Specified by:
setTagName in interface Browser
See Also:
Browser.setTagName(String)

getTagName

public java.lang.String getTagName()
Gets the tagName
Returns:
Returns a String

getDownloadResources

public boolean getDownloadResources()
Gets a flag indicating whether or not the external resources should be downloaded.
Returns:
Returns a boolean

setDownloadResources

public void setDownloadResources(boolean downloadResources)
Sets the downloadResources
Parameters:
downloadResources - The downloadResources to set

removeWindow

protected void removeWindow(Window window)

getCurrentWindow

public Window getCurrentWindow()
Specified by:
getCurrentWindow in interface Browser

setCoarseGrainedPerformanceMeasure

public void setCoarseGrainedPerformanceMeasure(boolean coarse)

getCoarseGrainedPerformanceMeasure

public boolean getCoarseGrainedPerformanceMeasure()


Copyright 2002 Intelliware Development. All Rights Reserved.