0 Replies Latest reply on Jul 28, 2013 4:52 PM by chemist

    JB7 Resteasy - Control produced Json (transients and more..)

    chemist

      Hi,

       

        I'm developing a simple CRUD test for Rest+Json, but I don't want all my DTO values to be outputed.

       

        I'm using a deployment structure like:

       

      xpto-ear

          xpto-war

             web.xml

          xpto-ejb.jar

             My Ejb with rest anotations.

       

         Which is effectively creating the REST service, at least for GET request calling all the necessary code.

          The problem is that the DTO that I want to return contains some data that I don't want to return (i.e. original json string that generated the DB entry, or internal auditing data).

       

        I've tried to ignore this fields using @XmlTransient, since I believe the default configuration would use Jettison + JAXB, but still the field is returned.

            Also I've tried using @XmlAccessorType(XmlAccessType.NONE) but still the fields are present.

         I've also tried to use @JsonIgnore, but I would believe that maybe some other configuration will be needed??

       

        What would be the correct way to have some control on the outputed Json document? At least to control the transient values?

       

        Follows in attachment the used web.xml, the Bean class and DTO. Please feel free to ask if you need more details.

       

        Thanks in advance for the help.

       

      Regards