Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

By default, reading is currently disabled due to potential issues with the reader. You can enable it by calling setUseAsReader(boolean) on each provider and registering as a singleton in the JAX-RS Application sub-class.

...

 

Supported

Media Types

Entity

Read

Yes

application/json

JAXB object

Write

Yes

application/json

JAXB object

Example

Enabling Reading

Code Block

    public class MyApp extends Application {
        public Set getClasses() {
            Set s = new HashSet();
            s.add(MyResource.class);
            return s;
        }

        public Set<Object> getSingletons() {
            Set s = new HashSet();
            JettisonJAXBProvider jaxbProvider = new JettisonJAXBProvider();
            jaxbProvider.setUseAsReader(true);
            return s;
        }
    }

Producing and Consuming JSON

...