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;
               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) {
                              this.name = name;
                              this.description = description;
                              this.sizeInMB = sizeInMB;
               public Volume() {


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 

Would you expect usage within weld to ignore the annotations?  Is there any way 
to enable them?



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!
Resteasy-users mailing list

Reply via email to