Escaping ampersand with HttpClient ant task while triggering a custom build

Per this : http://confluence.jetbrains.com/display/TCD8/Accessing+Server+by+HTTP , I am trying to 'Triggering a Custom Build' with HttpClient ant task by taskdef to it.

Since specifying '&' complains in url string within ant-target http task tried escaping with '%26M', but no-luck
But it is not triggering the build :


<http
    url="http://testuser:testpassword@teamcity.jetbrains.com:8111/httpAuth/action.html?add2Queue=<buildId>%26Mname=ID_A%26Mvalue=ss%26Mname=ID_B%26Mvalue=12.3"
     ....
</http>

but where as if I put the url in the browser it triggers the build by passing required parameters set in url. How to handle '&' escaping within ant-task http call?.

5 comments
Comment actions Permalink

Using &amp; for encoding/escaping ampersand withing the URL resolved my problem partially - where it is passing the the parameter value to build triggered on teamcity.

But I see a limiation where it is only passing last name=value pair to TC & ignoring the first two. No errors in log, but just ignores. Any idea on this?.

0
Comment actions Permalink

Hi

On our side we are using a workaround.
We put a £ instead of & and we susbstitute it in a perl command line program. This works on windows, mac and linux.
Problem, the login and password are visible

#!/usr/bin/perl
use LWP::Simple;


print "Call build configuration BTxx\n";
my $url="http://login:pass\@teamcity:8111/httpAuth/action.html?add2Queue=btxx£name=param1£value=%build.vcs.number%£name=param2£value=%xx%";
$url =~ s/£/&/g ;


# useful if you want to run again the configuration
print $url."\n";
my $content = get $url;

0
Comment actions Permalink

Unfortunately this approach can't be used in my current problem, as we are setting auth-cookie as part of http taskdef & it does not seem to allow options of passing multiple name=value pairs as part of url. Still unsure on underlying problem, as just pasting the url in browser just works fine!

0
Comment actions Permalink

After using <query> & setting <parameter> name=value pairs, it has worked as per this doc : http://missing-link.googlecode.com/files/readme.pdf

0
Comment actions Permalink

resolved - as added in latest comment above

0

Please sign in to leave a comment.