stevel 02/05/22 10:39:43
Modified: src/main/org/apache/tools/ant/taskdefs/condition Tag:
ANT_15_BRANCH Http.java
Log:
tightened the policy on response codes; 404 is now recognised as invalid,
along with any of the >400 codes. But for people that really dont want that,
there is an errorsBeginAt attribute that you can move up or down the line
Revision Changes Path
No revision
No revision
1.3.2.1 +8 -2
jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Http.java
Index: Http.java
===================================================================
RCS file:
/home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/condition/Http.java,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- Http.java 11 Apr 2002 07:38:15 -0000 1.3
+++ Http.java 22 May 2002 17:39:43 -0000 1.3.2.1
@@ -67,7 +67,7 @@
/**
* Condition to wait for a HTTP request to succeed. Its attribute(s) are:
* url - the URL of the request.
- *
+ * errorsBeginAt - number at which errors begin at; default=400.
* @author <a href="mailto:[EMAIL PROTECTED]">Denis Hennessy</a>
* @since Ant 1.5
*/
@@ -78,6 +78,12 @@
spec = url;
}
+ private int errorsBeginAt=400;
+
+ public void SetErrorsBeginAt(int errorsBeginAt) {
+ this.errorsBeginAt=errorsBeginAt;
+ }
+
public boolean eval() throws BuildException {
if (spec == null) {
throw new BuildException("No url specified in http condition");
@@ -92,7 +98,7 @@
int code = http.getResponseCode();
log("Result code for " + spec + " was " + code,
Project.MSG_VERBOSE);
- if (code > 0 && code < 500) {
+ if (code > 0 && code < errorsBeginAt) {
return true;
} else {
return false;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>