[jackson-jaxrs-providers] 121/162: Start adding CBOR provider

Timo Aaltonen tjaalton at moszumanska.debian.org
Mon Sep 8 22:16:35 UTC 2014


This is an automated email from the git hooks/post-receive script.

tjaalton pushed a commit to branch master
in repository jackson-jaxrs-providers.

commit 267f104023e5b033de5fb59ebfecb455ff9548ea
Author: Tatu Saloranta <tatu.saloranta at iki.fi>
Date:   Thu Feb 6 21:59:53 2014 -0800

    Start adding CBOR provider
---
 {xml => cbor}/pom.xml                              |  45 +----
 .../jackson/jaxrs/cbor/CBOREndpointConfig.java     |  50 +++++
 .../jackson/jaxrs/cbor/CBORMapperConfigurator.java | 114 +++++++++++
 .../jackson/jaxrs/cbor/CBORMediaTypes.java         |   9 +
 .../jackson/jaxrs/cbor/JacksonCBORProvider.java    | 220 +++++++++++++++++++++
 .../jaxrs/cbor/JacksonJaxbCBORProvider.java        |  64 ++++++
 .../jackson/jaxrs/cbor/PackageVersion.java.in      |  15 ++
 .../fasterxml/jackson/jaxrs/cbor/package-info.java |  21 ++
 .../services/javax.ws.rs.ext.MessageBodyReader     |   2 +
 .../services/javax.ws.rs.ext.MessageBodyWriter     |   1 +
 pom.xml                                            |   4 +-
 xml/pom.xml                                        |   2 +-
 12 files changed, 509 insertions(+), 38 deletions(-)

diff --git a/xml/pom.xml b/cbor/pom.xml
similarity index 62%
copy from xml/pom.xml
copy to cbor/pom.xml
index 50c8e23..5111ede 100644
--- a/xml/pom.xml
+++ b/cbor/pom.xml
@@ -8,17 +8,17 @@
     <artifactId>jackson-jaxrs-providers</artifactId>
     <version>2.3.2-SNAPSHOT</version>
   </parent>
-  <artifactId>jackson-jaxrs-xml-provider</artifactId>
-  <name>Jackson-JAXRS-XML</name>
+  <artifactId>jackson-jaxrs-cbor-provider</artifactId>
+  <name>Jackson-JAXRS-CBOR</name>
   <packaging>bundle</packaging>
-  <description>Functionality to handle Smile XML input/output for JAX-RS implementations (like Jersey and RESTeasy) using standard Jackson data binding.
+  <description>Functionality to handle CBOR encoded input/output for JAX-RS implementations (like Jersey and RESTeasy) using standard Jackson data binding.
   </description>
 
   <properties>
     <!-- Generate PackageVersion.java into this directory. -->
-    <packageVersion.dir>com/fasterxml/jackson/jaxrs/xml</packageVersion.dir>
-    <packageVersion.package>${project.groupId}.xml</packageVersion.package>
-    <osgi.export>${project.groupId}.xml.*;version=${project.version}</osgi.export>
+    <packageVersion.dir>com/fasterxml/jackson/jaxrs/cbor</packageVersion.dir>
+    <packageVersion.package>${project.groupId}.cbor</packageVersion.package>
+    <osgi.export>${project.groupId}.smile.*;version=${project.version}</osgi.export>
     <!-- NOTE: JAXB annotations module is optional dependency, need to try to mark
          as such here.
       -->
@@ -33,8 +33,7 @@
 ,com.fasterxml.jackson.databind.introspect
 ,com.fasterxml.jackson.databind.type
 ,com.fasterxml.jackson.databind.util
-,com.fasterxml.jackson.dataformat.xml
-,com.fasterxml.jackson.dataformat.xml.jaxb
+,com.fasterxml.jackson.dataformat.cbor
 ,com.fasterxml.jackson.jaxrs.base
 ,com.fasterxml.jackson.jaxrs.cfg
 ,com.fasterxml.jackson.module.jaxb;resolution:=optional
@@ -61,8 +60,8 @@
     </dependency>
     <dependency>
       <groupId>com.fasterxml.jackson.dataformat</groupId>
-      <artifactId>jackson-dataformat-xml</artifactId>
-      <version>${version.jackson.xml}</version>
+      <artifactId>jackson-dataformat-cbor</artifactId>
+      <version>${version.jackson.cbor}</version>
     </dependency>
     <!-- may also need JAXB annotation support -->
     <dependency> 
