users@jersey.java.net

RE: [Jersey] GenericEntity ?

From: Jürgen Zimmermann <Juergen.Zimmermann_at_HS-Karlsruhe.de>
Date: Tue, 19 Aug 2008 12:59:28 +0200

Do you have a rough estimation when
https://jersey.dev.java.net/issues/show_bug.cgi?id=18
will be fixed?
 


  _____

From: Paul.Sandoz_at_Sun.COM [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Tuesday, August 19, 2008 9:02 AM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] GenericEntity ?


Hi,

BTW you can do the following:

  public List<Kunde> findKunden(@MatrixParam("nachname")

namely GenericEntity is useful when you need to return a built Response
and retain the generic information.

Is "Kunde" a JAXB bean? If so unfortunately returning a collection of
JAXB beans is not currently supported. There is an issue open [1], and
there is a solution attached that the developer who logged the issue was
kind enough to provide i.e. there needs to be a way to create the root
element from the JAXB bean element.

Paul.

[1] https://jersey.dev.java.net/issues/show_bug.cgi?id=18


On Aug 19, 2008, at 7:10 AM, Jürgen Zimmermann wrote:


I'm using the Jersey 0.9 snapshot JARs with class files having a
timestamp as of Aug. 18.
I'm also using JDK 1.6.0_07.

I tried to use GenericEntity in a resource method as follows:

@Path("/kundenverwaltung")
@Produces(MediaType.APPLICATION_XML)
@Consumes(MediaType.APPLICATION_XML)
public class KundenverwaltungResource {
  @GET
  @Path("/kunden")
  public GenericEntity<List<Kunde>> findKunden(@MatrixParam("nachname")
String nachname) throws KundeNotFoundException {
    List<Kunde> result = kv.findKundenByNachname(nachname);
    GenericEntity<List<Kunde>> entity = new
GenericEntity<List<Kunde>>(result) {};
    return entity;
  }

However, I get this error message:
19.08.2008 07:00:25 com.sun.jersey.spi.container.ContainerResponse write
SCHWERWIEGEND: A message body reader for Java type, class
java.util.ArrayList, and MIME media type, application/xml, was not found

Any hint is appreciated!




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net