The jackson provider doesn't recognize jaxb annotations. You could try the jettison plugin, but it kinda sucks. I haven't yet looked into jackson's support for JAXB annotations.
On 7/21/11 3:39 PM, michael_brindam...@dell.com wrote: > Hi folks, > > I am working on a new project in which we will expose a restful > webservice which returns json, and our stack is JBoss AS6, Weld > 1.1.0.Final, and we are using RestEasy to provide the REST layer. I am > trying to use the @Produces annotations to return json, and I’m having > some luck, but would like to be able to tweak what is returned using > either @Json* or JAXB annations. As it currently stands, these > annotations don’t seem to be having any effect…. > > For example, given the following annotated pojo: > > import javax.xml.bind.annotation.XmlRootElement; > > import javax.xml.bind.annotation.XmlTransient; > > @XmlRootElement(name = "volume") > > public class Volume > > { > > String name; > > String description; > > long sizeInMB; > > public String getName() { > > return name; > > } > > public void setName(String name) { > > this.name = name; > > } > > @XmlTransient > > public String getDescription() { > > return description; > > } > > public void setDescription(String description) { > > this.description = description; > > } > > public long getSizeInMB() { > > return sizeInMB; > > } > > public void setSizeInMB(long sizeInMB) { > > this.sizeInMB = sizeInMB; > > } > > public Volume(String name, String description, long sizeInMB) { > > super(); > > this.name = name; > > this.description = description; > > this.sizeInMB = sizeInMB; > > } > > public Volume() { > > super(); > > } > > } > > I would expect a call returning a volume to give me something like: > > { volume: {"name":"Volume with ID: 15","sizeInMB":1500000} } > > But in reality it is ignoring the JAXB annotations and providing > > {"name":"Volume with ID: 15","description":"This is a sample > Volume","sizeInMB":1500000} > > Would you expect usage within weld to ignore the annotations? Is there > any way to enable them? > > Thanks! > > Mike > > > > ------------------------------------------------------------------------------ > 5 Ways to Improve& Secure Unified Communications > Unified Communications promises greater efficiencies for business. UC can > improve internal communications as well as offer faster, more efficient ways > to interact with customers and streamline customer service. Learn more! > http://www.accelacomm.com/jaw/sfnl/114/51426253/ > > > > _______________________________________________ > Resteasy-users mailing list > Resteasy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com ------------------------------------------------------------------------------ Storage Efficiency Calculator This modeling tool is based on patent-pending intellectual property that has been used successfully in hundreds of IBM storage optimization engage- ments, worldwide. Store less, Store more with what you own, Move data to the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/ _______________________________________________ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users