Class WebRequestSource

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected abstract void addPresetParameter​(java.lang.String name, java.lang.String value)
      Records a parameter defined by including it in the destination URL.
      boolean doEvent​(java.lang.String eventScript)
      Deprecated.
      since 1.7 - use doEventScript instead
      boolean doEventScript​(java.lang.String eventScript)
      optional do the event if it's defined
      java.lang.String getAttribute​(java.lang.String name)
      get the attribute value for the given 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 org.w3c.dom.Element getElement()
      Returns the actual DOM for this request source, not a copy.
      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.
      org.w3c.dom.Node getNode()
      Returns the DOM node underlying this element.
      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.
      ScriptableDelegate getParentDelegate()
      Returns the scriptable delegate which can provide the scriptable delegate for this element.
      protected java.lang.String getRelativeURL()
      get the relative URL for a weblink change spaces to %20
      abstract WebRequest getRequest()
      Creates and returns a web request from this request source.
      ScriptingHandler getScriptingHandler()
      Returns the scriptable delegate.
      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 handleEvent​(java.lang.String eventName)
      handle the event with the given name by getting the attribute and then executing the eventScript for it
      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.
      void removeAttribute​(java.lang.String name)
      remove the given attribute
      void setAttribute​(java.lang.String name, java.lang.Object value)
      set the attribute with the given name to the given value
      protected void setDestination​(java.lang.String destination)  
      protected void setTargetAttribute​(java.lang.String value)  
      protected WebResponse submitRequest​(WebRequest request)
      Submits a request to the web client from which this request source was originally obtained.
      protected WebResponse submitRequest​(java.lang.String event, WebRequest request)
      submit the given event for the given request
      • 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.protocol.ParameterCollection

        recordParameters
    • 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()
        get the relative URL for a weblink change spaces to %20
        Returns:
        the relative URL as a string
      • getBaseURL

        protected java.net.URL getBaseURL()
      • getDestination

        protected java.lang.String getDestination()
      • setDestination

        protected void setDestination​(java.lang.String destination)
      • getElement

        protected org.w3c.dom.Element getElement()
        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
        submit the given event for the given request
        Parameters:
        event -
        request -
        Returns:
        the response for the submitted Request
        Throws:
        java.io.IOException
        org.xml.sax.SAXException
      • doEvent

        public boolean doEvent​(java.lang.String eventScript)
        Deprecated.
        since 1.7 - use doEventScript instead
        handle the event that has the given script attached by compiling the eventScript as a function and executing it
        Specified by:
        doEvent in interface ScriptingEventHandler
        Parameters:
        eventScript - - the script to use
        Returns:
        true if the script is empty or the result of the script
      • doEventScript

        public boolean doEventScript​(java.lang.String eventScript)
        optional do the event if it's defined
        Specified by:
        doEventScript in interface ScriptingEventHandler
        Parameters:
        eventScript - - the script to handle
        Returns:
        whether the script was handled
      • handleEvent

        public boolean handleEvent​(java.lang.String eventName)
        Description copied from interface: ScriptingEventHandler
        handle the event with the given name by getting the attribute and then executing the eventScript for it
        Specified by:
        handleEvent in interface ScriptingEventHandler
        Returns:
        the result of doEventScript
      • 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)
        get the attribute value for the given name
        Specified by:
        getAttribute in interface HTMLElement
        Parameters:
        name - - the name of the attribute to get
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value)
        set the attribute with the given name to the given value
        Specified by:
        setAttribute in interface HTMLElement
        Parameters:
        name - - the name of the attribute
        value - - the value to use
      • removeAttribute

        public void removeAttribute​(java.lang.String name)
        remove the given attribute
        Specified by:
        removeAttribute in interface HTMLElement
        Parameters:
        name - - the name of the attribute to remove
      • 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
      • getNode

        public org.w3c.dom.Node getNode()
        Description copied from interface: HTMLElement
        Returns the DOM node underlying this element.
        Specified by:
        getNode 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()