users@jersey.java.net

Re: [Jersey] Re: how to return colelction of serializable elements ?

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Mon, 20 Apr 2009 11:49:59 +0200

On Apr 18, 2009, at 5:19 PM, Felipe Gaúcho wrote:

> got it:
>
> @GET
> @Produces( { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
> @Path("/read")
> public List<FpEvent> read() {
>
>
> it was another issue that was trapping my original trial :)
>

You can also do:

   public FpEvent[] read() {

See the JAXB sample:

http://fisheye4.atlassian.com/browse/~raw,r=1785/jersey/trunk/jersey/
samples/jaxb/src/main/java/com/sun/jersey/samples/jaxb/
JAXBArrayResource.java

http://fisheye4.atlassian.com/browse/~raw,r=1441/jersey/trunk/jersey/
samples/jaxb/src/main/java/com/sun/jersey/samples/jaxb/
JAXBCollectionResource.java

http://download.java.net/maven/2/com/sun/jersey/samples/jaxb/1.0.3/jaxb-1.0.3-project.zip

Paul.