ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rebhan, Gilbert" <Gilbert.Reb...@huk-coburg.de>
Subject RE: Retrieving key value pairs from URL and setting as system property
Date Wed, 19 Mar 2008 12:10:49 GMT

-----Original Message-----
From: raju [mailto:raju_ak@hotmail.com] 
Sent: Wednesday, March 19, 2008 12:23 PM
To: user@ant.apache.org
Subject: Retrieving key value pairs from URL and setting as system
property

/*

I need to access a web URL say http://.../viewproperties  which throws
plain
html with key value pairs as response.

Now as part of the main build i need to acces the above mentioned URL
and
set each of the key value pairs as system environment variables so that
they
are available other programs.

1)Is it  possible to read url and access properties directly without
writing
to a properties file?

If we have to write to properties file to read it say like 
<property url="http://www.mysite.com/bla/props/foo.properties"/>
Then how can we read a plain html  and write its key-value pair to
propreties file?

2)How can we set the key values read as system environment variables
using
ANT?
/*

i don't understand exactly what you want to achieve, but when dealing
with
http post/get ... there is a tasksuite =
http://sourceforge.net/projects/fikin-ant-tasks

f.e. =

<taskdef resource="net/sf/fikin/ant/antlib.xml"/>
  <target name="main">
    <httpget 
        url="http://servername:port/secret.txt"
        logLevel="content"
        logFile="Y:/ant_http.log"
    />

gets the filecontent in the logfile ,you could load as propertyfile
later.

setting the env variables =

<property name="env.FOO="/path/to/foo"/>
<property name="env.BAR" value="/path/to/bar"/>

accessing the env variables =

<property environment="env"/>
<echo>$${env.FOO} == ${env.FOO}</echo>
<echo>$${env.BAR} == ${env.BAR}</echo>

other already set env variables are also accessible

<echo>$${env.JAVA_HOME} == ${env.JAVA_HOME}</echo>
<echo>$${env.TOMCAT_HOME} == ${env.TOMCAT_HOME}</echo>
...


Regards, Gilbert

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


Mime
View raw message