users@jersey.java.net

Pluralization (again)

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Tue, 3 Aug 2010 15:31:02 -0400

I just filed a bug against jaxb, but then my coworker reminded me that the
pluralization was actually contributed to jersey, not jaxb ... so now I am
thinking I made an error and that the bug is actually in jersey. If someone
can confirm, then I'll go ahead and write it as a low priority bug in jersey
(then someone else can decide if it's actually a "feature", haha).

https://jaxb.dev.java.net/issues/show_bug.cgi?id=785

The gist is this:

@XmlRootElement(name="segment")
public class SegmentBean {
   ...
}


@Resource
@RequestScoped
@Path("/latest")
public class SegmentResource {

    @GET
    @Produces("application/xml")
    public List<SegmentBean> getLatest() { ... }

}


Because I named the root element "segment" (not "SegmentBean") I
expected to get this out as the list:


   <segments>

      <segment/>

   </segments>


Instead what I got out was:


   <segmentBeans>

      <segment/>

   </segmentBeans>


This is with jersey 1.3 and jaxb 2.1.10


Would somebody help me resolve 1. is this really a problem and 2. is
it the jersey contrib that'st he problem (ignoring the
XmlRootElement's "name" property) or is it actually back in jaxb
somewhere?


--Chris