Code Monkey home page Code Monkey logo

dropwizard-xml's Introduction

Dropwizard XML Bundle

Join the chat at https://gitter.im/yunspace/dropwizard-xml Build Status Download

Dropwizard extension for high performance processing and validation of XML.

Uses:

Status

This project is built using Snap-CI to enable Continuous Delivery. There are no mysterious snapshots, every time the tests pass a new release tagged and uploaded to bintray, so you know exactly what you are pulling down.

Versions are pegged against Dropwizard's release number and try to use the same Jackson dependency to avoid conflicts. See above badges for latest version to use. The table below give an indication of dependencies:

Dropwizard-XML Dropwizard Jackson Woodstox Stax
0.7.1-X 0.7.1 2.3.3 4.1.4 3.1.1
0.8.0-X 0.8.0 2.5.1 transitive
0.8.1-X 0.8.1 2.5.2 transitive
0.9.0-X 0.9.0-SNAPSHOT 2.5.3 transitive

Usage

Dropwizard XML Provider is hosted by Bintray JCenter.

You can add the dependency to your project by Maven:

<repositories>
    <repository>
        <id>jcenter</id>
        <url>http://jcenter.bintray.com</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.yunspace.dropwizard</groupId>
    <artifactId>dropwizard-xml</artifactId>
    <version>${dropwizard-xml-version}</version>
    <scope>compile</scope>
</dependency>

Or Gradle:

repositories {
    jcenter()
    mavenCentral()
}
dependencies {
    compile "com.yunspace.dropwizard:dropwizard-xml:${dropwizardXmlVersion"
}

Add the XMLBundle

bootstrap.addBundle(new XmlBundle());

Annotate your Resources:

@Produces(MediaType.APPLICATION_XML) @Consumes(MediaType.APPLICATION_XML)

Annotate your model POJO with jackson-dataformat-xml bindings:

@JacksonXmlRootElement @JacksonXmlProperty @JacksonXmlElementWrapper @JacksonXmlText

Use validation/ignore annotations as you would normally:

@NotNull @Min @JsonIgnore

Advanced Usage

You can further custom the behaviour of your XML Mapper by passing in a JacksonXmlModule:

bootstrap.addBundle(new XmlBundle(jacksonXmlModule));

Or enable various serialisation/deserialisation features

XmlBundle indentXmlBundle = new XmlBundle();
indentXmlBundle.getXmlMapper().enable(SerializationFeature.INDENT_OUTPUT);
bootstrap.addBundle(indentXmlBundle);

##Sample project See dropwizard-xml-example subproject.

dropwizard-xml's People

Contributors

mrserverless avatar ateal avatar gitter-badger avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.