@@ -70,32 +69,6 @@
       <artifactId>jackson-module-jaxb-annotations</artifactId>
       <version>${version.jackson.jaxb}</version>
     </dependency>
-    <!-- JDK 1.6 provides stax-api (javax.xml.stream), but let's add this for documentation -->
-    <dependency>
-      <groupId>javax.xml.stream</groupId>
-      <artifactId>stax-api</artifactId>
-      <version>1.0-2</version>
-      <scope>provided</scope>
-    </dependency>
-    <!--  But Stax2 API must be included -->
-    <dependency>
-      <groupId>org.codehaus.woodstox</groupId>
-      <artifactId>stax2-api</artifactId>
-      <!-- Ideally we'd accept range of versions but won't really work with Maven... -->
-
-<!--      <version>[3.0.4, 3.5.0)</version>  -->
-      <version>3.1.1</version>
-    </dependency>
-
-    <!-- Also: While JDK-included SJSXP almost works, there are some rough edges;
-         so let's add full non-test dep to modern Jackson version.
-      -->
-    <dependency>
-      <groupId>org.codehaus.woodstox</groupId>
-      <artifactId>woodstox-core-asl</artifactId>
-      <version>4.1.4</version>
-    </dependency>
-
   </dependencies>
   <build>
     <plugins>
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBOREndpointConfig.java b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBOREndpointConfig.java
new file mode 100644
index 0000000..b31f727
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBOREndpointConfig.java
@@ -0,0 +1,50 @@
+package com.fasterxml.jackson.jaxrs.cbor;
+
+import java.lang.annotation.Annotation;
+
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.jaxrs.cfg.EndpointConfigBase;
+
+/**
+ * Container class for figuring out annotation-based configuration
+ * for JAX-RS end points.
+ */
+public class CBOREndpointConfig
+    extends EndpointConfigBase<CBOREndpointConfig>
+{
+    /*
+    /**********************************************************
+    /* Construction
+    /**********************************************************
+     */
+
+    protected CBOREndpointConfig() { }
+
+    public static CBOREndpointConfig forReading(ObjectReader reader,
+            Annotation[] annotations)
+    {
+        return new CBOREndpointConfig()
+            .add(annotations, false)
+            .initReader(reader)
+        ;
+    }
+
+    public static CBOREndpointConfig forWriting(ObjectWriter writer,
+            Annotation[] annotations)
+    {
+        CBOREndpointConfig config =  new CBOREndpointConfig();
+        return config
+            .add(annotations, true)
+            .initWriter(writer)
+        ;
+    }
+
+    // No need to override, fine as-is:
+//    protected void addAnnotation(Class<? extends Annotation> type, Annotation annotation, boolean forWriting)
+
+    @Override
+    public Object modifyBeforeWrite(Object value) {
+        // nothing to add
+        return value;
+    }
+}
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBORMapperConfigurator.java b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBORMapperConfigurator.java
new file mode 100644
index 0000000..9dfda90
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBORMapperConfigurator.java
@@ -0,0 +1,114 @@
+package com.fasterxml.jackson.jaxrs.cbor;
+
+import java.util.*;
+
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
+import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
+import com.fasterxml.jackson.jaxrs.cfg.Annotations;
+import com.fasterxml.jackson.jaxrs.cfg.MapperConfiguratorBase;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector;
+
+/**
+ * Helper class used to encapsulate details of configuring an
+ * {@link ObjectMapper} instance to be used for data binding, as
+ * well as accessing it.
+ */
+public class CBORMapperConfigurator
+    extends MapperConfiguratorBase<CBORMapperConfigurator, ObjectMapper>
+{
+    /*
+    /**********************************************************
+    /* Construction
+    /**********************************************************
+     */
+    
+    public CBORMapperConfigurator(ObjectMapper mapper, Annotations[] defAnnotations)
+    {
+        super(mapper, defAnnotations);
+    }
+
+    /**
+     * Method that locates, configures and returns {@link ObjectMapper} to use
+     */
+    @Override
+    public synchronized ObjectMapper getConfiguredMapper() {
+        /* important: should NOT call mapper(); needs to return null
+         * if no instance has been passed or constructed
+         */
+        return _mapper;
+    }
+
+    @Override
+    public synchronized ObjectMapper getDefaultMapper() {
+        if (_defaultMapper == null) {
+            _defaultMapper = new ObjectMapper(new CBORFactory());
+            _setAnnotations(_defaultMapper, _defaultAnnotationsToUse);
+        }
+        return _defaultMapper;
+    }
+
+    /*
+    /***********************************************************
+    /* Internal methods
+    /***********************************************************
+     */
+
+    /**
+     * Helper method that will ensure that there is a configurable non-default
+     * mapper (constructing an instance if one didn't yet exit), and return
+     * that mapper.
+     */
+    @Override
+    protected ObjectMapper mapper()
+    {
+        if (_mapper == null) {
+            _mapper = new ObjectMapper(new CBORFactory());
+            _setAnnotations(_mapper, _defaultAnnotationsToUse);
+        }
+        return _mapper;
+    }
+
+    @Override
+    protected AnnotationIntrospector _resolveIntrospectors(Annotations[] annotationsToUse)
+    {
+        // Let's ensure there are no dups there first, filter out nulls
+        ArrayList<AnnotationIntrospector> intr = new ArrayList<AnnotationIntrospector>();
+        for (Annotations a : annotationsToUse) {
+            if (a != null) {
+                intr.add(_resolveIntrospector(a));
+            }
+        }
+        int count = intr.size();
+        if (count == 0) {
+            return AnnotationIntrospector.nopInstance();
+        }
+        AnnotationIntrospector curr = intr.get(0);
+        for (int i = 1, len = intr.size(); i < len; ++i) {
+            curr = AnnotationIntrospector.pair(curr, intr.get(i));
+        }
+        return curr;
+    }
+
+    protected AnnotationIntrospector _resolveIntrospector(Annotations ann)
+    {
+        switch (ann) {
+        case JACKSON:
+            return new JacksonAnnotationIntrospector();
+        case JAXB:
+            /* For this, need to use indirection just so that error occurs
+             * when we get here, and not when this class is being loaded
+             */
+            try {
+                if (_jaxbIntrospectorClass == null) {
+                    _jaxbIntrospectorClass = JaxbAnnotationIntrospector.class;
+                }
+                return _jaxbIntrospectorClass.newInstance();
+            } catch (Exception e) {
+                throw new IllegalStateException("Failed to instantiate JaxbAnnotationIntrospector: "+e.getMessage(), e);
+            }
+        default:
+            throw new IllegalStateException(); 
+        }
+    }
+}
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBORMediaTypes.java b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBORMediaTypes.java
new file mode 100644
index 0000000..6c43592
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/CBORMediaTypes.java
@@ -0,0 +1,9 @@
+package com.fasterxml.jackson.jaxrs.cbor;
+
+import javax.ws.rs.core.MediaType;
+
+public class CBORMediaTypes {
+    // Should be the official one, from CBOR spec
+    public static final String    APPLICATION_JACKSON_CBOR      = "application/cbor";
+    public static final MediaType APPLICATION_JACKSON_CBOR_TYPE = MediaType.valueOf(APPLICATION_JACKSON_CBOR);
+}
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/JacksonCBORProvider.java b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/JacksonCBORProvider.java
new file mode 100644
index 0000000..df8b421
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/JacksonCBORProvider.java
@@ -0,0 +1,220 @@
+package com.fasterxml.jackson.jaxrs.cbor;
+
+import java.lang.annotation.Annotation;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.*;
+import javax.ws.rs.ext.*;
+
+import com.fasterxml.jackson.core.*;
+import com.fasterxml.jackson.databind.*;
+import com.fasterxml.jackson.jaxrs.base.ProviderBase;
+import com.fasterxml.jackson.jaxrs.cfg.Annotations;
+
+/**
+ * Basic implementation of JAX-RS abstractions ({@link MessageBodyReader},
+ * {@link MessageBodyWriter}) needed for binding
+ * Smile ("application/x-jackson-smile") content to and from Java Objects ("POJO"s).
+ *<p>
+ * Actual data binding functionality is implemented by {@link ObjectMapper}:
+ * mapper to use can be configured in multiple ways:
+ * <ul>
+ *  <li>By explicitly passing mapper to use in constructor
+ *  <li>By explictly setting mapper to use by {@link #setMapper}
+ *  <li>By defining JAX-RS <code>Provider</code> that returns {@link ObjectMapper}s.
+ *  <li>By doing none of above, in which case a default mapper instance is
+ *     constructed (and configured if configuration methods are called)
+ * </ul>
+ * The last method ("do nothing specific") is often good enough; explicit passing
+ * of Mapper is simple and explicit; and Provider-based method may make sense
+ * with Depedency Injection frameworks, or if Mapper has to be configured differently
+ * for different media types.
+ *<p>
+ * Note that the default mapper instance will be automatically created if
+ * one of explicit configuration methods (like {@link #configure})
+ * is called: if so, Provider-based introspection is <b>NOT</b> used, but the
+ * resulting Mapper is used as configured.
+ *<p>
+ * Note that there is also a sub-class -- ({@link JacksonJaxbCBORProvider}) -- that
+ * is configured by default to use both Jackson and JAXB annotations for configuration
+ * (base class when used as-is defaults to using just Jackson annotations)
+ *
+ * @author Tatu Saloranta
+ */
+ at Provider
+ at Consumes(CBORMediaTypes.APPLICATION_JACKSON_CBOR)
+ at Produces(CBORMediaTypes.APPLICATION_JACKSON_CBOR)
+public class JacksonCBORProvider
+extends ProviderBase<JacksonCBORProvider,
+    ObjectMapper,
+    CBOREndpointConfig,
+    CBORMapperConfigurator
+>
+{
+    /**
+     * Default annotation sets to use, if not explicitly defined during
+     * construction: only Jackson annotations are used for the base
+     * class. Sub-classes can use other settings.
+     */
+    public final static Annotations[] BASIC_ANNOTATIONS = {
+        Annotations.JACKSON
+    };
+
+    /*
+    /**********************************************************
+    /* Context configuration
+    /**********************************************************
+     */
+
+    /**
+     * Injectable context object used to locate configured
+     * instance of {@link ObjectMapper} to use for actual
+     * serialization.
+     */
+    @Context
+    protected Providers _providers;
+
+    /*
+    /**********************************************************
+    /* Construction
+    /**********************************************************
+     */
+
+    /**
+     * Default constructor, usually used when provider is automatically
+     * configured to be used with JAX-RS implementation.
+     */
+    public JacksonCBORProvider() {
+        this(null, BASIC_ANNOTATIONS);
+    }
+
+    /**
+     * @param annotationsToUse Annotation set(s) to use for configuring
+     *    data binding
+     */
+    public JacksonCBORProvider(Annotations... annotationsToUse)
+    {
+        this(null, annotationsToUse);
+    }
+
+    public JacksonCBORProvider(ObjectMapper mapper)
+    {
+        this(mapper, BASIC_ANNOTATIONS);
+    }
+    
+    /**
+     * Constructor to use when a custom mapper (usually components
+     * like serializer/deserializer factories that have been configured)
+     * is to be used.
+     * 
+     * @param annotationsToUse Sets of annotations (Jackson, JAXB) that provider should
+     *   support
+     */
+    public JacksonCBORProvider(ObjectMapper mapper, Annotations[] annotationsToUse)
+    {
+        super(new CBORMapperConfigurator(mapper, annotationsToUse));
+    }
+
+    /**
+     * Method that will return version information stored in and read from jar
+     * that contains this class.
+     */
+    @Override
+    public Version version() {
+        return PackageVersion.VERSION;
+    }
+    
+    /*
+    /**********************************************************
+    /* Abstract method impls
+    /**********************************************************
+     */
+
+    /**
+     * @deprecated Since 2.2 use {@link #hasMatchingMediaType(MediaType)} instead
+     */
+    @Deprecated
+    protected boolean isSmileType(MediaType mediaType) {
+        return hasMatchingMediaType(mediaType);
+    }
+    
+    /**
+     * Helper method used to check whether given media type
+     * is Smile type or sub type.
+     * Current implementation essentially checks to see whether
+     * {@link MediaType#getSubtype} returns
+     * "smile" or something ending with "+smile".
+     */
+    @Override
+    protected boolean hasMatchingMediaType(MediaType mediaType)
+    {
+        /* As suggested by Stephen D, there are 2 ways to check: either
+         * being as inclusive as possible (if subtype is "smile"), or
+         * exclusive (major type "application", minor type "smile").
+         * Let's start with inclusive one, hard to know which major
+         * types we should cover aside from "application".
+         */
+        if (mediaType != null) {
+            // Ok: there are also "xxx+smile" subtypes, which count as well
+            String subtype = mediaType.getSubtype();
+            return CBORMediaTypes.APPLICATION_JACKSON_CBOR_TYPE.getSubtype().equalsIgnoreCase(subtype) || 
+            		"cbor".equalsIgnoreCase(subtype) || subtype.endsWith("+cbor");
+        }
+        /* Not sure if this can happen; but it seems reasonable
+         * that we can at least produce smile without media type?
+         */
+        return true;
+    }
+
+    /**
+     * Method called to locate {@link ObjectMapper} to use for serialization
+     * and deserialization. If an instance has been explicitly defined by
+     * {@link #setMapper} (or non-null instance passed in constructor), that
+     * will be used. 
+     * If not, will try to locate it using standard JAX-RS
+     * {@link ContextResolver} mechanism, if it has been properly configured
+     * to access it (by JAX-RS runtime).
+     * Finally, if no mapper is found, will return a default unconfigured
+     * {@link ObjectMapper} instance (one constructed with default constructor
+     * and not modified in any way)
+     *
+     * @param type Class of object being serialized or deserialized;
+     *   not checked at this point, since it is assumed that unprocessable
+     *   classes have been already weeded out,
+     *   but will be passed to {@link ContextResolver} as is.
+     * @param mediaType Declared media type for the instance to process:
+     *   not used by this method,
+     *   but will be passed to {@link ContextResolver} as is.
+     */
+    @Override
+    protected ObjectMapper _locateMapperViaProvider(Class<?> type, MediaType mediaType)
+    {
+        if (_providers != null) {
+            ContextResolver<ObjectMapper> resolver = _providers.getContextResolver(ObjectMapper.class, mediaType);
+            /* Above should work as is, but due to this bug
+             *   [https://jersey.dev.java.net/issues/show_bug.cgi?id=288]
+             * in Jersey, it doesn't. But this works until resolution of
+             * the issue:
+             */
+            if (resolver == null) {
+                resolver = _providers.getContextResolver(ObjectMapper.class, null);
+            }
+            if (resolver != null) {
+                return resolver.getContext(type);
+            }
+        }
+        return null;
+    }
+
+    @Override
+    protected CBOREndpointConfig _configForReading(ObjectReader reader,
+            Annotation[] annotations) {
+        return CBOREndpointConfig.forReading(reader, annotations);
+    }
+
+    @Override
+    protected CBOREndpointConfig _configForWriting(ObjectWriter writer,
+            Annotation[] annotations) {
+        return CBOREndpointConfig.forWriting(writer, annotations);
+    }
+}
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/JacksonJaxbCBORProvider.java b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/JacksonJaxbCBORProvider.java
new file mode 100644
index 0000000..b207898
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/JacksonJaxbCBORProvider.java
@@ -0,0 +1,64 @@
+package com.fasterxml.jackson.jaxrs.cbor;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.Produces;
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.jaxrs.cfg.Annotations;
+
+/**
+ * JSON content type provider automatically configured to use both Jackson
+ * and JAXB annotations (in that order of priority). Otherwise functionally
+ * same as {@link JacksonCBORProvider}.
+ *<p>
+ * Typical usage pattern is to just instantiate instance of this
+ * provider for JAX-RS and use as is: this will use both Jackson and
+ * JAXB annotations (with Jackson annotations having priority).
+ *<p>
+ * Note: class annotations are duplicated from super class, since it
+ * is not clear whether JAX-RS implementations are required to
+ * check settings of super-classes. It is important to keep annotations
+ * in sync if changed.
+ */
+ at Provider
+ at Consumes(CBORMediaTypes.APPLICATION_JACKSON_CBOR)
+ at Produces(CBORMediaTypes.APPLICATION_JACKSON_CBOR)
+public class JacksonJaxbCBORProvider extends JacksonCBORProvider {
+    /**
+     * Default annotation sets to use, if not explicitly defined during
+     * construction: use Jackson annotations if found; if not, use
+     * JAXB annotations as fallback.
+     */
+    public final static Annotations[] DEFAULT_ANNOTATIONS = {
+        Annotations.JACKSON, Annotations.JAXB
+    };
+
+    /**
+     * Default constructor, usually used when provider is automatically
+     * configured to be used with JAX-RS implementation.
+     */
+    public JacksonJaxbCBORProvider()
+    {
+        this(null, DEFAULT_ANNOTATIONS);
+    }
+
+    /**
+     * @param annotationsToUse Annotation set(s) to use for configuring
+     * data binding
+     */
+    public JacksonJaxbCBORProvider(Annotations... annotationsToUse)
+    {
+        this(null, annotationsToUse);
+    }
+    
+    /**
+     * Constructor to use when a custom mapper (usually components
+     * like serializer/deserializer factories that have been configured)
+     * is to be used.
+     */
+    public JacksonJaxbCBORProvider(ObjectMapper mapper, Annotations[] annotationsToUse)
+    {
+        super(mapper, annotationsToUse);
+    }
+}
\ No newline at end of file
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/PackageVersion.java.in b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/PackageVersion.java.in
new file mode 100644
index 0000000..ff04827
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/PackageVersion.java.in
@@ -0,0 +1,15 @@
+package @package@;
+
+import com.fasterxml.jackson.core.Version;
+import com.fasterxml.jackson.core.Versioned;
+import com.fasterxml.jackson.core.util.VersionUtil;
+
+/**
+ * Automatically generated from PackageVersion.java.in during
+ * packageVersion-generate execution of maven-replacer-plugin in pom.xml.
+ */
+public final class PackageVersion implements Versioned {
+    public final static Version VERSION = VersionUtil.parseVersion("@projectversion@", "@projectgroupid@", "@projectartifactid@");
+
+    @Override public Version version() { return VERSION; }
+}
diff --git a/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/package-info.java b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/package-info.java
new file mode 100644
index 0000000..b4da5d1
--- /dev/null
+++ b/cbor/src/main/java/com/fasterxml/jackson/jaxrs/cbor/package-info.java
@@ -0,0 +1,21 @@
+/**
+ * Jackson-based JAX-RS provider that can automatically
+ * serialize and deserialize resources for 
+ * Compact Binary Object Representation (CBOR) content type (MediaType).
+ *<p>
+ * Also continues supporting functionality, such as
+ * exception mappers that can simplify handling of
+ * error conditions.
+ *<p>
+ * There are two default provider classes:
+ *<ul>
+ * <li>{@link com.fasterxml.jackson.jaxrs.xml.JacksonCBORProvider} is the basic
+ *    provider configured to use Jackson annotations
+ *  </li>
+ * <li>{@link com.fasterxml.jackson.jaxrs.xml.JacksonJaxbCBORProvider} is extension
+ *    of the basic provider, configured to additionally use JAXB annotations,
+ *    in addition to (or in addition of, if so configured) Jackson annotations.
+ *  </li>
+ * </ul>
+ */
+package com.fasterxml.jackson.jaxrs.cbor;
diff --git a/cbor/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyReader b/cbor/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyReader
new file mode 100644
index 0000000..8a5b007
--- /dev/null
+++ b/cbor/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyReader
@@ -0,0 +1,2 @@
+com.fasterxml.jackson.jaxrs.cbor.JacksonCBORProvider
+
diff --git a/cbor/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyWriter b/cbor/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyWriter
new file mode 100644
index 0000000..64aa57d
--- /dev/null
+++ b/cbor/src/main/resources/META-INF/services/javax.ws.rs.ext.MessageBodyWriter
@@ -0,0 +1 @@
+com.fasterxml.jackson.jaxrs.cbor.JacksonCBORProvider
diff --git a/pom.xml b/pom.xml
index 1e015e2..3725dcf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,6 +16,7 @@
 
   <modules>
     <module>base</module>
