httpunit-commit Mailing List for httpunit (Page 44)
Brought to you by:
russgold
You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
(31) |
Oct
(39) |
Nov
(18) |
Dec
(6) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(8) |
Feb
(5) |
Mar
(8) |
Apr
(25) |
May
(20) |
Jun
(23) |
Jul
(28) |
Aug
(10) |
Sep
(3) |
Oct
(32) |
Nov
(61) |
Dec
(24) |
| 2002 |
Jan
(50) |
Feb
(34) |
Mar
(35) |
Apr
(3) |
May
(25) |
Jun
(25) |
Jul
(30) |
Aug
(146) |
Sep
(49) |
Oct
(156) |
Nov
(121) |
Dec
(54) |
| 2003 |
Jan
(12) |
Feb
(79) |
Mar
(88) |
Apr
(26) |
May
(67) |
Jun
(29) |
Jul
(8) |
Aug
(16) |
Sep
(20) |
Oct
(17) |
Nov
|
Dec
(5) |
| 2004 |
Jan
|
Feb
(40) |
Mar
(30) |
Apr
(5) |
May
|
Jun
(83) |
Jul
(34) |
Aug
(20) |
Sep
(44) |
Oct
(46) |
Nov
|
Dec
(14) |
| 2005 |
Jan
(4) |
Feb
|
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
|
Dec
(1) |
| 2006 |
Jan
|
Feb
|
Mar
(26) |
Apr
(8) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(5) |
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
(36) |
May
(38) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
(4) |
Oct
|
Nov
(18) |
Dec
(4) |
| 2009 |
Jan
|
Feb
(2) |
Mar
(3) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
(35) |
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
| 2010 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
(9) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(21) |
Oct
(18) |
Nov
(1) |
Dec
|
|
From: Russell G. <rus...@us...> - 2002-11-09 23:34:30
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv4449/doc
Modified Files:
release_notes.txt
Log Message:
Permit build w/o NekoHTML
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.212
retrieving revision 1.213
diff -u -r1.212 -r1.213
--- release_notes.txt 8 Nov 2002 02:18:54 -0000 1.212
+++ release_notes.txt 9 Nov 2002 23:34:27 -0000 1.213
@@ -10,6 +10,10 @@
Revision History:
+ 9-Nov-2002
+Problems fixed:
+ 1. As of 1.5, HttpUnit was not building if NekoHTML was not in the classpath. This is now fixed.
+
7-Nov-2002
Acknowledgements:
Thanks to Raul Benito Garcia for pointing out the problem with no-action forms accessed with URL parameters
|
|
From: Russell G. <rus...@us...> - 2002-11-08 02:18:58
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv5303/doc
Modified Files:
release_notes.txt
Log Message:
Fix bug #635273: proxy server doesn't work
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.211
retrieving revision 1.212
diff -u -r1.211 -r1.212
--- release_notes.txt 8 Nov 2002 01:59:37 -0000 1.211
+++ release_notes.txt 8 Nov 2002 02:18:54 -0000 1.212
@@ -13,9 +13,11 @@
7-Nov-2002
Acknowledgements:
Thanks to Raul Benito Garcia for pointing out the problem with no-action forms accessed with URL parameters
+ Thanks to Charles Mendis for finding the bug in the proxy support
Problems fixed:
1. When a form obtained using parameters as part of the URL has no action, those parameters are now sent
as part of the form submission.
+ 2. Bug #635273 Proxy port always interpreted as port 80 due to typo
6-Nov-2002
Problems fixed:
|
|
From: Russell G. <rus...@us...> - 2002-11-08 02:18:58
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv5303/src/com/meterware/httpunit
Modified Files:
WebClient.java
Log Message:
Fix bug #635273: proxy server doesn't work
Index: WebClient.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebClient.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- WebClient.java 1 Nov 2002 14:54:59 -0000 1.45
+++ WebClient.java 8 Nov 2002 02:18:54 -0000 1.46
@@ -276,7 +276,7 @@
*/
public void setProxyServer( String proxyHost, int proxyPort ) {
System.setProperty( "proxyHost", proxyHost );
- System.setProperty( "proxyPost", Integer.toString( proxyPort ) );
+ System.setProperty( "proxyPort", Integer.toString( proxyPort ) );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-08 02:18:58
|
Update of /cvsroot/httpunit/httpunit/examples In directory usw-pr-cvs1:/tmp/cvs-serv5303/examples Added Files: ProxySample.java Log Message: Fix bug #635273: proxy server doesn't work ***** Error reading new file[Errno 2] No such file or directory: 'ProxySample.java' |
|
From: Russell G. <rus...@us...> - 2002-11-08 01:59:41
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv31885/test/com/meterware/httpunit
Modified Files:
FormSubmitTest.java
Log Message:
Send URL parameters with no-action form submission
Index: FormSubmitTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/FormSubmitTest.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- FormSubmitTest.java 8 Oct 2002 17:45:13 -0000 1.27
+++ FormSubmitTest.java 8 Nov 2002 01:59:38 -0000 1.28
@@ -475,6 +475,21 @@
}
+ public void testNoActionSuppliedWhenBaseHasParams() throws Exception {
+ defineResource( "abc/form?param1=value¶m2=value", "<form name=\"test\">" +
+ " <input type=\"text\" name=\"aTextField\">" +
+ " <input type=\"submit\" name=\"apply\" value=\"Apply\">" +
+ "</form>" );
+
+ WebResponse wr = _wc.getResponse( getHostPath() + "/abc/form?param1=value¶m2=value" );
+ WebForm form = wr.getForms()[0];
+ WebRequest req = form.getRequest( "apply" );
+ req.setParameter( "aTextField", "test" );
+ assertEquals( getHostPath() + "/abc/form?param1=value¶m2=value&aTextField=test&apply=Apply",
+ req.getURL().toExternalForm() );
+ }
+
+
public void testPostActionParametersAfterSetAction() throws Exception {
defineWebPage( "abc/form", "<form name=\"test\" method='POST' action='stop?ready=yes'>" +
" <input type=\"text\" name=\"aTextField\">" +
|
|
From: Russell G. <rus...@us...> - 2002-11-08 01:59:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv31885/src/com/meterware/httpunit
Modified Files:
AuthorizationRequiredException.java WebRequestSource.java
Log Message:
Send URL parameters with no-action form submission
Index: AuthorizationRequiredException.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/AuthorizationRequiredException.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AuthorizationRequiredException.java 26 Nov 2001 14:20:12 -0000 1.5
+++ AuthorizationRequiredException.java 8 Nov 2002 01:59:37 -0000 1.6
@@ -64,7 +64,7 @@
/**
- * Returns the name of the <a href="ftp://ftp.isi.edu/in-notes/rfc2617.txt">authentication scheme</a>.
+ * Returns the name of the <a href="http://www.freesoft.org/CIE/RFC/Orig/rfc2617.txt">authentication scheme</a>.
**/
public String getAuthenticationScheme() {
return _scheme;
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- WebRequestSource.java 8 Oct 2002 14:01:10 -0000 1.18
+++ WebRequestSource.java 8 Nov 2002 01:59:38 -0000 1.19
@@ -264,7 +264,8 @@
* Gets all parameters from a URL
**/
private String getParametersString() {
- final String url = trimFragment( getDestination() );
+ String url = trimFragment( getDestination() );
+ if (url.trim().length() == 0) url = getBaseURL().toExternalForm();
if (url.startsWith( "javascript:" )) return "";
final int questionMarkIndex = url.indexOf("?");
if (questionMarkIndex >= 1 && questionMarkIndex < url.length() - 1) {
|
|
From: Russell G. <rus...@us...> - 2002-11-08 01:59:40
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv31885/doc
Modified Files:
release_notes.txt
Log Message:
Send URL parameters with no-action form submission
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.210
retrieving revision 1.211
diff -u -r1.210 -r1.211
--- release_notes.txt 6 Nov 2002 13:10:41 -0000 1.210
+++ release_notes.txt 8 Nov 2002 01:59:37 -0000 1.211
@@ -10,6 +10,13 @@
Revision History:
+ 7-Nov-2002
+Acknowledgements:
+ Thanks to Raul Benito Garcia for pointing out the problem with no-action forms accessed with URL parameters
+Problems fixed:
+ 1. When a form obtained using parameters as part of the URL has no action, those parameters are now sent
+ as part of the form submission.
+
6-Nov-2002
Problems fixed:
1. Simply removing the NekoHTML parser jar from the classpath was not enough to re-enable JTidy. Now it is.
|
|
From: Russell G. <rus...@us...> - 2002-11-08 01:59:40
|
Update of /cvsroot/httpunit/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv31885
Modified Files:
build.xml
Log Message:
Send URL parameters with no-action form submission
Index: build.xml
===================================================================
RCS file: /cvsroot/httpunit/httpunit/build.xml,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- build.xml 3 Nov 2002 15:46:16 -0000 1.53
+++ build.xml 8 Nov 2002 01:59:37 -0000 1.54
@@ -23,6 +23,8 @@
<property name="test.classes" value="${build.dir}/testclasses" />
<property name="javadoc.dir" value="${docs.dir}/api" />
+ <property name="use.jtidy" value="" />
+
<property name="dist.dir" value="dist" />
<property name="archive.dir" value="${dist.dir}/${name}-${version}" />
<property name="classpath" value="" />
@@ -37,6 +39,7 @@
<path id="base.classpath">
<fileset dir="${jars.dir}">
<include name="*.jar"/>
+ <exclude name="nekohtml.jar" if="use.jtidy" />
</fileset>
</path>
|
|
From: Russell G. <rus...@us...> - 2002-11-06 13:10:45
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv18823/doc
Modified Files:
release_notes.txt
Log Message:
Enable JTidy parser if NekoHTML is not in the classpath
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -r1.209 -r1.210
--- release_notes.txt 5 Nov 2002 21:45:16 -0000 1.209
+++ release_notes.txt 6 Nov 2002 13:10:41 -0000 1.210
@@ -10,6 +10,10 @@
Revision History:
+ 6-Nov-2002
+Problems fixed:
+ 1. Simply removing the NekoHTML parser jar from the classpath was not enough to re-enable JTidy. Now it is.
+
5-Nov-2002
Acknowledgements:
Thanks to Troy Waldrep for pointing out the non-standard Refresh header definition accepted in popular browsers
|
|
From: Russell G. <rus...@us...> - 2002-11-06 13:10:45
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory usw-pr-cvs1:/tmp/cvs-serv18823/test/com/meterware/httpunit/javascript
Modified Files:
DocumentScriptingTest.java
Added Files:
NekoEnhancedScriptingTest.java
Log Message:
Enable JTidy parser if NekoHTML is not in the classpath
***** Error reading new file[Errno 2] No such file or directory: 'NekoEnhancedScriptingTest.java'
Index: DocumentScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/DocumentScriptingTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- DocumentScriptingTest.java 24 Oct 2002 13:28:55 -0000 1.3
+++ DocumentScriptingTest.java 6 Nov 2002 13:10:41 -0000 1.4
@@ -99,23 +99,6 @@
}
- public void testEmbeddedDocumentWrite() throws Exception {
- defineResource( "OnCommand.html", "<html><head><title>something</title></head>" +
- "<body>" +
- "<script language='JavaScript'>" +
- "document.write( '<a id=here href=about:blank>' );" +
- "document.write( document.title );" +
- "document.write( '</a>' );" +
- "</script>" +
- "</body></html>" );
- WebConversation wc = new WebConversation();
- WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
- WebLink link = response.getLinkWithID( "here" );
- assertNotNull( "The link was not found", link );
- assertEquals( "Link contents", "something", link.asText() );
- }
-
-
public void testJavaScriptObjectIdentity() throws Exception {
defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" +
"function compareLinks() { " +
|
|
From: Russell G. <rus...@us...> - 2002-11-06 13:10:45
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv18823/src/com/meterware/httpunit
Modified Files:
HttpUnitOptions.java
Log Message:
Enable JTidy parser if NekoHTML is not in the classpath
Index: HttpUnitOptions.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- HttpUnitOptions.java 3 Nov 2002 18:18:19 -0000 1.32
+++ HttpUnitOptions.java 6 Nov 2002 13:10:41 -0000 1.33
@@ -522,6 +522,7 @@
reset();
try {
+ Class.forName( "org.w3c.tidy.Parser" );
_jtidyParser = (HTMLParser) Class.forName( "com.meterware.httpunit.JTidyHTMLParser" ).newInstance();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
@@ -529,6 +530,7 @@
}
try {
+ Class.forName( "org.cyberneko.html.HTMLConfiguration" );
_nekoParser = (HTMLParser) Class.forName( "com.meterware.httpunit.NekoHTMLParser" ).newInstance();
} catch (InstantiationException e) {
} catch (IllegalAccessException e) {
|
|
From: Russell G. <rus...@us...> - 2002-11-06 13:10:44
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv18823/test/com/meterware/httpunit
Modified Files:
HttpUnitSuite.java
Log Message:
Enable JTidy parser if NekoHTML is not in the classpath
Index: HttpUnitSuite.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/HttpUnitSuite.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- HttpUnitSuite.java 22 Oct 2002 20:15:35 -0000 1.25
+++ HttpUnitSuite.java 6 Nov 2002 13:10:41 -0000 1.26
@@ -21,6 +21,7 @@
*******************************************************************************************************************/
import com.meterware.pseudoserver.PseudoServerTest;
import com.meterware.httpunit.cookies.CookieTest;
+import com.meterware.httpunit.javascript.NekoEnhancedScriptingTest;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
@@ -62,6 +63,7 @@
result.addTest( MessageBodyRequestTest.suite() );
result.addTest( CookieTest.suite() );
if (HttpUnitOptions.getHTMLParser().getClass().getName().indexOf("Tidy") >= 0) result.addTest( JTidyPrintWriterTest.suite() );
+ if (HttpUnitOptions.getHTMLParser().getClass().getName().indexOf("NekoHTML") >= 0) result.addTest( NekoEnhancedScriptingTest.suite() );
addOptionalTestCase( result, "com.meterware.httpunit.XMLPageTest" );
addOptionalTestCase( result, "com.meterware.httpunit.FileUploadTest" );
addOptionalTestCase( result, "com.meterware.httpunit.javascript.JavaScriptTestSuite" );
|
|
From: Russell G. <rus...@us...> - 2002-11-05 21:45:22
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv7897/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Support the refresh header
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- WebPageTest.java 1 Nov 2002 14:55:02 -0000 1.24
+++ WebPageTest.java 5 Nov 2002 21:45:19 -0000 1.25
@@ -262,6 +262,24 @@
}
+ public void testRefreshHeader() throws Exception {
+ String refreshURL = getHostPath() + "/NextPage.html";
+ String page = "<html><head><title>Sample</title></head>\n" +
+ "<body>This has no data\n" +
+ "</body></html>\n";
+ defineResource( "SimplePage.html", page );
+ addResourceHeader( "SimplePage.html", "Refresh: 2;URL=NextPage.html" );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertNotNull( "No Refresh header found", simplePage.getRefreshRequest() );
+ assertEquals( "Refresh URL", refreshURL, simplePage.getRefreshRequest().getURL().toExternalForm() );
+ assertEquals( "Refresh delay", 2, simplePage.getRefreshDelay() );
+ }
+
+
public void testMetaRefreshRequest() throws Exception {
String refreshURL = getHostPath() + "/NextPage.html";
String page = "<html><head><title>Sample</title>" +
@@ -311,7 +329,8 @@
WebResponse simplePage = wc.getResponse( request );
assertNull( "No refresh request should have been found", simplePage.getRefreshRequest() );
- }
+ }
+
/**
* Test the meta tag content retrieval
|
|
From: Russell G. <rus...@us...> - 2002-11-05 21:45:21
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv7897/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
Support the refresh header
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.96
retrieving revision 1.97
diff -u -r1.96 -r1.97
--- WebResponse.java 3 Nov 2002 06:31:14 -0000 1.96
+++ WebResponse.java 5 Nov 2002 21:45:18 -0000 1.97
@@ -47,6 +47,7 @@
**/
abstract
public class WebResponse implements HTMLSegment, CookieSource {
+ private String _refreshHeader;
/**
* Returns a web response built from a URL connection. Provided to allow
@@ -135,6 +136,7 @@
* by a <meta> tag in the header. If no tag exists, will return null.
**/
public WebRequest getRefreshRequest() {
+ readRefreshRequest();
return _refreshRequest;
}
@@ -145,6 +147,7 @@
* will return zero.
**/
public int getRefreshDelay() {
+ readRefreshRequest();
return _refreshDelay;
}
@@ -695,30 +698,6 @@
}
- final
- protected void readRefreshRequest( String contentTypeHeader ) {
- int splitIndex = contentTypeHeader.indexOf( ';' );
- if (splitIndex < 0) splitIndex = 0;
- try {
- _refreshDelay = Integer.parseInt( contentTypeHeader.substring( 0, splitIndex ) );
- _refreshRequest = new GetMethodWebRequest( _url, getRefreshURL( contentTypeHeader.substring( splitIndex+1 ) ), _frameName );
- } catch (NumberFormatException e) {
- System.out.println( "Unable to interpret refresh tag: \"" + contentTypeHeader + '"' );
- }
- }
-
-
- private String getRefreshURL( String text ) {
- text = text.trim();
- if (!text.toUpperCase().startsWith( "URL" )) {
- return text;
- } else {
- int splitIndex = text.indexOf( '=' );
- return text.substring( splitIndex+1 ).trim();
- }
- }
-
-
/**
* Overwrites the current value (if any) of the content type header.
**/
@@ -784,7 +763,7 @@
private WebRequest _refreshRequest;
- private int _refreshDelay;
+ private int _refreshDelay = -1; // initialized to invalid value
private String _responseText;
@@ -846,7 +825,7 @@
if (isHttpEquivMetaTag( tag, "content-type" )) {
inferContentType( tag.getAttribute( "content" ) );
} else if (isHttpEquivMetaTag( tag, "refresh" )) {
- readRefreshRequest( tag.getAttribute( "content" ) );
+ inferRefreshHeader( tag.getAttribute( "content" ) );
}
}
@@ -855,6 +834,43 @@
{
return headerName.equalsIgnoreCase( tag.getAttribute( "http_equiv" ) ) ||
headerName.equalsIgnoreCase( tag.getAttribute( "http-equiv" ) );
+ }
+
+
+ private void inferRefreshHeader( String refreshHeader ) {
+ String originalHeader = getHeaderField( "Refresh" );
+ if (originalHeader == null) {
+ _refreshHeader = refreshHeader;
+ }
+ }
+
+
+ private void readRefreshRequest() {
+ if (_refreshDelay >= 0) return;
+ _refreshDelay = 0;
+ String refreshHeader = _refreshHeader != null ? _refreshHeader : getHeaderField( "Refresh" );
+ if (refreshHeader == null) return;
+
+ int splitIndex = refreshHeader.indexOf( ';' );
+ if (splitIndex < 0) splitIndex = 0;
+ try {
+ _refreshDelay = Integer.parseInt( refreshHeader.substring( 0, splitIndex ) );
+ _refreshRequest = new GetMethodWebRequest( _url, getRefreshURL( refreshHeader.substring( splitIndex+1 ) ), _frameName );
+ } catch (NumberFormatException e) {
+ _refreshDelay = 0;
+ System.out.println( "Unable to interpret refresh tag: \"" + refreshHeader + '"' );
+ }
+ }
+
+
+ private String getRefreshURL( String text ) {
+ text = text.trim();
+ if (!text.toUpperCase().startsWith( "URL" )) {
+ return text;
+ } else {
+ int splitIndex = text.indexOf( '=' );
+ return text.substring( splitIndex+1 ).trim();
+ }
}
|
|
From: Russell G. <rus...@us...> - 2002-11-05 21:45:21
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv7897/doc
Modified Files:
release_notes.txt
Log Message:
Support the refresh header
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.208
retrieving revision 1.209
diff -u -r1.208 -r1.209
--- release_notes.txt 4 Nov 2002 21:01:36 -0000 1.208
+++ release_notes.txt 5 Nov 2002 21:45:16 -0000 1.209
@@ -10,6 +10,13 @@
Revision History:
+ 5-Nov-2002
+Acknowledgements:
+ Thanks to Troy Waldrep for pointing out the non-standard Refresh header definition accepted in popular browsers
+
+Additions:
+ 1. Added support for the Refresh header
+
4-Nov-2002
Acknowledgements:
Thanks to Geert Bevin for fixing a problem with comparing cookies
|
|
From: Russell G. <rus...@us...> - 2002-11-04 21:02:10
|
Update of /cvsroot/httpunit/httpunit/doc
In directory usw-pr-cvs1:/tmp/cvs-serv6863/doc
Modified Files:
release_notes.txt
Log Message:
Correct global vs rooted cookie handling
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -r1.207 -r1.208
--- release_notes.txt 3 Nov 2002 06:31:53 -0000 1.207
+++ release_notes.txt 4 Nov 2002 21:01:36 -0000 1.208
@@ -10,6 +10,13 @@
Revision History:
+ 4-Nov-2002
+Acknowledgements:
+ Thanks to Geert Bevin for fixing a problem with comparing cookies
+
+Problems Fixed:
+ 1. Adding both a "global" cookie and a server-based cookie with the same name causes a NullPointerException
+
3-Nov-2002 1.5
Acknowledgements:
Thanks to Ken Corbin for adding tests for disabled and read-only parameters.
|
|
From: Russell G. <rus...@us...> - 2002-11-04 21:01:42
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/cookies
In directory usw-pr-cvs1:/tmp/cvs-serv6863/test/com/meterware/httpunit/cookies
Modified Files:
CookieTest.java
Log Message:
Correct global vs rooted cookie handling
Index: CookieTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/cookies/CookieTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CookieTest.java 17 Oct 2002 23:52:49 -0000 1.1
+++ CookieTest.java 4 Nov 2002 21:01:38 -0000 1.2
@@ -147,15 +147,15 @@
public void testHeaderGeneration() throws Exception {
CookieJar jar = new CookieJar();
+ jar.addCookie( "zero", "nil" );
jar.updateCookies( newJar( "www.meterware.com/servlets/standard/AServlet", "first=ready" ) );
jar.updateCookies( newJar( "www.meterware.com/servlets/AnotherServlet", "second=set" ) );
- jar.updateCookies( newJar( "www.httpunit.org", "third=go; domain=.httpunit.org" ) );
+ jar.updateCookies( newJar( "www.httpunit.org", "zero=go; domain=.httpunit.org" ) );
jar.updateCookies( newJar( "meterware.com", "fourth=money" ) );
- jar.addCookie( "zero", "nil" );
checkHeader( 1, jar, "first=ready;second=set;zero=nil", "www.meterware.com/servlets/standard/Count" );
checkHeader( 2, jar, "second=set;zero=nil", "www.meterware.com/servlets/special/Divide" );
- checkHeader( 3, jar, "third=go;zero=nil", "fancy.httpunit.org/servlets/AskMe" );
+ checkHeader( 3, jar, "zero=go", "fancy.httpunit.org/servlets/AskMe" );
}
@@ -167,11 +167,11 @@
public void testCookieReplacement() throws Exception {
CookieJar jar = new CookieJar();
jar.updateCookies( newJar( "www.meterware.com/servlets/standard", "first=ready" ) );
- jar.updateCookies( newJar( "meterware.com/servlets/standard", "first=more" ) );
- jar.updateCookies( newJar( "www.meterware.com/servlets", "first=day" ) );
- jar.updateCookies( newJar( "www.meterware.com/servlets", "first=tomorrow" ) );
+ jar.updateCookies( newJar( "meterware.com/servlets/standard", "second=more" ) );
+ jar.updateCookies( newJar( "www.meterware.com/servlets", "third=day" ) );
+ jar.updateCookies( newJar( "www.meterware.com/servlets", "third=tomorrow" ) );
- checkHeader( 1, jar, "first=ready;first=tomorrow", "www.meterware.com/servlets/standard" );
+ checkHeader( 1, jar, "first=ready;third=tomorrow", "www.meterware.com/servlets/standard" );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-04 21:01:42
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory usw-pr-cvs1:/tmp/cvs-serv6863/src/com/meterware/servletunit
Modified Files:
ServletUnitHttpResponse.java
Log Message:
Correct global vs rooted cookie handling
Index: ServletUnitHttpResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpResponse.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- ServletUnitHttpResponse.java 21 Oct 2002 18:03:59 -0000 1.14
+++ ServletUnitHttpResponse.java 4 Nov 2002 21:01:38 -0000 1.15
@@ -570,7 +570,9 @@
StringBuffer sb = new StringBuffer();
for (Enumeration e = _cookies.elements(); e.hasMoreElements();) {
Cookie cookie = (Cookie) e.nextElement();
- sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() ).append( ";path=" ).append( cookie.getPath() );
+ sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() );
+ if (cookie.getPath() != null) sb.append( ";path=" ).append( cookie.getPath() );
+ if (cookie.getDomain() != null) sb.append( ";domain=" ).append( cookie.getDomain() );
if (e.hasMoreElements()) sb.append( ',' );
}
setHeader( "Set-Cookie", sb.toString() );
|
|
From: Russell G. <rus...@us...> - 2002-11-04 21:01:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies
In directory usw-pr-cvs1:/tmp/cvs-serv6863/src/com/meterware/httpunit/cookies
Modified Files:
Cookie.java CookieJar.java
Log Message:
Correct global vs rooted cookie handling
Index: Cookie.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/Cookie.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Cookie.java 3 Nov 2002 17:37:37 -0000 1.2
+++ Cookie.java 4 Nov 2002 21:01:37 -0000 1.3
@@ -117,8 +117,13 @@
private boolean equals( Cookie other ) {
return _name.equalsIgnoreCase( other._name ) &&
- getDomain().equals( other.getDomain() ) &&
- getPath().equals( other.getPath() );
+ equalProperties( getDomain(), other.getDomain() ) &&
+ equalProperties( getPath(), other.getPath() );
+ }
+
+
+ private boolean equalProperties( String first, String second ) {
+ return first == second || (first != null && first.equals( second ));
}
Index: CookieJar.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/CookieJar.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CookieJar.java 17 Oct 2002 23:50:49 -0000 1.1
+++ CookieJar.java 4 Nov 2002 21:01:37 -0000 1.2
@@ -37,6 +37,7 @@
private static final int DEFAULT_HEADER_SIZE = 80;
private ArrayList _cookies = new ArrayList();
+ private ArrayList _globalCookies = new ArrayList();
private CookiePress _press;
@@ -77,6 +78,7 @@
*/
public void clear() {
_cookies.clear();
+ _globalCookies.clear();
}
@@ -85,7 +87,7 @@
* certain cookies are sent based on their host and path.
**/
public void addCookie( String name, String value ) {
- addUniqueCookie( new Cookie( name, value ) );
+ _globalCookies.add( new Cookie( name, value ) );
}
@@ -93,9 +95,13 @@
* Returns the name of all the active cookies in this cookie jar.
**/
public String[] getCookieNames() {
- String[] names = new String[ _cookies.size() ];
- for (int i = 0; i < names.length; i++) {
- names[i] = ((Cookie) _cookies.get(i)).getName();
+ final int numGlobalCookies = _globalCookies.size();
+ String[] names = new String[ _cookies.size() + numGlobalCookies ];
+ for (int i = 0; i < numGlobalCookies; i++) {
+ names[i] = ((Cookie) _globalCookies.get(i)).getName();
+ }
+ for (int i = numGlobalCookies; i < names.length; i++) {
+ names[ i + numGlobalCookies ] = ((Cookie) _cookies.get(i)).getName();
}
return names;
}
@@ -105,7 +111,9 @@
* Returns a collection containing all of the cookies in this jar.
*/
public Collection getCookies() {
- return (Collection) _cookies.clone();
+ final Collection collection = (Collection) _cookies.clone();
+ collection.addAll( _globalCookies );
+ return collection;
}
@@ -127,6 +135,10 @@
Cookie cookie = (Cookie) iterator.next();
if (name.equals( cookie.getName() )) return cookie;
}
+ for (Iterator iterator = _globalCookies.iterator(); iterator.hasNext();) {
+ Cookie cookie = (Cookie) iterator.next();
+ if (name.equals( cookie.getName() )) return cookie;
+ }
return null;
}
@@ -136,11 +148,19 @@
* Will return null if no compatible cookie is defined.
**/
public String getCookieHeaderField( URL targetURL ) {
- if (_cookies.isEmpty()) return null;
+ if (_cookies.isEmpty() && _globalCookies.isEmpty()) return null;
StringBuffer sb = new StringBuffer( DEFAULT_HEADER_SIZE );
+ HashSet restrictedCookies = new HashSet();
for (Iterator i = _cookies.iterator(); i.hasNext();) {
Cookie cookie = (Cookie) i.next();
if (!cookie.mayBeSentTo( targetURL )) continue;
+ restrictedCookies.add( cookie.getName() );
+ if (sb.length() != 0) sb.append( ';' );
+ sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() );
+ }
+ for (Iterator i = _globalCookies.iterator(); i.hasNext();) {
+ Cookie cookie = (Cookie) i.next();
+ if (restrictedCookies.contains( cookie.getName() )) continue;
if (sb.length() != 0) sb.append( ';' );
sb.append( cookie.getName() ).append( '=' ).append( cookie.getValue() );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 22:44:17
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory usw-pr-cvs1:/tmp/cvs-serv25607/src/com/meterware/servletunit
Modified Files:
ServletUnitHttpRequest.java
Log Message:
Remove inadvertant JDK 1.4 dependency
Index: ServletUnitHttpRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpRequest.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ServletUnitHttpRequest.java 25 Oct 2002 00:19:25 -0000 1.17
+++ ServletUnitHttpRequest.java 3 Nov 2002 22:44:13 -0000 1.18
@@ -848,7 +848,7 @@
range = range.trim();
int dashIndex = range.indexOf( '-' );
if (dashIndex < 0) {
- return new Locale( range );
+ return new Locale( range, "" );
} else {
return new Locale( range.substring( 0, dashIndex ), range.substring( dashIndex+1 ) );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 18:18:24
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit
In directory usw-pr-cvs1:/tmp/cvs-serv770/test/com/meterware/servletunit
Modified Files:
HttpServletResponseTest.java
Log Message:
default to text/html
Index: HttpServletResponseTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpServletResponseTest.java 2 Oct 2002 14:50:39 -0000 1.5
+++ HttpServletResponseTest.java 3 Nov 2002 18:18:20 -0000 1.6
@@ -58,7 +58,6 @@
public void testDefaultResponse() throws Exception {
ServletUnitHttpResponse servletResponse = new ServletUnitHttpResponse();
WebResponse response = new ServletUnitWebResponse( null, "_self", null, servletResponse );
- assertEquals( "Content type", "text/plain", response.getContentType() );
assertEquals( "Contents", "", response.getText() );
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 18:18:24
|
Update of /cvsroot/httpunit/httpunit/doc In directory usw-pr-cvs1:/tmp/cvs-serv770/doc Modified Files: faq.html Log Message: default to text/html Index: faq.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/faq.html,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- faq.html 1 Nov 2002 14:54:58 -0000 1.21 +++ faq.html 3 Nov 2002 18:18:19 -0000 1.22 @@ -7,27 +7,25 @@ <OL> <LI><A HREF="#Cannot unzip">Why can't I unzip the download library?</A></LI> <LI><A HREF="#org.xml.sax">What is the org.xml.sax package?</A></LI> -<LI><A HREF="#reload">Why do I get java.lang.IllegalAccessError when calling getResponse()?</A></LI> -</ol><ol start=4> +</ol><ol start=3> <LI><A HREF="sslfaq.html">Does HttpUnit support https?</A></LI> <LI><A HREF="#proxy">Can I use HttpUnit through a proxy server?</A></LI> <LI><A HREF="#charset">Why isn't HttpUnit handling my non-English pages?</A></LI> <LI><A HREF="#badType">The server is not sending a valid content type. How do I test HTML pages anyway?</A></LI> -</ol><ol start=8> +</ol><ol start=7> <LI><A HREF="#buttons">HttpUnit is not finding the buttons and parameters in my forms. What is wrong?</A></LI> -<LI><A HREF="#badPost">Why doesn't my servlet see parameters on a POST request?</A></LI> <LI><A HREF="#hidden">Why can't I change hidden parameters?</A></LI> -</ol><ol start=11> +</ol><ol start=9> <LI><A HREF="#javascript">How do I use HttpUnit to test my pages that use JavaScript?</A></LI> <LI><A HREF="#norhino">JavaScript is not being executed at all. Why not?</A></LI> <li><a href="#unsupported">How do I handle a page that uses JavaScript features that HttpUnit does not support?</a></li> -</ol><ol start=14> +</ol><ol start=12> <LI><A HREF="#session">How can I see the servlet session between calls?</A></LI> <li><a href="#JSP">Can I use JSPs with ServletUnit?</a></li> @@ -44,25 +42,12 @@ You may be getting compile or runtime errors asking for the org.xml.sax package. You need to have xerces or another XML parser in your classpath. Xerces is included in the download. -<A NAME="#reload"><h3>Why do I get java.lang.IllegalAccessError when calling getResponse()?</h3></A> -<p>This happens when you use HttpUnit and certain versions of JTidy with one of the JUnit graphical test runners, which reloads -classes every time to run a test. Unfortunately, this places different versions of the JTidy -classes in different class loaders, so you get this error. To avoid it, -you can do any of the following:<ul><li>Use only the text test runner</li> -<li>Disable all class reloading in JUnit by adding "loading=false" to <tt>junit.properties</tt> in your current directory</li> -<li>Disable reloading of HttpUnit and JTidy by adding the following lines to <tt>excluded.properties</tt> in junit.jar<blockquote><code> -excluded.10=com.meterware.httpunit.*<br> -excluded.11=org.w3c.tidy.* -</code></blockquote> -This will require extracting the file, modifying it and then putting it back <em>in the same directory</em>, but it should allow your -tests to reload safely.</ul></p> -<p>This problem appears to be resolved in JTidy r7, which is included with HttpUnit 1.4.1 or later. - <h2>Server Issues</h2> <A NAME="proxy"><h3>Can I use HttpUnit through a proxy server?</h3></A> -Yes. Call <code>WebClient.setProxyServer( host, port )</code> before sending your request. -This feature is available in the <a href="http://www.httpunit.org/prerelease">latest pre-release build.</a> +Yes. Call <a href="api/com/meterware/httpunit/WebClient.html#setProxyServer(java.lang.String, int)"><code>WebClient.setProxyServer( host, port )</code></a> +before sending your request. + <A NAME="charset"><h3>Why isn't HttpUnit handling my non-English pages?</h3></A> Older versions of HttpUnit (through 1.2) incorrectly assumed that all pages were in the default character set for the client platform. @@ -93,20 +78,15 @@ <h2>Form Handling Problems</h2> <A NAME="buttons"><h3>HttpUnit is not finding the buttons and parameters in my forms. What is wrong?</h3></A> -This often happens when your HTML is not valid. Most browsers are extremely forgiving of bad HTML; however, -JTidy (the HTML parser originally used by HttpUnit) is not. It expects tags to be nested according to the HTML +If you are using JTidy (the HTML parser originally used by HttpUnit), this can happen when your HTML is not valid. +Most browsers are extremely forgiving of bad HTML; however, JTidy is not. It expects tags to be nested according to the HTML specification and will reject any that are not. JTidy can display error messages to tell you what is wrong. To see them, call <code>HttpUnitOptions.setParserWarningsEnabled( true )</code> before retrieving your HTML page. Once you have corrected any errors, HttpUnit should see your form buttons and parameters. -The <a href="http://www.httpunit.org/prerelease">latest pre-release build</a> supports -<a href="http://www.apache.org/~andyc/neko/doc/html/">NekoHTML</a>, a much more forgiving parser. -It is strongly recommended that you use it in preference to JTidy, as it should correct problems like this. - -<A NAME="#badPost"><h3>Why doesn't my servlet see parameters on a POST request?</h3></A> -Some older servlet engines, such as Tomcat 3.1, get confused when they see a charset attribute on the Content-Type -header. HttpUnit 1.2.6 sends this attribute; As of HttpUnit 1.2.7 it will only send it if you call -<code>HttpUnitOptions.setPostIncludesCharset(true)</code> before your request. +The <a href="http://www.apache.org/~andyc/neko/doc/html/">NekoHTML parser</a>, a much more forgiving parser, is the +parser used by default as of HttpUnit 1.5. It is strongly recommended that you use it in preference to JTidy, +as it should correct problems like this. <A name="#hidden"><h3>Why can't I change hidden parameter values?</h3></A> By default, HttpUnit verifies any parameter value changes against the form containing them. Since a user cannot directly |
|
From: Russell G. <rus...@us...> - 2002-11-03 18:18:23
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv770/src/com/meterware/httpunit
Modified Files:
HttpUnitOptions.java
Log Message:
default to text/html
Index: HttpUnitOptions.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- HttpUnitOptions.java 14 Oct 2002 18:27:43 -0000 1.31
+++ HttpUnitOptions.java 3 Nov 2002 18:18:19 -0000 1.32
@@ -459,7 +459,7 @@
//--------------------------------- private members --------------------------------------
- private static final String DEFAULT_CONTENT_TYPE = "text/plain";
+ private static final String DEFAULT_CONTENT_TYPE = "text/html";
private static final ScriptingEngineFactory NULL_SCRIPTING_ENGINE_FACTORY = new ScriptingEngineFactory() {
public boolean isEnabled() { return false; }
|
|
From: Russell G. <rus...@us...> - 2002-11-03 17:37:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies
In directory usw-pr-cvs1:/tmp/cvs-serv17912/src/com/meterware/httpunit/cookies
Modified Files:
Cookie.java
Added Files:
package.html
Log Message:
update JavaDoc
--- NEW FILE ---
<HTML><BODY>
<p>Classes to support cookie handling. Supports the HTTP state mechanism. The central class of this package is the
{@link com.meterware.httpunit.cookies.CookieJar}, which acts as a repository of
{@link com.meterware.httpunit.cookies.Cookie} objects. There are two main ways to get cookies into the
CookieJar. The first is to construct the CookieJar, passing a {@link com.meterware.httpunit.cookies.CookieSource}
to its constructor. This will cause the CookieJar to parse the Set-Cookie headers from the source object. The second is
to copy them from another CookieJar through use of the
{@link com.meterware.httpunit.cookies.CookieJar#updateCookies updateCookies(CookieJar)} method.</p>
<p>The CookieJar can also produce a Cookie header to be sent as part of a request.
The {@link com.meterware.httpunit.cookies.CookieJar#getCookieHeaderField} method
will select any cookies that it has which can be sent to the specified URL and assemble them into an appropriate header.</p>
</body></html>
Index: Cookie.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/cookies/Cookie.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Cookie.java 17 Oct 2002 23:50:49 -0000 1.1
+++ Cookie.java 3 Nov 2002 17:37:37 -0000 1.2
@@ -20,13 +20,12 @@
*
*******************************************************************************************************************/
import java.util.Map;
-import java.util.HashMap;
import java.util.Iterator;
import java.net.URL;
/**
- *
+ * An HTTP client-side cookie.
* @author <a href="mailto:rus...@ht...">Russell Gold</a>
**/
public class Cookie {
@@ -40,6 +39,9 @@
private String _domain;
+ /**
+ * Constructs a cookie w/o any domain or path restrictions.
+ */
Cookie( String name, String value ) {
_name = name;
_value = value;
@@ -59,21 +61,33 @@
}
+ /**
+ * Returns the name of this cookie.
+ */
public String getName() {
return _name;
}
+ /**
+ * Returns the value associated with this cookie.
+ */
public String getValue() {
return _value;
}
+ /**
+ * Returns the path to which this cookie is restricted.
+ */
public String getPath() {
return _path;
}
+ /**
+ * Returns the domain to which this cookie may be sent.
+ */
public String getDomain() {
return _domain;
}
|
|
From: Russell G. <rus...@us...> - 2002-11-03 17:37:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit In directory usw-pr-cvs1:/tmp/cvs-serv17912/src/com/meterware/httpunit Modified Files: package.html Log Message: update JavaDoc Index: package.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/package.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- package.html 26 Oct 2000 14:16:49 -0000 1.4 +++ package.html 3 Nov 2002 17:37:37 -0000 1.5 @@ -8,9 +8,20 @@ requests based on either submitting a form or clicking on a link. <H2>Installation</H2> -The package depends on <A HREF="http://lempinen.net/sami/jtidy">JTidy</A>, an HTML parser/validator. -The jtidy.jar must be in the class path ahead of any other implementation of the DOM classes. In addition, -unit tests will require <A HREF="http://junit.org/">JUnit</A> as well. +The package depends on a number of external jar files, provided in the <code>jar</code> directory: +<dl><dt>nekohtml.jar</dt><dd>The <a href="http://www.apache.org/~andyc/neko/doc/html/index.html">NekoHTML parser</a>, +used to convert raw HTML into an XML DOM. This is required for handling HTML.</dd> +<dt>js.jar</dt><dd>The <a href="http://www.mozilla.org/rhino">Rhino JavaScript interpreter<a>, required for any JavaScript processing.</dd> +<dt>xmlParserAPIs.jar</dt><dd>The interfaces for a W3-compliant XML parser. Required for interpreting either HTML or XML pages.</dd> +<dt>xercesImpl.jar</dt><dd>The <a href="http://xml.apache.org/xerces2-j/index.html">Xerces 2 implementation</a> of an XML parser. +NekoHTML requires this implementation. +<dt>servlet.jar</dt><dd>The APIs and common classes for the Java Servlet 1.3 standard. Required for use with <a href="../servletunit-intro.html">ServletUnit.</a></dd> +<dt>junit.jar</dt><dd><a href="http://www.junit.org">JUnit</a>, the unit test framework. Used to test HttpUnit and +recommended for writing tests that use HttpUnit.</dd> +</dl> +No longer included, but still supported, is <A HREF="http://lempinen.net/sami/jtidy">JTidy</A>, an alternate HTML parser/validator. +JTidy is a lot pickier about HTML structure than NekoHTML, and uses its own implementation of the DOM classes, rather than using those +found in the xerces jar. Some JavaScript features, such as <code>document.write()</code> will only work with NekoHTML. <H2>Example</H2> @@ -30,19 +41,15 @@ public static void main( String[] params ) { try { - WebRequest request; - WebResponse response; WebConversation conversation = new WebConversation(); - request = new GetMethodWebRequest( "http://www.meterware.com/servlet/TopSecret" ); - response = conversation.getResponse( request ); + WebResponse response = conversation.getResponse( "http://www.meterware.com/servlet/TopSecret" ); System.out.println( response ); WebForm loginForm = response.getForms()[0]; - request = loginForm.getRequest(); - request.setParameter( "name", "master" ); - response = conversation.getResponse( request ); + loginForm.setParameter( "name", "master" ); + response = loginForm.submit(); System.out.println( response ); } catch (Exception e) { @@ -52,5 +59,5 @@ } </PRE> -Please direct any questions to <A HREF="mailto:rus...@ac...">Russell Gold</A>. +Please direct any questions to <A HREF="mailto:rus...@ht...">Russell Gold</A>. </BODY></HTML> |