Ant get task to accept arbitrary header

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Ant get task to accept arbitrary header

Arcadius Ahouansou
Hello.

I am using the and get task for downloading files from a remote server.
The server requires tokens custom headers for authentication/authorization
i.e.

I was wondering whether it's a good idea to add that to the current get
 task.

I got the source  code from github and did some changes in
https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Get.java

Now, wanted to have sometyhing like  this

<headers>
  <header name="aaaa" value="bbb"/>

<header name="aaaa" value="bbb"/>

</headers>



--
Arcadius Ahouansou
Menelic Ltd | Applied Knowledge Is Power
Office : +441444702101
Mobile: +447908761999
Web: www.menelic.com
---
Reply | Threaded
Open this post in threaded view
|

Re: Ant get task to accept arbitrary header

Arcadius Ahouansou
Hello.

I am using the and get task for downloading files from a remote server.
The server requires tokens custom headers for authentication/authorization
i.e.

I was wondering whether it's a good idea to add that to the current get
 task.

I got the source  code from github and did some changes in
https://github.com/apache/ant/blob/master/src/main/org/
apache/tools/ant/taskdefs/Get.java

Now, wanted to have sometyhing like  this under the <get> node

<headers>
  <header name="aaaa" value="bbb"/>

<header name="cccc" value="dddd"/>

</headers>



Please, after changing the java  code, what are the steps required to let
the <get> tag accept children nodes <headers> and <header>?

Currently, tests are failing on me with:

* [junit] Testcase: testHeaders took 0.034 sec*
*    [junit] Caused an ERROR*
*    [junit] get doesn't support the nested "headers" element.*
*    [junit] ...ant/src/etc/testcases/taskdefs/get.xml:102: get doesn't
support the nested "headers" element.*
*    [junit] at
org.apache.tools.ant.UnknownElement.handleChildren(UnknownElement.java:374)*
*    [junit] at
org.apache.tools.ant.UnknownElement.configure(UnknownElement.java:205)*
*    [junit] at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:164)*


Thank you very much.

Sorry the previous email left before I told it to :-)



On 20 January 2017 at 03:36, Arcadius Ahouansou <[hidden email]>
wrote:

>
> Hello.
>
> I am using the and get task for downloading files from a remote server.
> The server requires tokens custom headers for authentication/authorization
> i.e.
>
> I was wondering whether it's a good idea to add that to the current get
>  task.
>
> I got the source  code from github and did some changes in
> https://github.com/apache/ant/blob/master/src/main/org/
> apache/tools/ant/taskdefs/Get.java
>
> Now, wanted to have sometyhing like  this
>
> <headers>
>   <header name="aaaa" value="bbb"/>
>
> <header name="aaaa" value="bbb"/>
>
> </headers>
>
>
>
> --
> Arcadius Ahouansou
> Menelic Ltd | Applied Knowledge Is Power
> Office : +441444702101 <+44%201444%20702101>
> Mobile: +447908761999 <+44%207908%20761999>
> Web: www.menelic.com
> ---
>



--
Arcadius Ahouansou
Menelic Ltd | Applied Knowledge Is Power
Office : +441444702101
Mobile: +447908761999
Web: www.menelic.com
---
Reply | Threaded
Open this post in threaded view
|

Aw: Re: Ant get task to accept arbitrary header

Al Le
> Please, after changing the java  code, what are the steps required to let
> the <get> tag accept children nodes <headers> and <header>?

You should have methods like "setHeaders" (for the headers element) and "addHeader"/"addConfiguredHeader" for the nested elements.

See https://ant.apache.org/manual/develop.html for more details.

BTW: I'll very much welcome your changes!

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Re: Ant get task to accept arbitrary header

Arcadius Ahouansou
Hello AI Le.

I got it working now.
I will create a Jira ticket and submit a patch early next week.

Thank you very much for your help.

BTW: in this working implementation, I no longer use <headers> to group the
header tags...I have now:

<get src="some source" dest="some dest">
<header name="h1" value="aaa"/>
<header name="h2" value="bbb"/>
</get>

Arcadius.


On 20 January 2017 at 06:45, Al Le <[hidden email]> wrote:

> > Please, after changing the java  code, what are the steps required to let
> > the <get> tag accept children nodes <headers> and <header>?
>
> You should have methods like "setHeaders" (for the headers element) and
> "addHeader"/"addConfiguredHeader" for the nested elements.
>
> See https://ant.apache.org/manual/develop.html for more details.
>
> BTW: I'll very much welcome your changes!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


--
Arcadius Ahouansou
Menelic Ltd | Applied Knowledge Is Power
Office : +441444702101
Mobile: +447908761999
Web: www.menelic.com
---