[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit HttpWebResponse.java,1.13,1.14 WebRespons
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-07-19 17:43:53
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv26541/src/com/meterware/httpunit
Modified Files:
HttpWebResponse.java WebResponse.java
Log Message:
provide access to response header names
Index: HttpWebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/HttpWebResponse.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HttpWebResponse.java 2001/07/17 12:50:47 1.13
+++ HttpWebResponse.java 2001/07/19 17:43:50 1.14
@@ -27,8 +27,10 @@
import java.net.URL;
import java.net.URLConnection;
+import java.util.Enumeration;
import java.util.Hashtable;
import java.util.StringTokenizer;
+import java.util.Vector;
/**
@@ -62,6 +64,17 @@
**/
public int getResponseCode() {
return _responseCode;
+ }
+
+
+ public String[] getHeaderFieldNames() {
+ Vector names = new Vector();
+ for (Enumeration e = _headers.keys(); e.hasMoreElements();) {
+ names.addElement( e.nextElement() );
+ }
+ String[] result = new String[ names.size() ];
+ names.copyInto( result );
+ return result;
}
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- WebResponse.java 2001/07/06 17:11:04 1.38
+++ WebResponse.java 2001/07/19 17:43:50 1.39
@@ -169,6 +169,12 @@
}
+ /**
+ * Returns the names of the header fields found in the response.
+ **/
+ abstract
+ public String[] getHeaderFieldNames();
+
/**
* Returns the value for the specified header field. If no such field is defined, will return null.
@@ -732,6 +738,11 @@
**/
public int getResponseCode() {
return HttpURLConnection.HTTP_OK;
+ }
+
+
+ public String[] getHeaderFieldNames() {
+ return new String[] { "Content-type" };
}
|