Hi,

i just migrated to CXF and I need to know how i can customize the
pluralization done by CXF to obtain the wrapper name when returning a
collection. For example, "country" is pluralized to "countrys" and i need it
to be "countries".
Please see my use case below.

@Path("/countries")
public class SupportedCountriesResource {
    @GET
    List<Country> list() {
       ...
    }
}

@XmlRootElement(name = "country")
@XmlAccessorType(XmlAccessType.FIELD)
public class Country {
    @XmlElement(name = "code")
    private String code;

    @XmlElement(name = "name")
    private String name;

    ...
}

I need to have the following xml and json (using
org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider) outputs :

<?xml version="1.0" encoding="UTF-8"?>
<countries>
   <country>
      <code>AF</code>
      <name>Afghanistan</name>
   </country>
   <country>
      <code>AL</code>
      <name>Albania</name>
   </country>
   ...
</countries>

[
   {
      "code":"AF",
      "name":"Afghanistan"
   },
   {
      "code":"AL",
      "name":"Albania"
   }
   ...
]

Thanks for your help,

Fabien



--
View this message in context: 
http://cxf.547215.n5.nabble.com/JAX-RS-Customize-wrapper-pluralization-tp5738743.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to