[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebForm.java,1.28,1.29 WebResponse.java,1
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-11-05 18:54:54
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv31303/src/com/meterware/httpunit
Modified Files:
WebForm.java WebResponse.java
Log Message:
Cleaned up JDK 1.1 issues, added some WebForm enhancements
Index: WebForm.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebForm.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- WebForm.java 2001/10/25 14:51:05 1.28
+++ WebForm.java 2001/11/05 18:54:51 1.29
@@ -58,6 +58,34 @@
/**
+ * Returns true if a parameter with given name exists in this form.
+ **/
+ public boolean hasParameterNamed( String soughtName ) {
+ NamedNodeMap[] parameters = getParameters();
+
+ for (int i = 0; i < parameters.length; i++) {
+ String name = getValue( parameters[ i ].getNamedItem( "name" ) );
+ if (name.equals( soughtName )) return true;
+ }
+ return false;
+ }
+
+
+ /**
+ * Returns true if a parameter starting with given name exists,
+ **/
+ public boolean hasParameterStartingWithPrefix( String prefix ) {
+ NamedNodeMap[] parameters = getParameters();
+
+ for (int i = 0; i < parameters.length; i++) {
+ String name = getValue( parameters[i].getNamedItem( "name" ) );
+ if (name.startsWith( prefix )) return true;
+ }
+ return false;
+ }
+
+
+ /**
* Returns an array containing the names of the parameters defined for this form,
* in the order in which they appear.
**/
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- WebResponse.java 2001/10/25 14:51:05 1.50
+++ WebResponse.java 2001/11/05 18:54:51 1.51
@@ -627,7 +627,7 @@
String tokensToAdd = "";
int numTokens = tokens.size();
for (int i=numTokens - 1; i >= 0; i--) {
- String token = (String) tokens.get(i);
+ String token = (String) tokens.elementAt(i);
int equalsIndex = token.indexOf('=');
// if this token has an equals sign (=) in it
@@ -647,7 +647,7 @@
// cookie attribute value
if ( !isTokenReservedWord(token,version) ) {
tokensToAdd = token + tokensToAdd;
- String preceedingToken = (String) tokens.get(i - 1);
+ String preceedingToken = (String) tokens.elementAt(i - 1);
char lastChar = preceedingToken.charAt(preceedingToken.length()-1);
if (lastChar != '=') {
tokensToAdd = ","+ tokensToAdd;
@@ -689,7 +689,7 @@
try {
while (st.nextToken() != StreamTokenizer.TT_EOF) {
- tokens.add( st.sval.trim() );
+ tokens.addElement( st.sval.trim() );
}
}
catch (IOException ioe) {
|