[Httpunit-commit] CVS: httpunit/src/com/meterware/httpunit WebResponse.java,1.45,1.46
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2001-09-13 15:11:32
|
Update of /cvsroot/httpunit/httpunit/src/com/meterware/httpunit
In directory usw-pr-cvs1:/tmp/cvs-serv13691/src/com/meterware/httpunit
Modified Files:
WebResponse.java
Log Message:
Now handle refresh requests with URL=<location> syntax
Index: WebResponse.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/src/com/meterware/httpunit/WebResponse.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- WebResponse.java 2001/08/13 21:29:41 1.45
+++ WebResponse.java 2001/09/13 15:11:30 1.46
@@ -382,9 +382,20 @@
if (splitIndex < 0) splitIndex = 0;
try {
_refreshDelay = Integer.parseInt( contentTypeHeader.substring( 0, splitIndex ) );
- _refreshRequest = new GetMethodWebRequest( contentTypeHeader.substring( splitIndex+1 ) );
+ _refreshRequest = new GetMethodWebRequest( getRefreshURL( contentTypeHeader.substring( splitIndex+1 ) ) );
} 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();
}
}
|