com.meterware.httpunit
Class WebRequestSource

java.lang.Object
  extended bycom.meterware.httpunit.ParameterHolder
      extended bycom.meterware.httpunit.WebRequestSource
All Implemented Interfaces:
HTMLElement
Direct Known Subclasses:
com.meterware.httpunit.FixedURLWebRequestSource, WebForm

public abstract class WebRequestSource
extends com.meterware.httpunit.ParameterHolder
implements HTMLElement

Base class for objects which can be clicked to generate new web requests.

Author:
Russell Gold

Method Summary
protected abstract  void addPresetParameter(java.lang.String name, java.lang.String value)
          Records a parameter defined by including it in the destination URL.
 java.lang.String getAttribute(java.lang.String name)
          Returns the value of the attribute of this element with the specified name.
protected  WebResponse getBaseResponse()
          Returns the web response containing this request source.
protected  java.net.URL getBaseURL()
           
 java.lang.String getClassName()
          Returns the class associated with this request source.
protected  WebResponse getCurrentFrameContents()
           
protected  java.lang.String getDestination()
           
 org.w3c.dom.Node getDOMSubtree()
          Returns a copy of the domain object model subtree associated with this entity.
protected abstract  java.lang.String getEmptyParameterValue()
           
 java.lang.String getFragmentIdentifier()
          Returns the fragment identifier for this request source, used to identifier an element within an HTML document.
 FrameSelector getFrame()
          Returns the frame containing this request source.
protected  HTMLPage getHTMLPage()
          Returns the HTMLPage associated with this request source.
 java.lang.String getID()
          Returns the ID associated with this request source.
 java.lang.String getName()
          Returns the name associated with this request source.
protected  org.w3c.dom.Node getNode()
          Returns the actual DOM for this request source, not a copy.
 java.lang.String getPageFrame()
          Deprecated. as of 1.6, use #getFrame
abstract  java.lang.String[] getParameterNames()
          Returns an array containing the names of any parameters to be sent on a request based on this request source.
abstract  java.lang.String[] getParameterValues(java.lang.String name)
          Returns the values of the named parameter.
protected  java.lang.String getRelativeURL()
           
abstract  WebRequest getRequest()
          Creates and returns a web request from this request source.
 java.lang.String getTagName()
          Returns the tag name of this node.
 java.lang.String getTarget()
          Returns the target for this request source.
 java.lang.String getText()
          Returns the text value of this block.
 java.lang.String getTitle()
          Returns the title associated with this request source.
 boolean isSupportedAttribute(java.lang.String name)
          Returns true if this element may have an attribute with the specified name.
protected  void loadDestinationParameters()
          Extracts any parameters specified as part of the destination URL, calling addPresetParameter for each one in the order in which they are found.
protected  void setDestination(java.lang.String destination)
           
protected  void setTargetAttribute(java.lang.String value)
           
protected  WebResponse submitRequest(java.lang.String event, WebRequest request)
           
protected  WebResponse submitRequest(WebRequest request)
          Submits a request to the web client from which this request source was originally obtained.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.meterware.httpunit.HTMLElement
getScriptableDelegate
 

Method Detail

getID

public java.lang.String getID()
Returns the ID associated with this request source.

Specified by:
getID in interface HTMLElement

getClassName

public java.lang.String getClassName()
Returns the class associated with this request source.

Specified by:
getClassName in interface HTMLElement

getName

public java.lang.String getName()
Returns the name associated with this request source.

Specified by:
getName in interface HTMLElement

getTitle

public java.lang.String getTitle()
Returns the title associated with this request source.

Specified by:
getTitle in interface HTMLElement

getTarget

public java.lang.String getTarget()
Returns the target for this request source.


getPageFrame

public java.lang.String getPageFrame()
Deprecated. as of 1.6, use #getFrame

Returns the name of the frame containing this request source.


getFrame

public FrameSelector getFrame()
Returns the frame containing this request source.


getFragmentIdentifier

public java.lang.String getFragmentIdentifier()
Returns the fragment identifier for this request source, used to identifier an element within an HTML document.


getDOMSubtree

public org.w3c.dom.Node getDOMSubtree()
Returns a copy of the domain object model subtree associated with this entity.


getRequest

public abstract WebRequest getRequest()
Creates and returns a web request from this request source.


getParameterNames

public abstract java.lang.String[] getParameterNames()
Returns an array containing the names of any parameters to be sent on a request based on this request source.


getParameterValues

public abstract java.lang.String[] getParameterValues(java.lang.String name)
Returns the values of the named parameter.


getRelativeURL

protected java.lang.String getRelativeURL()

getBaseURL

protected java.net.URL getBaseURL()

getDestination

protected java.lang.String getDestination()

setDestination

protected void setDestination(java.lang.String destination)

getNode

protected org.w3c.dom.Node getNode()
Returns the actual DOM for this request source, not a copy.


getHTMLPage

protected HTMLPage getHTMLPage()
                        throws org.xml.sax.SAXException
Returns the HTMLPage associated with this request source.

Throws:
org.xml.sax.SAXException

loadDestinationParameters

protected final void loadDestinationParameters()
Extracts any parameters specified as part of the destination URL, calling addPresetParameter for each one in the order in which they are found.


submitRequest

protected WebResponse submitRequest(java.lang.String event,
                                    WebRequest request)
                             throws java.io.IOException,
                                    org.xml.sax.SAXException
Throws:
java.io.IOException
org.xml.sax.SAXException

getCurrentFrameContents

protected WebResponse getCurrentFrameContents()

submitRequest

protected final WebResponse submitRequest(WebRequest request)
                                   throws java.io.IOException,
                                          org.xml.sax.SAXException
Submits a request to the web client from which this request source was originally obtained.

Throws:
java.io.IOException
org.xml.sax.SAXException

getBaseResponse

protected final WebResponse getBaseResponse()
Returns the web response containing this request source.


addPresetParameter

protected abstract void addPresetParameter(java.lang.String name,
                                           java.lang.String value)
Records a parameter defined by including it in the destination URL. The value can be null, if the parameter name was not specified with an equals sign.


getAttribute

public java.lang.String getAttribute(java.lang.String name)
Description copied from interface: HTMLElement
Returns the value of the attribute of this element with the specified name. Returns the empty string if no such attribute exists.

Specified by:
getAttribute in interface HTMLElement

isSupportedAttribute

public boolean isSupportedAttribute(java.lang.String name)
Description copied from interface: HTMLElement
Returns true if this element may have an attribute with the specified name.

Specified by:
isSupportedAttribute in interface HTMLElement

getText

public java.lang.String getText()
Returns the text value of this block.

Specified by:
getText in interface HTMLElement

getTagName

public java.lang.String getTagName()
Description copied from interface: HTMLElement
Returns the tag name of this node.

Specified by:
getTagName in interface HTMLElement

setTargetAttribute

protected void setTargetAttribute(java.lang.String value)

getEmptyParameterValue

protected abstract java.lang.String getEmptyParameterValue()

Copyright © 2000-2006 Russell Gold. See license agreement for rights granted.