1 Reply Latest reply on Sep 10, 2009 1:53 AM by Matthew Young

    Resteasy Mapped annotation on class rather than service

    Matthew Young Newbie

      using resteasy 1.1 together with latest jaxb 2.2

      using Jackson transformation of JAXB classes and added the Mapped annotation to the called service. works fine. but i wanted to add the namespace mapping (to a json name) against the actual JAXB class being marshalled. so i created a XJC plugin to write the necessary annotation in every class (giving the json name equal to the package name just to keep it simple). read from the PDF guide that this would work:

      "You use the @Mapped annotation on your JAXB classes, on your JAX-RS resource method, or on the parameter you are unmarshalling"

      but the namespace isn't recognized at runtime and i get the classic:

      "java.lang.IllegalStateException: Invalid JSON namespace"


      bug?

        • 1. Re: Resteasy Mapped annotation on class rather than service
          Matthew Young Newbie

          not a bug.....maybe just wishful thinking....

          basically i have a carrier class mapped via Hibernate and holds a property mapped to an XML column (feature with DB2 9 and Oracle 10/11). that property in the xsd schema (which gets parsed by XJC into pojos) is marked as an "xs:any" element. when i run XJC i populate the generated classes with XmlRootElements and the resteasy Mapped/XmlNsMap so the JSON provider knows how to map namespaces. thought since the XmlNsMap was defined for every class that the provider would know what to do with the namespaces recursively. but the XmlNsMap has to be applied to the carrier class. then everything works fine.