Hi Gary,
GenericEntity you mention does not need to be used on the server side,
where things should be working just fine:
@GET
@Produces("application/xml")
public List<YourJAXBBean> getMethod() { return listOfYourJAXBBeans; }
On the client side, however, to consume the returned entity,
you need to use GenericType as follows:
List<YourJAXBBean> result =
webResource.accept("application/xml").get(new
GenericType<List<YourJAXBBean>>() {});
The above comes from top of my head and i have not tested it, but you should
get an idea on how things should be working.
Also application/xml media type and a list of JAXB beans
is used there as this combination gets supported out of the box with Jersey.
You might want to implement your own message body workers in addition
if other media type support is needed and missing.
HTH,
~Jakub
On 2.10.2011 19:52, emiddio-frontier wrote:
> been fumbling around -- want to learn, understand how i can use
> jersey/jax-rs with List<...> and Map<...>, etc.
> would like to be able to return from a jax-rs service the following:
> List<String>,or List<MyDefinedType>, or Map<String,MyDefinedType>, etc.
> AND --want to know how i can use the jersey client api to receive such
> objects.
> my trial n error learning/experimenting has resulting in me being able
> to make use of GenericEntity in the service to return a List<MyType>
> -- but have not discovered how to access the returned stuff within the
> client -- other than with ClientResponse --but then how to convert it
> to a List<MyType>.
> Dont know if i am on the right path or just fumbling around.
> Any tutorials, or examples that can enlighten me on how to accomplish
> my goals the "right" way ?
> thanks
> Gary