httpunit-commit Mailing List for httpunit (Page 31)
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...> - 2003-04-01 16:19:17
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv29589/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
Added support for JUnitServlet text formatting
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- JavaScript.java 28 Mar 2003 03:22:33 -0000 1.50
+++ JavaScript.java 1 Apr 2003 16:19:12 -0000 1.51
@@ -185,6 +185,7 @@
private void handleScriptException( Exception e, String badScript ) {
final String errorMessage = badScript + " failed: " + e;
if (!(e instanceof EcmaError) && !(e instanceof EvaluatorException)) {
+ e.printStackTrace();
throw new RuntimeException( errorMessage );
} else if (isThrowExceptionsOnError()) {
e.printStackTrace();
|
|
From: Russell G. <rus...@us...> - 2003-04-01 16:18:32
|
Update of /cvsroot/httpunit/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv29294
Modified Files:
index.html
Added Files:
site.css
Log Message:
Add new logo to web site
--- NEW FILE ---
FORM.sample { margin-left: 2%; margin-right: 2%;
padding-top: .5em; padding-bottom: .5em; padding-right: .5em; padding-left: .5em;
background-color: #cccccc; border-color: #0000cc; border-width: 2; border-style: solid }
H2 { padding-left: .5em; padding-top: .1em; padding-bottom: .1 em; margin-bottom: 1em;
color: white; background-color: #666699; border-width: 2; border-style: solid; border-color: #330066 }
P.main { padding-left: 3em }
SPAN.code { font-family: courier, monospaced, sans-serif }
PRE { font-family: "courier new", courier; font-size: 8pt;
margin-left: 2%; margin-right: 2%;
padding-top: .5em; padding-bottom: .5em; padding-right: .5em; padding-left: .5em;
border-color: black; border-width: 2; border-style: solid }
PRE.code-examples { background-color: #cccccc }
Index: index.html
===================================================================
RCS file: /cvsroot/httpunit/httpunit/index.html,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- index.html 25 Sep 2002 16:20:52 -0000 1.23
+++ index.html 1 Apr 2003 16:18:26 -0000 1.24
@@ -1,9 +1,10 @@
<HTML>
<HEAD>
<TITLE>HttpUnit</TITLE>
+ <LINK REL="stylesheet" HREF="site.css" TYPE="text/css">
</HEAD>
-<H1>HttpUnit</H1>
+<img src="doc/images/HttpUnit.jpg">
<P>The normal way to access web sites is via a browser; however, there are times when it is desirable to
bypass the browser and access a site from a program, including:
@@ -22,37 +23,37 @@
<h2>What is it?</h2>
-<blockquote>
-
-<strong>HttpUnit</strong> is a free, <A HREF="doc/license.html">open source</A> Java API for accessing web sites without a browser,
+<p class="main"><strong>HttpUnit</strong> is a free, <A HREF="doc/license.html">open source</A> Java API for accessing web sites without a browser,
and is ideally suited for automated unit testing of web sites when combined with a
Java unit test framework such as <A HREF="http://www.junit.org">JUnit</a>.
-It was designed and implemented by <a href="mailto:rus...@ht...">Russell Gold.</a></blockquote>
+It was designed and implemented by <a href="mailto:rus...@ht...">Russell Gold.</a></p>
-<h2>Documentation</h2>
-<blockquote>A rudimentary <A HREF="doc/Cookbook.html">User's manual</A> is
+<h2>How do I use it?</h2>
+<p class="main">Several working example files come with the distribution download.
+A rudimentary <A HREF="doc/Cookbook.html">Cookbook</A> is
available, as are a <a href="doc/tutorial/index.html">tutorial</a>, a <A HREF="doc/faq.html">FAQ</A> and
-the <A HREF="doc/api/index.html">javadoc</A>.
-Several working example files come with the distribution download.<br />
-In addition, Wiley press has published
+the <A HREF="doc/api/index.html">javadoc</A>. Work has also begun on a <a href="doc/manual/index.html">User's Manual</a>.</p>
+
+<p class="main">In addition, Wiley press has published
<a href="http://www.wiley.com/Corporate/Website/Objects/Products/0,9049,1847817,00.html">
<i>Java Tools for Extreme Programming: Mastering Open Source Tools, including Ant, JUnit, and Cactus</i></a>
-which contains two chapters dealing with HttpUnit.</blockquote>
+which contains two chapters dealing with HttpUnit.</p>
<h2>Where do I get releases?</h2>
-<blockquote>Releases of HttpUnit are available
+<p class="main">Releases of HttpUnit are available
from <a href="http://sourceforge.net/project/showfiles.php?group_id=6550"> the project download page.</a>
<br>Other builds are available from <a href="http://www.httpunit.org/prerelease">the pre-release directory</a>.
-</blockquote>
+</p>
<h2>How do I get help, contribute, give feedback, fix bugs and so on?</h2>
+<p class="main">
<ul>
<li>We have a <a href="http://lists.sourceforge.net/mailman/listinfo/httpunit-develop">mailing list</a> for discussion of
the code.
<li>Read-only access to the CVS "<b>HttpUnit</b>" repository is available both
<a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/httpunit/">online</a> as well as with
a cvs client, accessing the repository at <code>:pserver:ano...@cv...:/cvsroot/httpunit</code>.
-</ul>
+</ul></p>
<hr><P><font size=-2><var:publish>Hosted by
<IMG SRC="http://sourceforge.net/sflogo.php?group_id=6550&type=1"
|
|
From: Russell G. <rus...@us...> - 2003-04-01 16:18:32
|
Update of /cvsroot/httpunit/httpunit/doc/images In directory sc8-pr-cvs1:/tmp/cvs-serv29294/doc/images Added Files: HttpUnit.jpg Log Message: Add new logo to web site --- NEW FILE --- ÿØÿà ÿ &wÁv÷²×Ùöÿ ðÁ0§ Ù<Jvv|Î6Ñ>eý6 #'΢ù/9Ve:mv;ôéJÁîTrLcÐ#¦ñ9i¼n¯PUÃdrmy6²dÊ**U¹èÐÙ£oèÛ¬2ÿÚ *§.æöÅ3þ`c!¨ÿ ´Èc26®&s®Q²ÈǼ¯"e#"1*¸Î&2ààt©a*Ë$ë_×`ßC7ðR¢UBÆus,)µ(e8âÔéY£¥eY¥¥²¬ÈI6´Úÿ = 1ÿ »éÌ¡®¹ÄµYÏIGÀ6Óiªhçø5 u«+,n>2/\ GWÕDEÜuN*WWå_~'ÿÚ ÷£z# Î3 3»¹Tn,Òĵá^?Lð1úX;COÓ/[ K¦ÄK%1Æ?"ÆÇäÆ=ÃÿÚ ëQèF?ÿ |
|
From: Russell G. <rus...@us...> - 2003-04-01 13:42:15
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv11716/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java
Log Message:
#709979: Correct Select.selectedIndex when nothing selected
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- FormScriptingTest.java 14 Mar 2003 17:41:30 -0000 1.20
+++ FormScriptingTest.java 1 Apr 2003 13:42:09 -0000 1.21
@@ -599,6 +599,29 @@
public void testFormSelectWriteableProperties() throws Exception {
+ defineResource( "OnCommand.html", "<html><head></head>" +
+ "<body>" +
+ "<form name='the_form'>" +
+ " <select name='choices'>" +
+ " <option value='1'>red" +
+ " <option value='3'>blue" +
+ " <option value='5'>green" +
+ " <option value='7'>azure" +
+ " </select>" +
+ "</form>" +
+ "<a href='#' onclick='alert( \"Selected index is \" + document.the_form.choices.selectedIndex );'>" +
+ "</body></html>" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ WebForm form = response.getFormWithName( "the_form" );
+ assertEquals( "initial selection", "1", form.getParameterValue( "choices" ) );
+
+ response.getLinks()[0].click();
+ assertEquals( "Notification", "Selected index is 0", wc.popNextAlert() );
+ }
+
+
+ public void testFormSelectDefaultProperties() throws Exception {
defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" +
"function selectOptionNum( the_select, index ) { \n" +
" for (var i = 0; i < the_select.length; i++) {\n" +
|
|
From: Russell G. <rus...@us...> - 2003-04-01 13:42:15
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv11716/src/com/meterware/httpunit
Modified Files:
FormControl.java
Log Message:
#709979: Correct Select.selectedIndex when nothing selected
Index: FormControl.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/FormControl.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- FormControl.java 13 Mar 2003 18:20:49 -0000 1.37
+++ FormControl.java 1 Apr 2003 13:42:09 -0000 1.38
@@ -1092,7 +1092,7 @@
for (int i = 0; i < _options.length; i++) {
if (_options[i].isSelected()) return i;
}
- return -1;
+ return _multiSelect ? -1 : 0;
}
|
|
From: Russell G. <rus...@us...> - 2003-04-01 13:42:14
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv11716/doc
Modified Files:
release_notes.txt
Log Message:
#709979: Correct Select.selectedIndex when nothing selected
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.286
retrieving revision 1.287
diff -u -r1.286 -r1.287
--- release_notes.txt 1 Apr 2003 12:55:24 -0000 1.286
+++ release_notes.txt 1 Apr 2003 13:42:09 -0000 1.287
@@ -16,6 +16,7 @@
1-Apr-2003
Problems fixed:
1. HttpUnit now handles refresh headers without explicit URLs, defaulting to refreshing the containing page.
+ 2. Bug #709979: Select.selectedIndex was returning -1 for a normal select box with no options explicitly selected.
28-Mar-2003
Acknowledgements:
|
|
From: Russell G. <rus...@us...> - 2003-04-01 12:55:32
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv22765/doc
Modified Files:
release_notes.txt
Log Message:
Fix handling of refresh header
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.285
retrieving revision 1.286
diff -u -r1.285 -r1.286
--- release_notes.txt 28 Mar 2003 03:22:32 -0000 1.285
+++ release_notes.txt 1 Apr 2003 12:55:24 -0000 1.286
@@ -13,6 +13,14 @@
Revision History:
+ 1-Apr-2003
+Problems fixed:
+ 1. HttpUnit now handles refresh headers without explicit URLs, defaulting to refreshing the containing page.
+
+28-Mar-2003
+Acknowledgements:
+ Thanks to Ron Webster for designing the new HttpUnit logo.
+
27-Mar-2003
Acknowledgements:
Thanks to Mark Luty for supplying a test for the getElementsByName function.
|
|
From: Russell G. <rus...@us...> - 2003-04-01 12:55:32
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv22765/test/com/meterware/httpunit
Modified Files:
WebPageTest.java
Log Message:
Fix handling of refresh header
Index: WebPageTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/WebPageTest.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- WebPageTest.java 19 Mar 2003 03:38:07 -0000 1.30
+++ WebPageTest.java 1 Apr 2003 12:55:25 -0000 1.31
@@ -319,6 +319,40 @@
}
+ public void testMetaRefreshURLRequestNoDelay() throws Exception {
+ String refreshURL = getHostPath() + "/NextPage.html";
+ String page = "<html><head><title>Sample</title>" +
+ "<meta Http-equiv=refresh content='URL=\"NextPage.html\"></head>\n" +
+ "<body>This has no data\n" +
+ "</body></html>\n";
+ defineResource( "SimplePage.html", page );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertEquals( "Refresh URL", refreshURL, simplePage.getRefreshRequest().getURL().toExternalForm() );
+ assertEquals( "Refresh delay", 0, simplePage.getRefreshDelay() );
+ }
+
+
+ public void testMetaRefreshURLRequestDelayOnly() throws Exception {
+ String refreshURL = getHostPath() + "/SimplePage.html";
+ String page = "<html><head><title>Sample</title>" +
+ "<meta Http-equiv=refresh content='5'></head>\n" +
+ "<body>This has no data\n" +
+ "</body></html>\n";
+ defineResource( "SimplePage.html", page );
+
+ WebConversation wc = new WebConversation();
+ WebRequest request = new GetMethodWebRequest( getHostPath() + "/SimplePage.html" );
+ WebResponse simplePage = wc.getResponse( request );
+
+ assertEquals( "Refresh URL", refreshURL, simplePage.getRefreshRequest().getURL().toExternalForm() );
+ assertEquals( "Refresh delay", 5, simplePage.getRefreshDelay() );
+ }
+
+
public void testAutoRefresh() throws Exception {
String refreshURL = getHostPath() + "/NextPage.html";
String page = "<html><head><title>Sample</title>" +
|
|
From: Russell G. <rus...@us...> - 2003-04-01 12:55:32
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv22765/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
Fix handling of refresh header
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.114
retrieving revision 1.115
diff -u -r1.114 -r1.115
--- WebResponse.java 19 Mar 2003 19:05:40 -0000 1.114
+++ WebResponse.java 1 Apr 2003 12:55:24 -0000 1.115
@@ -31,6 +31,7 @@
import java.net.MalformedURLException;
import java.util.Hashtable;
import java.util.Vector;
+import java.util.StringTokenizer;
import java.util.zip.GZIPInputStream;
import org.w3c.dom.Document;
@@ -886,15 +887,21 @@
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( _pageURL, getRefreshURL( refreshHeader.substring( splitIndex+1 ) ), _frameName );
- } catch (NumberFormatException e) {
- _refreshDelay = 0;
- System.out.println( "Unable to interpret refresh tag: \"" + refreshHeader + '"' );
+ StringTokenizer st = new StringTokenizer( refreshHeader, ";" );
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken();
+ if (token.length() == 0) continue;
+ try {
+ if (Character.isDigit( token.charAt(0) )) {
+ _refreshDelay = Integer.parseInt( token );
+ } else {
+ _refreshRequest = new GetMethodWebRequest( _pageURL, getRefreshURL( token ), _frameName );
+ }
+ } catch (NumberFormatException e) {
+ System.out.println( "Unable to interpret refresh tag: \"" + refreshHeader + '"' );
+ }
}
+ if (_refreshRequest == null) _refreshRequest = new GetMethodWebRequest( _pageURL, _pageURL.toString(), _frameName );
}
|
|
From: Russell G. <rus...@us...> - 2003-03-28 14:52:24
|
Update of /cvsroot/httpunit/httpunit/doc/images In directory sc8-pr-cvs1:/tmp/cvs-serv19500/images Log Message: Directory /cvsroot/httpunit/httpunit/doc/images added to the repository |
|
From: Russell G. <rus...@us...> - 2003-03-28 03:22:40
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv15073/test/com/meterware/httpunit/javascript
Modified Files:
HTMLElementTest.java
Log Message:
add support for getElementsByName
Index: HTMLElementTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/HTMLElementTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HTMLElementTest.java 9 Jan 2003 18:02:24 -0000 1.2
+++ HTMLElementTest.java 28 Mar 2003 03:22:34 -0000 1.3
@@ -2,7 +2,7 @@
/********************************************************************************************************************
* $Id$
*
- * Copyright (c) 2002, Russell Gold
+ * Copyright (c) 2002-2003, 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
@@ -62,17 +62,46 @@
WebConversation wc = new WebConversation();
wc.getResponse( getHostPath() + "/start.html" );
- assertElementTitle( wc, "there", "second" );
- assertElementTitle( wc, "perform", "fifth" );
- assertElementTitle( wc, "doIt", "sixth" );
- assertElementTitle( wc, "grouping", "third" );
- assertElementTitle( wc, "aCell", "fourth" );
- assertElementTitle( wc, "myDiv", "first" );
+ assertElementTitle( wc, "id", "there", "second" );
+ assertElementTitle( wc, "id", "perform", "fifth" );
+ assertElementTitle( wc, "id", "doIt", "sixth" );
+ assertElementTitle( wc, "id", "grouping", "third" );
+ assertElementTitle( wc, "id", "aCell", "fourth" );
+ assertElementTitle( wc, "id", "myDiv", "first" );
}
- private void assertElementTitle( WebConversation wc, final String id, final String title ) {
- assertEquals( "element '" + id + "' message", "element with id " + id + " has title " + title, wc.popNextAlert() );
+ public void testNameProperty() throws Exception {
+ defineResource( "start.html",
+ "<html><head><script language='JavaScript'>" +
+ "function showTitle( name ) {" +
+ " var elements = document.getElementsByName( name );" +
+ " for( i = 0; i < elements.length; i++) {" +
+ " alert( 'element with name ' + name + ' has title ' + elements[i].title );" +
+ " }" +
+ "}" +
+ "function showAll() {" +
+ " showTitle( 'there' ); showTitle( 'perform' ); showTitle( 'doIt' );" +
+ " showTitle( 'input' );" +
+ "}</script>" +
+ "</head><body onLoad='showAll();'>" +
+ "<a href='somewhere' name='there' title=second>here</a>" +
+ "<form name='perform' title=fifth><input type='text' name='input' title='input1'>" +
+ "<input type='hidden' name='input' title='input2'><input type='submit' name='doIt' title=sixth></form>" +
+ "</td></tr></table></div></body></html>" );
+ WebConversation wc = new WebConversation();
+ wc.getResponse( getHostPath() + "/start.html" );
+
+ assertElementTitle( wc, "name", "there", "second" );
+ assertElementTitle( wc, "name", "perform", "fifth" );
+ assertElementTitle( wc, "name", "doIt", "sixth" );
+ assertElementTitle( wc, "name", "input", "input1" );
+ assertElementTitle( wc, "name", "input", "input2" );
+ }
+
+
+ private void assertElementTitle( WebConversation wc, String propertyName, final String id, final String title ) {
+ assertEquals( "element '" + id + "' message", "element with " + propertyName + ' ' + id + " has title " + title, wc.popNextAlert() );
}
|
|
From: Russell G. <rus...@us...> - 2003-03-28 03:22:40
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv15073/src/com/meterware/httpunit/javascript
Modified Files:
JavaScript.java
Log Message:
add support for getElementsByName
Index: JavaScript.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/javascript/JavaScript.java,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- JavaScript.java 19 Mar 2003 19:05:38 -0000 1.49
+++ JavaScript.java 28 Mar 2003 03:22:33 -0000 1.50
@@ -504,6 +504,18 @@
}
+ public Object jsFunction_getElementsByName( String name ) {
+ ScriptableDelegate scriptables[] = getDelegate().getElementsByName( name );
+ JavaScriptEngine[] elements = new JavaScriptEngine[ scriptables.length ];
+ for (int i = 0; i < elements.length; i++) {
+ elements[ i ] = (JavaScriptEngine) toScriptable( scriptables[ i ] );
+ }
+ ElementArray result = ElementArray.newElementArray( this );
+ result.initialize( elements );
+ return result;
+ }
+
+
public Object jsGet_location() {
return _parent == null ? NOT_FOUND : getWindow().jsGet_location();
}
|
|
From: Russell G. <rus...@us...> - 2003-03-28 03:22:39
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv15073/src/com/meterware/httpunit
Modified Files:
HTMLPage.java ParsedHTML.java
Log Message:
add support for getElementsByName
Index: HTMLPage.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HTMLPage.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- HTMLPage.java 19 Mar 2003 19:05:39 -0000 1.27
+++ HTMLPage.java 28 Mar 2003 03:22:33 -0000 1.28
@@ -218,6 +218,16 @@
final HTMLElement elementWithID = HTMLPage.this.getElementWithID( id );
return elementWithID == null ? null : elementWithID.getScriptableDelegate();
}
+
+
+ public ScriptableDelegate[] getElementsByName( String name ) {
+ final HTMLElement[] elements = HTMLPage.this.getElementsByName( name );
+ ScriptableDelegate[] result = new ScriptableDelegate[ elements.length ];
+ for (int i = 0; i < elements.length; i++) {
+ result[i] = elements[i].getScriptableDelegate();
+ }
+ return result;
+ }
}
Index: ParsedHTML.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/ParsedHTML.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- ParsedHTML.java 9 Mar 2003 20:35:46 -0000 1.45
+++ ParsedHTML.java 28 Mar 2003 03:22:33 -0000 1.46
@@ -34,6 +34,8 @@
**/
class ParsedHTML {
+ final static private HTMLElement[] NO_ELEMENTS = new HTMLElement[0];
+
private Node _rootNode;
private URL _baseURL;
@@ -53,6 +55,9 @@
/** map of element IDs to elements. **/
private HashMap _elementsByID = new HashMap();
+ /** map of element names to lists of elements. **/
+ private HashMap _elementsByName = new HashMap();
+
/** map of DOM elements to HTML elements **/
private HashMap _elements = new HashMap();
@@ -154,6 +159,14 @@
}
+
+ HTMLElement[] getElementsByName( String name ) {
+ loadElements();
+ ArrayList elements = (ArrayList) _elementsByName.get( name );
+ return elements == null ? NO_ELEMENTS : (HTMLElement[]) elements.toArray( new HTMLElement[ elements.size() ] );
+ }
+
+
/**
* Returns the form found in the page with the specified ID.
**/
@@ -547,6 +560,14 @@
private void addToMaps( Element element, HTMLElement htmlElement ) {
_elements.put( element, htmlElement );
if (htmlElement.getID() != null) _elementsByID.put( htmlElement.getID(), htmlElement );
+ if (htmlElement.getName() != null) addNamedElement( htmlElement.getName(), htmlElement );
+ }
+
+
+ private void addNamedElement( String name, HTMLElement htmlElement ) {
+ List list = (List) _elementsByName.get( name );
+ if (list == null) _elementsByName.put( name, list = new ArrayList() );
+ list.add( htmlElement );
}
|
|
From: Russell G. <rus...@us...> - 2003-03-28 03:22:39
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv15073/doc
Modified Files:
Javascript-support.html release_notes.txt
Log Message:
add support for getElementsByName
Index: Javascript-support.html
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/Javascript-support.html,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- Javascript-support.html 13 Mar 2003 18:20:46 -0000 1.35
+++ Javascript-support.html 28 Mar 2003 03:22:32 -0000 1.36
@@ -94,6 +94,7 @@
<li>open - opens a document for writing, optionally specifying a MIME type</li>
<li>close - closes the open document and replaces its contents with the written text</li>
<li>getElementById - returns the element in the document with the specified ID</li>
+<li>getElementsByName - returns an array of all elements in the document with the specified name</li>
<li>write - writes a string to the contents of the current open document</li>
<li>writeln - writes a line with carriage-return to the contents of the current open document</li>
</ul>
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.284
retrieving revision 1.285
diff -u -r1.284 -r1.285
--- release_notes.txt 27 Mar 2003 03:36:37 -0000 1.284
+++ release_notes.txt 28 Mar 2003 03:22:32 -0000 1.285
@@ -13,6 +13,13 @@
Revision History:
+27-Mar-2003
+Acknowledgements:
+ Thanks to Mark Luty for supplying a test for the getElementsByName function.
+
+Additions:
+ 1. Document.getElementsByName is now supported
+
26-Mar-2003
Problems fixed:
1. HttpUnit was chopping off javascript urls if they contained a '#' character.
|
|
From: Russell G. <rus...@us...> - 2003-03-27 03:36:41
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv20388/doc
Modified Files:
release_notes.txt
Log Message:
don't chop off javascript URLs at pound sign
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.283
retrieving revision 1.284
diff -u -r1.283 -r1.284
--- release_notes.txt 24 Mar 2003 15:04:30 -0000 1.283
+++ release_notes.txt 27 Mar 2003 03:36:37 -0000 1.284
@@ -13,6 +13,10 @@
Revision History:
+26-Mar-2003
+Problems fixed:
+ 1. HttpUnit was chopping off javascript urls if they contained a '#' character.
+
24-Mar-2003
Acknowledgements:
Thanks to Andrew Bickerton for identifying the javascript parent frame update problem and suggesting a fix.
|
|
From: Russell G. <rus...@us...> - 2003-03-27 03:36:41
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv20388/src/com/meterware/httpunit
Modified Files:
HttpUnitOptions.java WebRequestSource.java
Log Message:
don't chop off javascript URLs at pound sign
Index: HttpUnitOptions.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitOptions.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- HttpUnitOptions.java 16 Mar 2003 17:22:38 -0000 1.38
+++ HttpUnitOptions.java 27 Mar 2003 03:36:37 -0000 1.39
@@ -48,7 +48,7 @@
_loggingHttpHeaders = false;
_matchesIgnoreCase = true;
_checkContentLength = false;
- _redirectDelay = 0;
+ _redirectDelay = 0; // TODO move this to ClientProperties
_characterSet = HttpUnitUtils.DEFAULT_CHARACTER_SET;
_contentType = DEFAULT_CONTENT_TYPE;
_postIncludesCharset = false;
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- WebRequestSource.java 24 Mar 2003 15:04:31 -0000 1.26
+++ WebRequestSource.java 27 Mar 2003 03:36:37 -0000 1.27
@@ -142,6 +142,7 @@
private String trimFragment( String href ) {
+ if (href.startsWith( "javascript:" )) return href;
final int hashIndex = href.indexOf( '#' );
if (hashIndex < 0) {
return href;
|
|
From: Russell G. <rus...@us...> - 2003-03-27 03:36:41
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv20388/test/com/meterware/httpunit/javascript
Modified Files:
ScriptingTest.java
Log Message:
don't chop off javascript URLs at pound sign
Index: ScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- ScriptingTest.java 14 Mar 2003 17:41:30 -0000 1.51
+++ ScriptingTest.java 27 Mar 2003 03:36:37 -0000 1.52
@@ -275,6 +275,29 @@
}
+ public void testJavascriptURLWithFragment() throws Exception {
+ defineResource( "Target.txt", "You made it!", "text/plain" );
+ defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
+ "<body><script language='JavaScript'>function newWindow(hrefTarget) {" +
+ " window.open(hrefTarget);" +
+ "}</script>" +
+ "<a href='javascript:newWindow( \"" + getHostPath() + "/Target.txt#middle\" );'>go</a>" +
+ "</body></html>" );
+ final ArrayList windowsOpened = new ArrayList();
+ WebConversation wc = new WebConversation();
+ wc.addWindowListener( new WebWindowListener() {
+ public void windowOpened( WebClient client, WebWindow window ) { windowsOpened.add( window ); }
+ public void windowClosed( WebClient client, WebWindow window ) {}
+ } );
+ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ response.getLinks()[0].click();
+
+ assertFalse( "No window opened", windowsOpened.isEmpty() );
+ final WebWindow openedWindow = (WebWindow) windowsOpened.get( 0 );
+ assertEquals( "New window message", "You made it!", openedWindow.getCurrentPage().getText() );
+ }
+
+
public void testWindowOpenNoContents() throws Exception {
defineResource( "OnCommand.html", "<html><head><title>Amazing!</title></head>" +
"<body>" +
|
|
From: Russell G. <rus...@us...> - 2003-03-24 15:12:22
|
Update of /cvsroot/httpunit/httpunit/doc In directory sc8-pr-cvs1:/tmp/cvs-serv23127/doc Modified Files: faq.html Log Message: updated FAQ Index: faq.html =================================================================== RCS file: /cvsroot/httpunit/httpunit/doc/faq.html,v retrieving revision 1.27 retrieving revision 1.28 diff -u -r1.27 -r1.28 --- faq.html 20 Mar 2003 14:50:51 -0000 1.27 +++ faq.html 24 Mar 2003 15:12:14 -0000 1.28 @@ -26,10 +26,11 @@ </ol><ol start=11> <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="#nofunction">My JavaScript works in a browser, but HttpUnit says "ReferenceError: ... is not defined"</A></LI> <li><a href="#unsupported">How do I handle a page that uses JavaScript features that HttpUnit does not support?</a></li> <li><a href="#text">I called document.write() in my page, but getText() does not show the results! Why not?</a></li> -</ol><ol start=15> +</ol><ol start=16> <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> </OL> @@ -130,6 +131,12 @@ <A NAME="norhino"><h3>JavaScript is not being executed at all. Why not?</h3></A> If you do not have the Rhino JAR (js.jar) in your classpath, JavaScript features do not work. + +<A NAME="#nofunction"><h3>My JavaScript works in a browser, but HttpUnit says "ReferenceError: ... is not defined"</h3></A> +This usually indicates that you are calling a function which contains statements that HttpUnit does not understand. +Rhino unfortunately does not provide a very helpful error message in such cases. Try removing statements from the +function until you find out which one is causing the problem and then submit a request for the offending construct to be +supported. <a name="unsupported"><h3>How do I handle a page that uses JavaScript features that HttpUnit does not support?</h3></a> If you call<blockquote><code>HttpUnitOptions.setExceptionsThrownOnScriptError( false );</code></blockquote>problems will |
|
From: Russell G. <rus...@us...> - 2003-03-24 15:05:06
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv14667/doc
Modified Files:
release_notes.txt
Log Message:
Corrected javascript link which updates parent frame problem
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.282
retrieving revision 1.283
diff -u -r1.282 -r1.283
--- release_notes.txt 24 Mar 2003 03:22:09 -0000 1.282
+++ release_notes.txt 24 Mar 2003 15:04:30 -0000 1.283
@@ -13,6 +13,14 @@
Revision History:
+24-Mar-2003
+Acknowledgements:
+ Thanks to Andrew Bickerton for identifying the javascript parent frame update problem and suggesting a fix.
+
+Problems fixed:
+ 1. Following a javascript link which updated a parent frame via manipulating the location was causing a 'NoSuchFrame'
+ exception to be thrown.
+
23-Mar-2003
Problems fixed:
1. ServletUnit had not implemented HttpServletRequest.getURL();
|
|
From: Russell G. <rus...@us...> - 2003-03-24 15:04:50
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv14667/src/com/meterware/httpunit
Modified Files:
WebRequestSource.java WebWindow.java
Log Message:
Corrected javascript link which updates parent frame problem
Index: WebRequestSource.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebRequestSource.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- WebRequestSource.java 14 Mar 2003 17:41:29 -0000 1.25
+++ WebRequestSource.java 24 Mar 2003 15:04:31 -0000 1.26
@@ -205,8 +205,13 @@
protected WebResponse submitRequest( String event, final WebRequest request ) throws IOException, SAXException {
WebResponse response = null;
if (event.length() == 0 || getScriptableDelegate().doEvent( event )) response = submitRequest( request );
- if (response == null) response = getBaseResponse().getWindow().getFrameContents( getPageFrame() );
+ if (response == null) response = getCurrentFrame( getBaseResponse().getWindow(), getPageFrame() );
return response;
+ }
+
+
+ private WebResponse getCurrentFrame( WebWindow window, String pageFrame ) {
+ return window.hasFrame( pageFrame ) ? window.getFrameContents( pageFrame ) : window.getCurrentPage();
}
Index: WebWindow.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebWindow.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- WebWindow.java 16 Mar 2003 17:22:38 -0000 1.11
+++ WebWindow.java 24 Mar 2003 15:04:33 -0000 1.12
@@ -179,6 +179,14 @@
/**
+ * Returns true if the specified frame name is defined in this window.
+ */
+ public boolean hasFrame( String frameName ) {
+ return _frameContents.get( frameName ) != null;
+ }
+
+
+ /**
* Returns the response associated with the specified frame name.
* Throws a runtime exception if no matching frame is defined.
**/
@@ -239,6 +247,5 @@
&& response.getResponseCode() <= HttpURLConnection.HTTP_MOVED_TEMP
&& response.getHeaderField( "Location" ) != null;
}
-
}
|
|
From: Russell G. <rus...@us...> - 2003-03-24 15:04:50
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv14667/test/com/meterware/httpunit/javascript
Modified Files:
FrameScriptingTest.java
Log Message:
Corrected javascript link which updates parent frame problem
Index: FrameScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FrameScriptingTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FrameScriptingTest.java 7 Mar 2003 05:04:03 -0000 1.1
+++ FrameScriptingTest.java 24 Mar 2003 15:04:33 -0000 1.2
@@ -176,5 +176,25 @@
assertEquals("Content of blue frame after clicking menu link", "Menu/Page/Target", _wc.getFrameContents("blue").getTitle());
}
+
+ /**
+ * Verifies that a javascript URL which triggers refresh to the parent of a frame resolves with something sensible.
+ */
+ public void testJavaScriptURLToParentFrame() throws Exception {
+ defineResource( "Frames.html",
+ "<HTML><HEAD><TITLE>Initial</TITLE></HEAD>" +
+ "<FRAMESET cols=\"20%,80%\">" +
+ " <FRAME src='Linker.html' name='red'>" +
+ " <FRAME src=Form name=blue>" +
+ "</FRAMESET></HTML>" );
+ defineWebPage( "Linker", "This is a trivial page with <a href='javascript:window.parent.location.replace( \"Target\" );'>one link</a>" );
+ defineResource( "Form", "This is a page with nothing we care about");
+ defineResource( "Target", "You made it!", "text/plain" );
+
+ _wc.getResponse( getHostPath() + "/Frames.html" );
+ WebResponse result = _wc.getFrameContents( "red" ).getLinkWith( "one link" ).click();
+ assertEquals( "Result of click", "You made it!", result.getText() );
+ }
+
private WebConversation _wc;
}
|
|
From: Russell G. <rus...@us...> - 2003-03-24 03:22:43
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory sc8-pr-cvs1:/tmp/cvs-serv28617/src/com/meterware/httpunit
Modified Files:
HttpUnitUtils.java TableCell.java
Log Message:
small fixes
Index: HttpUnitUtils.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpUnitUtils.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- HttpUnitUtils.java 13 Sep 2002 14:17:25 -0000 1.11
+++ HttpUnitUtils.java 24 Mar 2003 03:22:09 -0000 1.12
@@ -34,7 +34,7 @@
public static final int DEFAULT_TEXT_BUFFER_SIZE = 2048;
public static final int DEFAULT_BUFFER_SIZE = 128;
- static final String DEFAULT_CHARACTER_SET = "iso-8859-1";
+ public static final String DEFAULT_CHARACTER_SET = "iso-8859-1";
/**
Index: TableCell.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/TableCell.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- TableCell.java 4 Feb 2003 05:32:03 -0000 1.11
+++ TableCell.java 24 Mar 2003 03:22:09 -0000 1.12
@@ -111,6 +111,21 @@
}
+ public boolean equals( Object obj ) {
+ return obj instanceof TableCell && equals( (TableCell) obj );
+ }
+
+
+ private boolean equals( TableCell cell ) {
+ return _element.equals( cell._element );
+ }
+
+
+ public int hashCode() {
+ return _element.hashCode();
+ }
+
+
//---------------------------------------- package methods -----------------------------------------
|
|
From: Russell G. <rus...@us...> - 2003-03-24 03:22:43
|
Update of /cvsroot/httpunit/httpunit/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv28617/doc
Modified Files:
release_notes.txt
Log Message:
small fixes
Index: release_notes.txt
===================================================================
RCS file: /cvsroot/httpunit/httpunit/doc/release_notes.txt,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -r1.281 -r1.282
--- release_notes.txt 20 Mar 2003 14:50:52 -0000 1.281
+++ release_notes.txt 24 Mar 2003 03:22:09 -0000 1.282
@@ -13,6 +13,11 @@
Revision History:
+ 23-Mar-2003
+Problems fixed:
+ 1. ServletUnit had not implemented HttpServletRequest.getURL();
+ 2. ServletUnit was always supplying a charset parameter, even when not requested.
+
20-Mar-2003
Problems fixed:
1. ServletUnit had not implemented HttpServletRequest.getContentLength();
|
|
From: Russell G. <rus...@us...> - 2003-03-24 03:22:24
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/servletunit
In directory sc8-pr-cvs1:/tmp/cvs-serv28617/test/com/meterware/servletunit
Modified Files:
HttpServletRequestTest.java HttpServletResponseTest.java
Log Message:
small fixes
Index: HttpServletRequestTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/HttpServletRequestTest.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- HttpServletRequestTest.java 20 Mar 2003 14:50:54 -0000 1.17
+++ HttpServletRequestTest.java 24 Mar 2003 03:22:11 -0000 1.18
@@ -369,10 +369,12 @@
ServletUnitHttpRequest request = new ServletUnitHttpRequest( NULL_SERVLET_REQUEST, wr, context, new Hashtable(), NO_MESSAGE_BODY );
assertEquals("/simple", request.getRequestURI());
+ assertEquals( "http://localhost/simple", request.getRequestURL().toString() );
wr = new GetMethodWebRequest( "http://localhost/simple?foo=bar" );
request = new ServletUnitHttpRequest( NULL_SERVLET_REQUEST, wr, context, new Hashtable(), NO_MESSAGE_BODY );
assertEquals("/simple", request.getRequestURI());
+ assertEquals( "http://localhost/simple", request.getRequestURL().toString() );
}
Index: HttpServletResponseTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/servletunit/HttpServletResponseTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- HttpServletResponseTest.java 27 Feb 2003 18:40:39 -0000 1.9
+++ HttpServletResponseTest.java 24 Mar 2003 03:22:12 -0000 1.10
@@ -71,6 +71,8 @@
assertEquals( "Content type", "text/html", response.getContentType() );
assertEquals( "Title", "Sample Page", response.getTitle() );
assertEquals( "Content length", 65, response.getContentLength() );
+ assertEquals( "Content encoding", "iso-8859-1", response.getCharacterSet() );
+ assertEquals( "Content header", "text/html", response.getHeaderField( "Content-type" ) );
}
|
|
From: Russell G. <rus...@us...> - 2003-03-24 03:22:20
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/servletunit
In directory sc8-pr-cvs1:/tmp/cvs-serv28617/src/com/meterware/servletunit
Modified Files:
ServletUnitHttpRequest.java ServletUnitHttpResponse.java
Log Message:
small fixes
Index: ServletUnitHttpRequest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpRequest.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- ServletUnitHttpRequest.java 20 Mar 2003 14:50:53 -0000 1.28
+++ ServletUnitHttpRequest.java 24 Mar 2003 03:22:10 -0000 1.29
@@ -669,7 +669,15 @@
* @since 1.3
*/
public StringBuffer getRequestURL() {
- return null;
+ StringBuffer url = new StringBuffer();
+ try {
+ url.append( _request.getURL().getProtocol() ).append( "://" );
+ url.append( _request.getURL().getHost() );
+ url.append( _request.getURL().getPath() );
+ } catch (MalformedURLException e) {
+ throw new RuntimeException( "unable to read URL from request: " + _request );
+ }
+ return url;
}
Index: ServletUnitHttpResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/servletunit/ServletUnitHttpResponse.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- ServletUnitHttpResponse.java 27 Feb 2003 18:40:39 -0000 1.18
+++ ServletUnitHttpResponse.java 24 Mar 2003 03:22:11 -0000 1.19
@@ -1,5 +1,4 @@
package com.meterware.servletunit;
-
/********************************************************************************************************************
* $Id$
*
@@ -258,7 +257,11 @@
_contentType = typeAndEncoding[0];
if (typeAndEncoding[1] != null) _encoding = typeAndEncoding[1];
- setHeader( "Content-type", _contentType + "; charset=" + _encoding );
+ if (_encoding.equalsIgnoreCase( HttpUnitUtils.DEFAULT_CHARACTER_SET )) {
+ setHeader( "Content-Type", type );
+ } else {
+ setHeader( "Content-Type", _contentType + "; charset=" + _encoding );
+ }
}
@@ -533,7 +536,7 @@
private String _contentType = "text/plain";
- private String _encoding = "us-ascii";
+ private String _encoding = HttpUnitUtils.DEFAULT_CHARACTER_SET;
private PrintWriter _writer;
|