+    <module>cbor</module>
     <module>json</module>
     <module>smile</module>
     <module>xml</module>
@@ -30,9 +31,10 @@
   <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <!-- core/databind should have same version; data formats, annotations may differ -->
-    <version.jackson.core>2.3.1</version.jackson.core>
+    <version.jackson.core>2.3.2-SNAPSHOT</version.jackson.core>
     <version.jackson.annotations>2.3.0</version.jackson.annotations>
 
+    <version.jackson.cbor>${version.jackson.core}</version.jackson.cbor>
     <version.jackson.smile>${version.jackson.core}</version.jackson.smile>
     <version.jackson.xml>${version.jackson.core}</version.jackson.xml>
 
diff --git a/xml/pom.xml b/xml/pom.xml
index 50c8e23..5b8b289 100644
--- a/xml/pom.xml
+++ b/xml/pom.xml
@@ -11,7 +11,7 @@
   <artifactId>jackson-jaxrs-xml-provider</artifactId>
   <name>Jackson-JAXRS-XML</name>
   <packaging>bundle</packaging>
-  <description>Functionality to handle Smile XML input/output for JAX-RS implementations (like Jersey and RESTeasy) using standard Jackson data binding.
+  <description>Functionality to handle XML input/output for JAX-RS implementations (like Jersey and RESTeasy) using standard Jackson data binding.
   </description>
 
   <properties>

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/jackson-jaxrs-providers.git



More information about the pkg-java-commits mailing list