Multi-module project that contains Jackson-based JAX-RS providers for JSON, XML, YAML, Smile, CBOR formats
Switch branches/tags
jackson-jaxrs-providers-2.9.6 jackson-jaxrs-providers-2.9.5 jackson-jaxrs-providers-2.9.4 jackson-jaxrs-providers-2.9.3 jackson-jaxrs-providers-2.9.2 jackson-jaxrs-providers-2.9.1 jackson-jaxrs-providers-2.9.0 jackson-jaxrs-providers-2.9.0.pr4 jackson-jaxrs-providers-2.9.0.pr3 jackson-jaxrs-providers-2.9.0.pr2 jackson-jaxrs-providers-2.9.0.pr1 jackson-jaxrs-providers-2.8.11 jackson-jaxrs-providers-2.8.10 jackson-jaxrs-providers-2.8.9 jackson-jaxrs-providers-2.8.8 jackson-jaxrs-providers-2.8.7 jackson-jaxrs-providers-2.8.6 jackson-jaxrs-providers-2.8.5 jackson-jaxrs-providers-2.8.4 jackson-jaxrs-providers-2.8.3 jackson-jaxrs-providers-2.8.2 jackson-jaxrs-providers-2.8.1 jackson-jaxrs-providers-2.8.0 jackson-jaxrs-providers-2.8.0.rc2 jackson-jaxrs-providers-2.8.0.rc1 jackson-jaxrs-providers-2.7.9 jackson-jaxrs-providers-2.7.8 jackson-jaxrs-providers-2.7.7 jackson-jaxrs-providers-2.7.6 jackson-jaxrs-providers-2.7.5 jackson-jaxrs-providers-2.7.4 jackson-jaxrs-providers-2.7.3 jackson-jaxrs-providers-2.7.2 jackson-jaxrs-providers-2.7.1 jackson-jaxrs-providers-2.7.0 jackson-jaxrs-providers-2.7.0-rc3 jackson-jaxrs-providers-2.7.0-rc2 jackson-jaxrs-providers-2.7.0-rc1 jackson-jaxrs-providers-2.6.7 jackson-jaxrs-providers-2.6.6 jackson-jaxrs-providers-2.6.5 jackson-jaxrs-providers-2.6.4 jackson-jaxrs-providers-2.6.3 jackson-jaxrs-providers-2.6.2 jackson-jaxrs-providers-2.6.1 jackson-jaxrs-providers-2.6.0 jackson-jaxrs-providers-2.6.0-rc4 jackson-jaxrs-providers-2.6.0-rc3 jackson-jaxrs-providers-2.6.0-rc2 jackson-jaxrs-providers-2.6.0-rc1 jackson-jaxrs-providers-2.5.5 jackson-jaxrs-providers-2.5.4 jackson-jaxrs-providers-2.5.3 jackson-jaxrs-providers-2.5.2 jackson-jaxrs-providers-2.5.1 jackson-jaxrs-providers-2.5.0 jackson-jaxrs-providers-2.5.0-rc1 jackson-jaxrs-providers-2.4.6 jackson-jaxrs-providers-2.4.5 jackson-jaxrs-providers-2.4.4 jackson-jaxrs-providers-2.4.3 jackson-jaxrs-providers-2.4.2 jackson-jaxrs-providers-2.4.1 jackson-jaxrs-providers-2.4.0-rc3 jackson-jaxrs-providers-2.4.0-rc2 jackson-jaxrs-providers-2.3.5 jackson-jaxrs-providers-2.3.4 jackson-jaxrs-providers-2.3.3 jackson-jaxrs-providers-2.3.2 jackson-jaxrs-providers-2.3.1 jackson-jaxrs-providers-2.3.0 jackson-jaxrs-providers-2.3.0-rc1 jackson-jaxrs-providers-2.2.4 jackson-jaxrs-providers-2.2.3 jackson-jaxrs-providers-2.2.2 jackson-jaxrs-providers-2.2.1 jackson-jaxrs-providers-2.2.0 2.4.0c 2.4.0-rc3b 2.2.0c 2.2.0b 2.2.0-rc1-c
Nothing to show
Clone or download
Latest commit 9958c03 Jun 12, 2018

README.md

Overview

This is a multi-module project that contains Jackson-based JAX-RS providers for following data formats:

Providers implement JAX-RS MessageBodyReader and MessageBodyWriter handlers for specific data formats. They also contain SPI settings for auto-registration.

Build Status Maven Central Javadoc

Status

Module is fully functional and considered mature.

Maven dependency

To use JAX-RS on Maven-based projects, use dependencies like:

<dependency>
  <groupId>com.fasterxml.jackson.jaxrs</groupId>
  <artifactId>jackson-jaxrs-json-provider</artifactId>
  <version>2.9.0</version>
</dependency>

(above is for JSON provider; modify appropriately for other providers)

Usage: registering providers

Due to auto-registration, it should be possible to simply add Maven dependency (or include jar if using other build systems) and let JAX-RS implementation discover provider. If this does not work you need to consult documentation of the JAX-RS implementation for details.

To use Jackson with Jersey see their documentation.

Usage: registering supporting datatypes module

Starting with Jackson 2.8, there is a small supporting datatype module, jackson-datatype-jaxrs (see under datatypes/). It will not be auto-registered automatically (unless user calls ObjectMapper.findAndRegisterModules()); instead, user has to register it by normal means:

ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new Jaxrs2TypesModule());
// and then register mapper with JAX-RS provider(s)

and ensuring that configured mapper is used by JAX-RS providers.

It is possible that later versions of providers may offer additional ways to get datatype module registered.

Annotations on resources

In addition to annotation value classes, it is also possible to use a subset of Jackson annotations with provider.

Here is a short list of supported annotations that work with all formats:

  • @JsonView can be used to define active view for specific endpoint
  • @JsonRootName can be used to specify alternate rootname; most often used with XML, but possibly with JSON as well.
  • @JacksonAnnotationsInside meta-annotation may be used as a marker, to create "annotation bundles", similar to how they are used with value type annotations
  • com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures can be used with all provid to enable/disable
    • SerializationFeature / DeserializationFeature for data-binding configuration
    • JsonParser.Feature / JsonGenerator.Feature for low(er) level Streaming read/write options

In addition there are format-specific annotations that may be used:

  • JSON has:
    • com.fasterxml.jackson.jaxrs.json.annotation.JSONP to define JSONP wrapping for serialized result

Other

For documentation, downloads links, check out Wiki