[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit ParsedHTML.java,1.19,1.20 WebClient.java,
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-05-14 19:31:07
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv32042/src/com/meterware/httpunit Modified Files: ParsedHTML.java WebClient.java Log Message: Cache computed WebForm array Index: ParsedHTML.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- ParsedHTML.java 27 Nov 2001 19:51:27 -0000 1.19 +++ ParsedHTML.java 14 May 2002 19:31:04 -0000 1.20 @@ -31,6 +31,8 @@ **/ class ParsedHTML { + private WebForm[] _forms; + ParsedHTML( URL baseURL, String baseTarget, Node rootNode, String characterSet ) { _baseURL = baseURL; @@ -44,13 +46,15 @@ * Returns the forms found in the page in the order in which they appear. **/ public WebForm[] getForms() { - NodeList forms = NodeUtils.getElementsByTagName( _rootNode, "form" ); - WebForm[] result = new WebForm[ forms.getLength() ]; - for (int i = 0; i < result.length; i++) { - result[i] = new WebForm( _baseURL, _baseTarget, forms.item( i ), _characterSet ); - } + if (_forms == null) { + NodeList forms = NodeUtils.getElementsByTagName( _rootNode, "form" ); - return result; + _forms = new WebForm[ forms.getLength() ]; + for (int i = 0; i < _forms.length; i++) { + _forms[i] = new WebForm( _baseURL, _baseTarget, forms.item( i ), _characterSet ); + } + } + return _forms; } Index: WebClient.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- WebClient.java 11 Mar 2002 12:34:31 -0000 1.22 +++ WebClient.java 14 May 2002 19:31:04 -0000 1.23 @@ -59,6 +59,14 @@ /** + * Submits a web request and returns a response. This is an alternate name for the getResponse method. + */ + public WebResponse sendRequest( WebRequest request ) throws MalformedURLException, IOException, SAXException { + return getResponse( request ); + } + + + /** * 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 |