{{appName}}

Dropwizard

  • Java framework for developing ops-friendly, high-performance, RESTful web services
  • Out-of-the-box support for sophisticated
    • configuration
    • application metrics
    • logging
    • operational tools
  • Provide production-quality web service

Components - Jetty

  • Jetty for HTTP - embed an incredibly tuned HTTP server directly into your project
    Dropwizard uses main method which spins up an HTTP server
    Runs the application as a simple proces
    Allows you to use all of the existing Unix process management tools instead
  • Collection of Connector that accept TCP connections
  • Collection of Handler that service the requests from the connections and produce responses, with threads from the ThreadPool doing the work.
  • Full features of the Servlet API are only available if you configure the appropriate handlers - Example: the session API on the request is inactive unless the request has been passed to a SessionHandler
  • The job of configuring Jetty is building a tree of connectors and handlers and providing their individual configurations.

Components - Jersey

  • Jersey for RESTful - the JAX-RS reference implementation
    Helps to write clean, testable classes which gracefully map HTTP requests to simple Java objects.
    Runs the application as a simple proces
    Allows you to use all of the existing Unix process management tools instead
    Supports streaming output, matrix URI parameters, conditional GET requests

Components - Jackson for JSON

  • Object mapper - allowing you to export your domain models directly

Components - Dropwizard Matrix

  • Insights into what your code does in production
  • To measure the behavior of critical components in your production environment

Components - Dropwizard Matrix

  • Guava, which, in addition to highly optimized immutable data structures, provides a growing number of classes to speed up development in Java.
  • Logback and slf4j for performant and flexible logging.
  • Hibernate Validator, the JSR 349 reference implementation, provides an easy, declarative framework for validating user input and generating helpful and i18n-friendly error messages.
  • The Apache HttpClient and Jersey client libraries allow for both low- and high-level interaction with other web services.
  • JDBI is the most straightforward way to use a relational database with Java.
  • Liquibase is a great way to keep your database schema in check throughout your development and release cycles, applying high-level database refactorings instead of one-off DDL scripts.
  • Freemarker and Mustache are simple templating systems for more user-facing applications.

Creating the project using Maven

mvn archetype:generate -DarchetypeGroupId=io.dropwizard.archetypes \
                       -DarchetypeArtifactId=java-simple \
                       -DarchetypeVersion=1.2.2

      

Creating the project using Maven

        Define value for property 'groupId': : org.mohansun.dev
        Define value for property 'artifactId': : DWTestApp
        Define value for property 'version':  1.0-SNAPSHOT: :
        Define value for property 'package':  org.mohansun.dev: :
        [INFO] Using property: description = null
        Define value for property 'name': : DWTestApp
        [INFO] Using property: shaded = true
        Confirm properties configuration:
        groupId: org.mohansun.dev
        artifactId: DWTestApp
        version: 1.0-SNAPSHOT
        package: org.mohansun.dev
        description: null
        name: DWTestApp
        shaded: true


      

Sample Project

References