Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.meterware.httpunit
Class WebWindow  view WebWindow download WebWindow.java

java.lang.Object
  extended bycom.meterware.httpunit.WebWindow

public class WebWindow
extends java.lang.Object

A window managed by a WebClient.


Field Summary
private  WebClient _client
          The client which created this window.
private  boolean _closed
          True if this window has been closed.
private  FrameHolder _frameContents
          A map of frame names to current contents.
private  java.lang.String _name
          The name of the window, set via JavaScript.
private  WebResponse _opener
          The web response containing the reference that opened this window
(package private) static java.lang.String NO_NAME
           
 
Constructor Summary
(package private) WebWindow(WebClient client)
           
(package private) WebWindow(WebClient client, WebResponse opener)
           
 
Method Summary
 void close()
          Closes this window.
private  void delay(int numMilliseconds)
          Delays the specified amount of time.
 WebClient getClient()
          Returns the web client associated with this window.
 WebResponse getCurrentPage()
          Returns the response representing the main page in this window.
(package private)  FrameSelector getFrame(java.lang.String target)
           
(package private)  WebResponse getFrameContents(FrameSelector targetFrame)
          Returns the response associated with the specified frame target.
 WebResponse getFrameContents(java.lang.String frameName)
          Returns the response associated with the specified frame name.
 java.lang.String[] getFrameNames()
          Returns the name of the currently active frames.
 java.lang.String getName()
          Returns the name of this window.
 WebResponse getOpener()
          Returns the web response that contained the script which opened this window.
(package private)  WebResponse getParentFrameContents(FrameSelector frame)
           
 WebResponse getResource(WebRequest request)
          Returns the resource specified by the request.
 WebResponse getResponse(java.lang.String urlString)
          Submits a GET method request and returns a response.
 WebResponse getResponse(WebRequest request)
          Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.
(package private)  WebResponse getSubframeContents(FrameSelector frame, java.lang.String subFrameName)
           
(package private)  WebResponse getSubframeResponse(WebRequest request, RequestContext requestContext)
           
(package private)  FrameSelector getTopFrame()
           
(package private)  boolean hasFrame(FrameSelector frame)
           
 boolean hasFrame(java.lang.String frameName)
          Returns true if the specified frame name is defined in this window.
 boolean isClosed()
          Returns true if this window has been closed.
 WebResponse sendRequest(WebRequest request)
          Submits a web request and returns a response.
(package private)  void setName(java.lang.String name)
           
private  boolean shouldFollowRedirect(WebResponse response)
           
(package private)  void updateFrameContents(WebResponse response, RequestContext requestContext)
           
(package private)  WebResponse updateWindow(java.lang.String requestTarget, WebResponse response, RequestContext requestContext)
          Updates this web client based on a received response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_client

private WebClient _client
The client which created this window.


_frameContents

private FrameHolder _frameContents
A map of frame names to current contents.


_name

private java.lang.String _name
The name of the window, set via JavaScript.


_opener

private WebResponse _opener
The web response containing the reference that opened this window


_closed

private boolean _closed
True if this window has been closed.


NO_NAME

static final java.lang.String NO_NAME
See Also:
Constant Field Values
Constructor Detail

WebWindow

WebWindow(WebClient client)

WebWindow

WebWindow(WebClient client,
          WebResponse opener)
Method Detail

getClient

public WebClient getClient()
Returns the web client associated with this window.


isClosed

public boolean isClosed()
Returns true if this window has been closed.


close

public void close()
Closes this window.


getName

public java.lang.String getName()
Returns the name of this window. Windows created through normal HTML or browser commands have empty names, but JavaScript can set the name. A name may be used as a target for a request.


getOpener

public WebResponse getOpener()
Returns the web response that contained the script which opened this window.


getResponse

public WebResponse getResponse(java.lang.String urlString)
                        throws java.net.MalformedURLException,
                               java.io.IOException,
                               org.xml.sax.SAXException
Submits a GET method request and returns a response.


sendRequest

public WebResponse sendRequest(WebRequest request)
                        throws java.net.MalformedURLException,
                               java.io.IOException,
                               org.xml.sax.SAXException
Submits a web request and returns a response. This is an alternate name for the getResponse method.


getResponse

public WebResponse getResponse(WebRequest request)
                        throws java.net.MalformedURLException,
                               java.io.IOException,
                               org.xml.sax.SAXException
Submits a web request and returns a response, using all state developed so far as stored in cookies as requested by the server.


getSubframeResponse

WebResponse getSubframeResponse(WebRequest request,
                                RequestContext requestContext)
                          throws java.io.IOException,
                                 org.xml.sax.SAXException

updateWindow

WebResponse updateWindow(java.lang.String requestTarget,
                         WebResponse response,
                         RequestContext requestContext)
                   throws java.net.MalformedURLException,
                          java.io.IOException,
                          org.xml.sax.SAXException
Updates this web client based on a received response. This includes updating cookies and frames.


getResource

public WebResponse getResource(WebRequest request)
                        throws java.io.IOException
Returns the resource specified by the request. Does not update the window or load included framesets. May return null if the resource is a JavaScript URL which would normally leave the client unchanged.


getFrameNames

public java.lang.String[] getFrameNames()
Returns the name of the currently active frames.


hasFrame

public boolean hasFrame(java.lang.String frameName)
Returns true if the specified frame name is defined in this window.


hasFrame

boolean hasFrame(FrameSelector frame)

getFrameContents

public WebResponse getFrameContents(java.lang.String frameName)
Returns the response associated with the specified frame name. Throws a runtime exception if no matching frame is defined.


getFrameContents

WebResponse getFrameContents(FrameSelector targetFrame)
Returns the response associated with the specified frame target. Throws a runtime exception if no matching frame is defined.


getSubframeContents

WebResponse getSubframeContents(FrameSelector frame,
                                java.lang.String subFrameName)

getParentFrameContents

WebResponse getParentFrameContents(FrameSelector frame)

getCurrentPage

public WebResponse getCurrentPage()
Returns the response representing the main page in this window.


updateFrameContents

void updateFrameContents(WebResponse response,
                         RequestContext requestContext)
                   throws java.io.IOException,
                          org.xml.sax.SAXException

setName

void setName(java.lang.String name)

delay

private void delay(int numMilliseconds)
Delays the specified amount of time.


shouldFollowRedirect

private boolean shouldFollowRedirect(WebResponse response)

getTopFrame

FrameSelector getTopFrame()

getFrame

FrameSelector getFrame(java.lang.String target)