Hey all,
This might have been asked earlier, but google didn't help me out. I
might have missed
a keyword.. :)
I'm trying to return a list of entities coming from a JPA entity. As far
as I do it this
way:
@GET
@Produces("application/json")
public List<EntityName> get() {
// look up entityA
return entityA.getBEntities();
}
it works fine. However, I wanted to introduce
error handling (return a 404 using Response.status(404).build()
on a specified exception), so I changed the code:
@GET
@Produces("applicatoin/json")
public Response get() {
// do the same, but
return Respones.ok(entityA.getBEntities()).build();
}
this way I always get an exception, namely:
[java] SEVERE: A message body writer for Java type, class
org.eclipse.persistence.indirection.IndirectList, and MIME media type,
application/json, was not found
I guess in the first case, JAXB somehow wraps my data, and in the latter
it can't for one reason or another.
Is there a way I could mimic the same behaviour?
Thanks,
Zoltan
__________ Information from ESET Smart Security, version of virus signature database 4486 (20091007) __________
The message was checked by ESET Smart Security.
http://www.eset.com