users@jersey.java.net

[Jersey] returning list - overriding standard XML behavior

From: phil swenson <phil.swenson_at_gmail.com>
Date: Fri, 1 Aug 2014 11:00:24 -0600

I guess this may be a JAXB question, but perhaps someone on this list could
give a suggestion…

I have a web service method like:

 @GET
    @Path("/ProcessErrors")
    public List<ProcessError> getProcessErrorCounts(
@QueryParam("processModelId") String processModelId
 )

I want it to return elements such as:

<ProcessErrors>
   <ProcessError>
       ….
   </ProcessError>
<ProcessErrors>

Instead it uses a lowercase such as “processErrors”

I know this is a minor nit, but all the other methods I have end up with
capitalized element names.

I tried @XmlElementWrapper(name="ProcessErrors")
 bit this seemed to have no effect.

Is there an easy way to override this name or will I have to create another
class that contains the List and use the
@XmlElementWrapper(name="ProcessErrors")
annotation there?

Thanks!
phil