users@jersey.java.net

[Jersey] Jersey with JAXBIntrospector

From: Lee Kenny <Kenny.Lee_at_bosch-si.com>
Date: Wed, 18 Dec 2013 10:15:35 +0000

Hi,

In my class that I expose as a service, I have an attribute of generic type Object.

public class MyPOJO {
  private Object value;
}

When I am fetching my object via GET, the value is dynamically set. (Could be string, int, float, etc)

The XML response returns (In this case the value set is a String):

<value
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">My String Value
</value>

I prefer to get:

<value>My String Value</value>

So I read from the link below that we can use the JAXBIntrospector. But not sure how to use it with Jersey though.
http://stackoverflow.com/questions/4146540/how-to-marshal-an-object-via-jaxb-without-any-information-about-it

Mit freundlichen Grüßen / Best regards

Kenny Lee
INST/DSW2-AP

Tel. +65 6571 2250