Returning a pair of values from a @RemoteMethod

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

Returning a pair of values from a @RemoteMethod

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

Re: Returning a pair of values from a @RemoteMethod

Mike Wilson
Administrator
if you're already using Apache Commons Lang in your project then there is a Pair class that would make a natural fit for two values.
Either way you can probably just configure the chosen class with the standard bean converter. As you are only using the class for output you don't really have to worry about the generics mapping. The mentioned classes are not part of your source so you need to configure converters "externally" through XML.
 
Best regards
Mike Wilson
 
Dave Alvarado wrote:
Hi,

I’m using DWR 3.0.0-rc2 with Spring 3.1.4.RELEASE.  Is there a slick way to return a pair of values from a @RemoteMethod call?  Each object will be of a different type 

    @Override
    @RemoteMethod
    public Map.Entry<ObjectA, ObjectB> myMethod(final String param1, final String param2)

and there’s no default converter for the java.util.AbstractMap.Entry class out of the box.  I could write a custom converter but wanted to see if there’s an even easier way that I’m missing that would entail less custom code.

Thanks, - Dave