|
From: Bill B. <bb...@re...> - 2011-11-14 13:47:10
|
On 11/13/11 4:47 PM, Heiko W.Rupp wrote:
> Hi,
>
> I am running into those
> Could not find MessageBodyWriter for response object of type: java.util.ArrayList of media type: application/xml
> with whatever provider when I do
>
> Response foo() {
> List<MyType> x = new ArrayList<MyType>();
> ...
> return Response.ok(x).build();
> }
>
Its type erasure. Use GenericEntity as Xavier suggested. You are
probably marshalling JAXB? The problem is Resteasy can't determine the
type of the list by just passing it in as the generic type information
is not available.
It works in the other case:
List<MyType> foo() {
List<MyType> x = new ArrayList<MyType>();
...
return x;
}
Because the generic type information is available by introspecting the
method.
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|