ObjectOutboundVariable no longer available in DWR 3.0.x - what should I use?

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

ObjectOutboundVariable no longer available in DWR 3.0.x - what should I use?

Aleksei Valikov
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: ObjectOutboundVariable no longer available in DWR 3.0.x - what should I use?

Mike Wilson
Administrator
Is your goal to output JSON? In that case you may be able to use DWR's JSON mode instead.
Tell us more about your use-case and we'll be able to help better.
 
Best regards
Mike Wilson
 
Aleksei Valikov wrote:
Hi,

we have implemented a custom converter back then for DWR 2. It used the class named ObjectOutboundVariable.
This class is not longer available in 3.0.x. Could you give me a hint, what should I use instead?
ObjectJsonOutboundVariable?

We need to output a structure like:
{
  "type": "Feature",
  "geometry": {
    "type": "Point",
    "coordinates": [125.6, 10.1]
  },
  "properties": {
    "name": "Dinagat Islands"
  }
}

Here's a snippet of the relevant code:

    @SuppressWarnings("unchecked")
    final G coordinateInfo = (G) data;
    final C coordinates = createCoordinates(coordinateInfo);

    //         // Where we collect out converted children
    final Map<String, OutboundVariable> ovs = new TreeMap<String, OutboundVariable>();

    // We need to do this before collecing the children to save recurrsion
    final ObjectOutboundVariable ov = new ObjectOutboundVariable(outctx);
    outctx.put(data, ov);

    ovs.put("type", getConverterManager().convertOutbound(getGeometryType(), outctx));
    ovs.put("coordinates", getConverterManager().convertOutbound(coordinates, outctx));

    ov.init(ovs, null);

Thank you.

Best wishes,
Alexey