[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit FrameHolder.java,1.1,1.2 HTMLPage.java,1.
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-01 14:59:03
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv9683/src/com/meterware/httpunit Modified Files: FrameHolder.java HTMLPage.java HttpWebResponse.java ParsedHTML.java TableCell.java WebClient.java WebConversation.java WebForm.java WebFrame.java WebLink.java WebRequestSource.java WebResponse.java WebTable.java Log Message: Support link.click and form.submit Index: FrameHolder.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FrameHolder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- FrameHolder.java 14 Feb 2002 14:33:49 -0000 1.1 +++ FrameHolder.java 1 Aug 2002 14:58:59 -0000 1.2 @@ -19,18 +19,80 @@ * DEALINGS IN THE SOFTWARE. * *******************************************************************************************************************/ +import java.io.IOException; +import java.net.MalformedURLException; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Vector; +import java.util.List; +import java.util.ArrayList; + +import org.xml.sax.SAXException; /** - * An interface for a class which can act as a map of frame names to web responses. * * @author <a href="mailto:rus...@ac...">Russell Gold</a> **/ -interface FrameHolder { +class FrameHolder { + + private WebClient _client; + private Hashtable _contents = new Hashtable(); + private Hashtable _subFrames = new Hashtable(); + private String _frameName; + private WebResponse _response = WebResponse.BLANK_RESPONSE; + + + FrameHolder( WebClient client, String name ) { + _client = client; + _frameName = name; + } + + + public WebResponse get( String frameName ) { + return (WebResponse) _contents.get( frameName ); + } + + + List getActiveFrameNames() { + List result = new ArrayList(); + for (Enumeration e = _contents.keys(); e.hasMoreElements();) { + result.add( e.nextElement() ); + } + + return result; + } + + + void updateFrames( WebResponse response ) throws MalformedURLException, IOException, SAXException { + removeSubFrames( response.getTarget() ); + _contents.put( response.getTarget(), response ); + + if (response.isHTML()) { + createSubFrames( response.getTarget(), response.getFrameNames() ); + WebRequest[] requests = response.getFrameRequests(); + for (int i = 0; i < requests.length; i++) _client.getResponse( requests[ i ] ); + } + } + + + private void removeSubFrames( String targetName ) { + String[] names = (String[]) _subFrames.get( targetName ); + if (names == null) return; + for (int i = 0; i < names.length; i++) { + removeSubFrames( names[ i ] ); + _contents.remove( names[ i ] ); + _subFrames.remove( names[ i ] ); + } + } + + + private void createSubFrames( String targetName, String[] frameNames ) { + _subFrames.put( targetName, frameNames ); + for (int i = 0; i < frameNames.length; i++) { + _contents.put( frameNames[ i ], WebResponse.BLANK_RESPONSE ); + } + } - /** - * Returns the response associated with the specified frame name. - * Throws a runtime exception if no matching frame is defined. - **/ - WebResponse getFrameContents( String frameName ); } + Index: HTMLPage.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HTMLPage.java 24 Jul 2002 20:54:31 -0000 1.1 +++ HTMLPage.java 1 Aug 2002 14:58:59 -0000 1.2 @@ -43,8 +43,8 @@ public class HTMLPage extends ParsedHTML { - public HTMLPage( URL url, String parentTarget, String pageText, String characterSet ) throws SAXException { - super( url, parentTarget, getDOM( url, pageText ), characterSet ); + public HTMLPage( WebResponse response, URL url, String parentTarget, String pageText, String characterSet ) throws SAXException { + super( response, url, parentTarget, getDOM( url, pageText ), characterSet ); setBaseAttributes(); } Index: HttpWebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpWebResponse.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- HttpWebResponse.java 18 Jun 2002 16:37:03 -0000 1.23 +++ HttpWebResponse.java 1 Aug 2002 14:58:59 -0000 1.24 @@ -48,8 +48,8 @@ * @param url the url from which the response was received * @param connection the URL connection from which the response can be read **/ - HttpWebResponse( String target, URL url, URLConnection connection, boolean throwExceptionOnError ) throws IOException { - super( target, url ); + HttpWebResponse( WebConversation client, String target, URL url, URLConnection connection, boolean throwExceptionOnError ) throws IOException { + super( client, target, url ); readHeaders( connection ); /** make sure that any IO exception for HTML received page happens here, not later. **/ Index: ParsedHTML.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- ParsedHTML.java 15 Jul 2002 14:30:32 -0000 1.21 +++ ParsedHTML.java 1 Aug 2002 14:58:59 -0000 1.22 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -31,11 +31,13 @@ **/ class ParsedHTML { - private WebForm[] _forms; - private WebImage[] _images; + private WebForm[] _forms; + private WebImage[] _images; + private WebResponse _response; - ParsedHTML( URL baseURL, String baseTarget, Node rootNode, String characterSet ) { + ParsedHTML( WebResponse response, URL baseURL, String baseTarget, Node rootNode, String characterSet ) { + _response = response; _baseURL = baseURL; _baseTarget = baseTarget; _rootNode = rootNode; @@ -52,7 +54,7 @@ _forms = new WebForm[ forms.getLength() ]; for (int i = 0; i < _forms.length; i++) { - _forms[i] = new WebForm( _baseURL, _baseTarget, forms.item( i ), _characterSet ); + _forms[i] = new WebForm( _response, _baseURL, _baseTarget, forms.item( i ), _characterSet ); } } return _forms; @@ -107,7 +109,7 @@ for (int i = 0; i < nl.getLength(); i++) { Node child = nl.item(i); if (isLinkAnchor( child )) { - list.addElement( new WebLink( _baseURL, _baseTarget, child ) ); + list.addElement( new WebLink( _response, _baseURL, _baseTarget, child ) ); } } } @@ -208,7 +210,7 @@ * they appear. **/ public WebTable[] getTables() { - return WebTable.getTables( getOriginalDOM(), _baseURL, _baseTarget, _characterSet ); + return WebTable.getTables( _response, getOriginalDOM(), _baseURL, _baseTarget, _characterSet ); } Index: TableCell.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/TableCell.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- TableCell.java 9 Nov 2001 18:35:14 -0000 1.7 +++ TableCell.java 1 Aug 2002 14:58:59 -0000 1.8 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -66,8 +66,8 @@ //---------------------------------------- package methods ----------------------------------------- - TableCell( Element cellNode, URL url, String parentTarget, String characterSet ) { - super( url, parentTarget, cellNode, characterSet ); + TableCell( WebResponse response, Element cellNode, URL url, String parentTarget, String characterSet ) { + super( response, url, parentTarget, cellNode, characterSet ); _element = cellNode; _colSpan = getAttributeValue( cellNode, "colspan", 1 ); _rowSpan = getAttributeValue( cellNode, "rowspan", 1 ); Index: WebClient.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v retrieving revision 1.25 retrieving revision 1.26 diff -u -r1.25 -r1.26 --- WebClient.java 30 Jul 2002 14:11:15 -0000 1.25 +++ WebClient.java 1 Aug 2002 14:58:59 -0000 1.26 @@ -47,7 +47,7 @@ * @author Oliver Imbusch **/ abstract -public class WebClient implements FrameHolder { +public class WebClient { /** * Submits a GET method request and returns a response. @@ -67,6 +67,14 @@ /** + * Returns the response representing the current main page. + */ + public WebResponse getCurrentPage() { + return getFrameContents( WebRequest.TOP_FRAME ); + } + + + /** * Submits a web request and returns a response, using all state developed so far as stored in * cookies as requested by the server. * @exception SAXException thrown if there is an error parsing the retrieved page @@ -113,7 +121,7 @@ * any listeners or preferences which may have been set. **/ public void clearContents() { - _frameContents = new FrameHolderImpl(); + _frameContents = new FrameHolder( this, WebRequest.TOP_FRAME ); _cookies = new Hashtable(); _headers = new HeaderDictionary(); } @@ -123,7 +131,8 @@ * Returns the name of the currently active frames. **/ public String[] getFrameNames() { - return _frameContents.getFrameNames(); + final List names = _frameContents.getActiveFrameNames(); + return (String[]) names.toArray( new String[ names.size() ] ); } @@ -311,7 +320,7 @@ delay( HttpUnitOptions.getRedirectDelay() ); getResponse( new RedirectWebRequest( response ) ); } else { - updateFrames( response ); + _frameContents.updateFrames( response ); } } @@ -332,11 +341,7 @@ /** A map of frame names to current contents. **/ - private FrameHolderImpl _frameContents = new FrameHolderImpl(); - - - /** A map of frame names to frames nested within them. **/ - private Hashtable _subFrames = new Hashtable(); + private FrameHolder _frameContents = new FrameHolder( this, WebRequest.TOP_FRAME ); /** A map of header names to values. **/ @@ -390,36 +395,6 @@ } } - private void updateFrames( WebResponse response ) throws MalformedURLException, IOException, SAXException { - removeSubFrames( response.getTarget() ); - response.setFrameHolder( this ); - _frameContents.put( response.getTarget(), response ); - - if (response.isHTML()) { - createSubFrames( response.getTarget(), response.getFrameNames() ); - WebRequest[] requests = response.getFrameRequests(); - for (int i = 0; i < requests.length; i++) getResponse( requests[i] ); - } - } - - - private void createSubFrames( String targetName, String[] frameNames ) { - _subFrames.put( targetName, frameNames ); - for (int i = 0; i < frameNames.length; i++) { - _frameContents.put( frameNames[i], WebResponse.BLANK_RESPONSE ); - } - } - - - private void removeSubFrames( String targetName ) { - String[] names = (String[]) _subFrames.get( targetName ); - if (names == null) return; - for (int i = 0; i < names.length; i++) { - removeSubFrames( names[i] ); - _frameContents.remove( names[i] ); - _subFrames.remove( names[i] ); - } - } //================================================================================================== @@ -489,34 +464,5 @@ -class FrameHolderImpl { - private Hashtable _contents = new Hashtable(); - - void put( String targetName, WebResponse contents ) { - _contents.put( targetName, contents ); - } - - - WebResponse get( String targetName ) { - return (WebResponse) _contents.get( targetName ); - } - - void remove( String targetName ) { - _contents.remove( targetName ); - } - - - public String[] getFrameNames() { - Vector names = new Vector(); - for (Enumeration e = _contents.keys(); e.hasMoreElements();) { - names.addElement( e.nextElement() ); - } - - String[] result = new String[ names.size() ]; - names.copyInto( result ); - return result; - } - -} Index: WebConversation.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebConversation.java,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- WebConversation.java 11 Feb 2002 14:33:53 -0000 1.24 +++ WebConversation.java 1 Aug 2002 14:58:59 -0000 1.25 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -63,7 +63,7 @@ } } request.completeRequest( connection ); - return new HttpWebResponse( request.getTarget(), request.getURL(), connection, getExceptionsThrownOnErrorStatus() ); + return new HttpWebResponse( this, request.getTarget(), request.getURL(), connection, getExceptionsThrownOnErrorStatus() ); } Index: WebForm.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- WebForm.java 24 Jul 2002 20:54:31 -0000 1.50 +++ WebForm.java 1 Aug 2002 14:58:59 -0000 1.51 @@ -31,6 +31,7 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; /** @@ -43,6 +44,14 @@ /** + * Submits this form using the web client from which it was originally obtained. + **/ + public void submit() throws IOException, SAXException { + submitRequest(); + } + + + /** * Returns the method defined for this form. **/ public String getMethod() { @@ -416,8 +425,8 @@ * Contructs a web form given the URL of its source page and the DOM extracted * from that page. **/ - WebForm( URL baseURL, String frameName, Node node, String characterSet ) { - super( node, baseURL, NodeUtils.getNodeAttribute( node, "action" ), frameName ); + WebForm( WebResponse response, URL baseURL, String frameName, Node node, String characterSet ) { + super( response, node, baseURL, NodeUtils.getNodeAttribute( node, "action" ), frameName ); _characterSet = characterSet; } Index: WebFrame.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebFrame.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- WebFrame.java 30 Jul 2002 14:11:15 -0000 1.8 +++ WebFrame.java 1 Aug 2002 14:58:59 -0000 1.9 @@ -2,14 +2,14 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * -* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -* documentation files (the "Software"), to deal in the Software without restriction, including without limitation +* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +* documentation files (the "Software"), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * -* The above copyright notice and this permission notice shall be included in all copies or substantial portions +* The above copyright notice and this permission notice shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO @@ -28,7 +28,7 @@ **/ class WebFrame { - + //---------------------------------------- package methods ----------------------------------------- @@ -78,7 +78,7 @@ WebRequest getInitialRequest() { - return new GetMethodWebRequest( _baseURL, + return new GetMethodWebRequest( _baseURL, NodeUtils.getNodeAttribute( _element, "src" ), getName() ); } Index: WebLink.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebLink.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- WebLink.java 19 Jun 2002 13:46:51 -0000 1.19 +++ WebLink.java 1 Aug 2002 14:58:59 -0000 1.20 @@ -31,6 +31,7 @@ import java.io.IOException; import org.w3c.dom.Node; +import org.xml.sax.SAXException; /** * This class represents a link in an HTML page. Users of this class may examine the @@ -70,6 +71,14 @@ } + /** + * Submits a request as though the user had clicked on this link. + **/ + public void click() throws IOException, SAXException { + submitRequest(); + } + + //----------------------------------------- WebRequestSource methods --------------------------------------------------- @@ -204,8 +213,8 @@ * Contructs a web link given the URL of its source page and the DOM extracted * from that page. **/ - WebLink( URL baseURL, String parentTarget, Node node ) { - super( node, baseURL, NodeUtils.getNodeAttribute( node, "href" ), parentTarget ); + WebLink( WebResponse response, URL baseURL, String parentTarget, Node node ) { + super( response, node, baseURL, NodeUtils.getNodeAttribute( node, "href" ), parentTarget ); } Index: WebRequestSource.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- WebRequestSource.java 14 Feb 2002 14:33:49 -0000 1.8 +++ WebRequestSource.java 1 Aug 2002 14:58:59 -0000 1.9 @@ -21,9 +21,11 @@ package com.meterware.httpunit; import org.w3c.dom.Node; +import org.xml.sax.SAXException; import java.net.URL; import java.util.StringTokenizer; +import java.io.IOException; abstract @@ -49,9 +51,7 @@ * Returns the target for this request source. **/ public String getTarget() { - if (getSpecifiedTarget().length() == 0) { - return _pageFrame; - } else if (getSpecifiedTarget().equalsIgnoreCase( "_self" )) { + if (getSpecifiedTarget().length() == 0 || getSpecifiedTarget().equalsIgnoreCase( "_self" )) { return _pageFrame; } else if (getSpecifiedTarget().equalsIgnoreCase( "_top" )) { return "_top"; @@ -125,8 +125,9 @@ * Contructs a web form given the URL of its source page and the DOM extracted * from that page. **/ - WebRequestSource( Node node, URL baseURL, String destination, String pageFrame ) { + WebRequestSource( WebResponse response, Node node, URL baseURL, String destination, String pageFrame ) { if (node == null) throw new IllegalArgumentException( "node must not be null" ); + _baseResponse = response; _node = node; _baseURL = baseURL; _destination = destination; @@ -164,6 +165,15 @@ /** + * Submits a request to the web client from which this request source was originally obtained. + **/ + final + protected void submitRequest() throws IOException, SAXException { + _baseResponse.getClient().sendRequest( getRequest() ); + } + + + /** * 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. **/ @@ -175,6 +185,9 @@ private static final String PARAM_DELIM = "&"; + + /** The web response containing this request source. **/ + private WebResponse _baseResponse; /** The name of the frame in which the response containing this request source is rendered. **/ private String _pageFrame; Index: WebResponse.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v retrieving revision 1.69 retrieving revision 1.70 diff -u -r1.69 -r1.70 --- WebResponse.java 30 Jul 2002 13:16:52 -0000 1.69 +++ WebResponse.java 1 Aug 2002 14:58:59 -0000 1.70 @@ -58,7 +58,7 @@ * access to WebResponse parsing without using a WebClient. **/ public static WebResponse newResponse( URLConnection connection ) throws IOException { - return new HttpWebResponse( "_top", connection.getURL(), connection, HttpUnitOptions.getExceptionsThrownOnErrorStatus() ); + return new HttpWebResponse( null, "_top", connection.getURL(), connection, HttpUnitOptions.getExceptionsThrownOnErrorStatus() ); } @@ -281,8 +281,8 @@ * @param subFrameName the name of the desired frame as defined in the frameset. **/ public WebResponse getSubframeContents( String subFrameName ) { - if (_frameHolder == null) throw new NoSuchFrameException( subFrameName ); - return _frameHolder.getFrameContents( WebFrame.getNestedFrameName( _frameName, subFrameName ) ); + if (_client == null) throw new NoSuchFrameException( subFrameName ); + return _client.getFrameContents( WebFrame.getNestedFrameName( _frameName, subFrameName ) ); } @@ -512,7 +512,8 @@ * @param frameName the name of the frame to hold the response * @param url the url from which the response was received **/ - protected WebResponse( String frameName, URL url ) { + protected WebResponse( WebClient client, String frameName, URL url ) { + _client = client; _url = url; _frameName = frameName; } @@ -594,11 +595,8 @@ } - /** - * Provides a FrameHolder to help with computation of subframes. - **/ - void setFrameHolder( FrameHolder holder ) { - _frameHolder = holder; + WebClient getClient() { + return _client; } @@ -645,8 +643,6 @@ private WebRequest _refreshRequest; - private FrameHolder _frameHolder; - private int _refreshDelay; private String _responseText; @@ -661,6 +657,8 @@ private String _frameName; + private WebClient _client; + protected void loadResponseText() throws IOException { if (_responseText != null) throw new IllegalStateException( "May only invoke loadResponseText once" ); @@ -912,7 +910,7 @@ if (_page == null) { try { if (!isHTML()) throw new NotHTMLException( getContentType() ); - _page = new HTMLPage( _url, _frameName, getText(), getCharacterSet() ); + _page = new HTMLPage( this, _url, _frameName, getText(), getCharacterSet() ); } catch (IOException e) { throw new SAXException( e ); } @@ -930,7 +928,7 @@ for (int i = 0; i < DEFAULT_ENCODING_CANDIDATES.length; i++) { try { _defaultEncoding = DEFAULT_ENCODING_CANDIDATES[i]; - "abcd".getBytes( _defaultEncoding ); + "abcd".getBytes( _defaultEncoding ); // throws an exception if the encoding is not supported return _defaultEncoding; } catch (UnsupportedEncodingException e) { } @@ -1050,7 +1048,7 @@ DefaultWebResponse( String text ) { - super( "", null ); + super( null, "", null ); _responseText = text; } Index: WebTable.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebTable.java,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- WebTable.java 19 Jun 2002 13:46:52 -0000 1.16 +++ WebTable.java 1 Aug 2002 14:58:59 -0000 1.17 @@ -2,7 +2,7 @@ /******************************************************************************************************************** * $Id$ * -* Copyright (c) 2000-2001, Russell Gold +* Copyright (c) 2000-2002, Russell Gold * * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation @@ -232,13 +232,13 @@ /** * Returns the top-level tables found in the specified DOM. **/ - static WebTable[] getTables( Node domRoot, URL baseURL, String parentTarget, String characterSet ) { + static WebTable[] getTables( WebResponse response, Node domRoot, URL baseURL, String parentTarget, String characterSet ) { NodeList nl = NodeUtils.getElementsByTagName( domRoot, "table" ); Vector topLevelTables = new Vector(); for (int i = 0; i < nl.getLength(); i++) { if (isTopLevelTable( nl.item(i), domRoot )) { - topLevelTables.addElement( new WebTable( nl.item(i), baseURL, parentTarget, characterSet ) ); + topLevelTables.addElement( new WebTable( response, nl.item(i), baseURL, parentTarget, characterSet ) ); } } @@ -251,16 +251,18 @@ //----------------------------------- private members ----------------------------------- - private Element _dom; - private URL _url; - private String _parentTarget; - private String _characterSet; + private Element _dom; + private URL _url; + private String _parentTarget; + private String _characterSet; + private WebResponse _response; private TableCell[][] _cells; - private WebTable( Node domTreeRoot, URL sourceURL, String parentTarget, String characterSet ) { + private WebTable( WebResponse response, Node domTreeRoot, URL sourceURL, String parentTarget, String characterSet ) { + _response = response; _dom = (Element) domTreeRoot; _url = sourceURL; _parentTarget = parentTarget; @@ -372,7 +374,7 @@ private void collectChildren( String childTag, final Vector children ) { processChildren( _element, childTag, "table", new ElementHandler() { public void handleElement( Element element ) { - children.addElement( new TableCell( element, _url, _parentTarget, _characterSet ) ); + children.addElement( new TableCell( _response, element, _url, _parentTarget, _characterSet ) ); } } ); } |