Open GoogleCodeExporter opened 8 years ago
This issue should likely be identified as Project-ant-http and Type-Enhancement.
Original comment by aronrobe...@gmail.com
on 19 Aug 2011 at 5:58
Sounds like a good idea, but I'm open to suggestions before coding anything.
At first I thought it'd be straight foward, but as you pointed out there are
headers which can be used > 1 time, specifically the one which you are looking
to use.
Since Ant lacks any type of procedural concepts, it becomes difficult to work
with this type of scenario, in fact near impossible without extra libs like
ant-contrib I would think.
I've solved complex problems using ant-contrib in the past, like taking a
property or a properties file and using foreach
(http://ant-contrib.sourceforge.net/tasks/tasks/foreach.html) to iterate over
them.
However, I don't want to code something that will require everyone to use
another third party library; especially since is only a problem for headers
which can repeat.
Due to Ant's simplistic nature, I'm tempted to do something like this:
<http ...>
<saveHeader name="Response" prop="response.prop"/>
<saveHeader name="Set-Cookie" prop="set.cookie.prop" multivalueDelimieter="###,,###"/>
</http>
So when a header with multiple values is encountered, they would all end up in
a single property, delimited with the specified delimiter.
That's about the best I can think of doing with core Ant functionality, but
what it does it let you use something like ant-contrib foreach and split the
multi values on the delimiter, invoking a specified target for each value
Original comment by alex.she...@gmail.com
on 19 Aug 2011 at 12:29
Original comment by alex.she...@gmail.com
on 19 Aug 2011 at 12:51
You said wanted to save Set-Cookie and re-issue it right? It now makes sense
that this would work:
<property name="delim" value='!!!!,,!!!!"/>
<http ...>
<saveHeader name="Set-Cookie" prop="set.cookie" multivalueDelimeter="${delim}"/>
</http>
and re-issue:
<http ...>
<header name="Cookie" value="${set.cookie}" multivalueDelimiter="${delim}"/>
</http>
Where the existing header node would just be enhanced to split on the delim and
put in multiple headers if the resulting array was length > 1
Would that work for you?
Original comment by alex.she...@gmail.com
on 19 Aug 2011 at 12:58
On its face, this looks great!
Original comment by aronrobe...@gmail.com
on 19 Aug 2011 at 1:45
Original issue reported on code.google.com by
aronrobe...@gmail.com
on 19 Aug 2011 at 5:54