How to have jaxb annotations ignored for Accept:application/json in JBoss EAP 7

Solution Unverified - Updated -

Issue

  • How to have jaxb annotations ignored for Accept:application/json in JBoss EAP 7

EAP 6.4 was returning:

curl http://localhost:8080/helloworld-rs/rest/jsonObject
{"url":"http://redhat.com/"}

EAP 7 is returning:

curl http://localhost:8080/helloworld-rs/rest/jsonObject
{"my-app-url":"http://redhat.com/"}
@Path("/")
public class HelloWorld {

    @GET
    @Path("/jsonObject")
    @Produces({ "application/json" })
    public DocumentData getJsonObject() {
      MyData data = new MyData();
      data.setUrl("http://redhat.com/");
      return data;
    }   

@Root (name="my-data")
@XmlRootElement(name="my-data")
@XmlAccessorType(XmlAccessType.FIELD)
public class MyData implements Serializable {   

   @Attribute (name = "my-app-url", required = false)
   @XmlAttribute(name = "my-app-url", required = false)
   protected String url;

   public String getUrl() { return url; }
   public void setUrl(String url) { this.url = url; }
}

Environment

Red Hat JBoss Enterprise Application Platform (EAP) 7.2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content