On Sep 25, 2009, at 6:54 PM, Saavedra, Gisella wrote:
>
> Can somebody point me to an example or article, if it exists,
> containing a code snippet returning a Map collection, something like
> @GET
> @Produces({"application/xml"})
> public Map<String, String> getAttributes(…) { }
>
>
> just receiving a Map object at the client side, or returning an
> object that contains the Map?
> No JSON.
>
> I will appreciate it.
>
Herak provides some helpful examples.
If using the Jersey client API, but not using JAXB, then you will also
require a message body reader to de-serialize the XML to a map
instance. For such a case it will be easier to deal with a type that
extends from HashMap<String, String> so that you can avoid having to
preserve the generic types that would otherwise be erased.
So one could do:
Client c = ...
WebResource r = c.resource(...);
MyMap mm = r.get(MyMap.class)
Paul.
> Thanks.
>
> Gisella Saavedra
> Sr. Software Engineer
> gsaavedra_at_zebra.com
> <image001.gif>
> 1000 Broadway, Suite 150, Oakland, CA 94607 | T+1 510 267 5123 T
> Main+1 510 267 5000 F+1 510 267 5100 | http://www.zebra.com/zes
>
>
>