Set Body to Array?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Set Body to Array?

jasenj1
I've done some Googling but can't quite find the answer so here goes...

I have a REST service defined using blueprint XML:

<from id="_from1" uri="rest:get:myService/{param1}/{param2}"/>

For various reasons, I'd like to access "param2" in a later route using:

${body[0]['param2_key']}

So the body needs to be transformed into a list of maps.


I defined a bean with this structure at the top of my XML:

<bean id="bodyList" class="java.util.ArrayList">
  <argument>
    <list value-type="java.util.HashMap">
      <map>
        <entry>
          <key><value>param2_key</value></key>
          <value>????????</value>
        </entry>
      </map>
    </list>
  </argument>
        </bean>            


That gives me a bean I can reference and... Somehow put the value of
param2 into it. That's the step I can't figure out. How to set the value
of the param2_key map within the route and then set the bean to be the
body.

If I:

<setBody><simple>${ref:bodyList}</simple></setBody>


The body gets the bean, but the bean does not have param2 set.

Thanks for any help.

- Jasen.