Grokbase Groups Ant user March 2008
FAQ
Hi all,

I am an ANT newbie and have a few questions. I have the following task
which works but wondering if I could check the result status from the http
url.

<target name="is_jboss_running" depends="">
<description>Checks if the JBoss Server is running.</description>
<echo>Testing if the JBoss Server is running on ${jboss.url}</echo>
<condition property="is_jboss_running" else="false">
<http url="${jboss.url}"/>
</condition>
<echo message="Is JBoss running? ... [ ${is_jboss_running} ]"/>
</target>

This outputs...
[echo] Testing if the JBoss Server is running on http://localhost:8080
Checking for http://localhost:8080
Result code for http://localhost:8080 was 200
[echo] Is JBoss running? ... [ true ]

Which is fine, but I am wondering if its possible to grep or run a reg ex on
the return string "Result code for http://localhost:8080 was 200" and test
for http status codes ie 200.

I have seen this from anteater
http://aft.sourceforge.net/manual/Getting%20started.html which will do
exactly what I am asking but I would like to explore the core ant features
features before resulting to add an external tool.

Has anyone got any suggestions?

--
View this message in context: http://www.nabble.com/ant-checking-result-status-tp15995447p15995447.html
Sent from the Ant - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org

Search Discussions

  • Steve Loughran at Mar 12, 2008 at 12:13 pm

    neogeo wrote:
    Hi all,

    I am an ANT newbie and have a few questions. I have the following task
    which works but wondering if I could check the result status from the http
    url.

    <target name="is_jboss_running" depends="">
    <description>Checks if the JBoss Server is running.</description>
    <echo>Testing if the JBoss Server is running on ${jboss.url}</echo>
    <condition property="is_jboss_running" else="false">
    <http url="${jboss.url}"/>
    </condition>
    <echo message="Is JBoss running? ... [ ${is_jboss_running} ]"/>
    </target>

    This outputs...
    [echo] Testing if the JBoss Server is running on http://localhost:8080
    Checking for http://localhost:8080
    Result code for http://localhost:8080 was 200
    [echo] Is JBoss running? ... [ true ]

    Which is fine, but I am wondering if its possible to grep or run a reg ex on
    the return string "Result code for http://localhost:8080 was 200" and test
    for http status codes ie 200.
    Change the errorsBeginAt attribute in <http> to be 201, and then only
    responses with value 200 are allowed, it should already reject anything
    = 400.
    --
    Steve Loughran http://www.1060.org/blogxter/publish/5
    Author: Ant in Action http://antbook.org/

    ---------------------------------------------------------------------
    To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
    For additional commands, e-mail: user-help@ant.apache.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriesant
postedMar 12, '08 at 12:24a
activeMar 12, '08 at 12:13p
posts2
users2
websiteant.apache.org

2 users in discussion

Steve Loughran: 1 post Neogeo: 1 post

People

Translate

site design / logo © 2022 Grokbase