Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Dropwizard: REST & HTTP Made Easy

Introduction to Dropwizard: REST & HTTP Made Easy

Tech talk given @ FullContact on 6/20/2013

Michael Rose

June 20, 2013
Tweet

More Decks by Michael Rose

Other Decks in Programming

Transcript

  1. Lightweight collection of best-of-breed, stable, mature libraries for building REST

    HTTP services & applications Dropwizard Thursday, June 20, 13
  2. “Dropwizard, as a project, exists exclusively to reduce the transactional

    cost of introducing a new service into a production environment.” Thursday, June 20, 13
  3. •dropwizard-auth for OAuth, Basic auth, custom •dropwizard-jdbi for JDBI DAO

    access •dropwizard-hibernate - Hibernate ORM •dropwizard-views - Freemarker, Mustache •dropwizard-guice (Hubspot) - Guice injection •dropwizard-extras (DataSift) - Kafka, HBase goodies Batteries included Thursday, June 20, 13
  4. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. Core Libraries Thursday, June 20, 13
  5. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. •Logback for loggin'. Core Libraries Thursday, June 20, 13
  6. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. •Logback for loggin'. •Hibernate Validator for validatin'. Core Libraries Thursday, June 20, 13
  7. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. •Logback for loggin'. •Hibernate Validator for validatin'. •Metrics for figurin' out what your application is doin' in production. Core Libraries Thursday, June 20, 13
  8. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. •Logback for loggin'. •Hibernate Validator for validatin'. •Metrics for figurin' out what your application is doin' in production. •SnakeYAML for YAML parsin' and configuratin'. Core Libraries Thursday, June 20, 13
  9. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. •Logback for loggin'. •Hibernate Validator for validatin'. •Metrics for figurin' out what your application is doin' in production. •SnakeYAML for YAML parsin' and configuratin'. •JDBI and Hibernate for databasin'. Core Libraries Thursday, June 20, 13
  10. •Jetty for HTTP servin'. •Jersey for REST modelin'. •Jackson for

    JSON parsin' and generatin'. •Logback for loggin'. •Hibernate Validator for validatin'. •Metrics for figurin' out what your application is doin' in production. •SnakeYAML for YAML parsin' and configuratin'. •JDBI and Hibernate for databasin'. •Liquibase for migratin'. Core Libraries Thursday, June 20, 13
  11. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service Thursday, June 20, 13
  12. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service api service service service service service service service client Thursday, June 20, 13
  13. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service POJOs api service service service service service service service client Thursday, June 20, 13
  14. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service POJOs Jersey Resources api service service service service service service service client Thursday, June 20, 13
  15. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service POJOs Jersey Resources api service service service service service service service client Your App Thursday, June 20, 13
  16. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service POJOs Jersey Resources api service service service service service service service client Your App DAOs Thursday, June 20, 13
  17. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service POJOs Jersey Resources api service service service service service service service client Your App DAOs Representations go in api so they can be used in the client package too Thursday, June 20, 13
  18. Sane recommendations for layout Code organization Across 3 maven/gradle subprojects*

    project-api project-client project-service POJOs Jersey Resources * - If you’re just doing a quick web service, just throw it all in one project if you even make a client api service service service service service service service client Your App DAOs Representations go in api so they can be used in the client package too Thursday, June 20, 13
  19. @Path specifies the relative path for a resource class or

    method. @GET, @PUT, @POST, @DELETE and @HEAD specify the HTTP request type of a resource. @Produces specifies the response Internet media types (used for content negotiation). @Consumes specifies the accepted request Internet media types. @PathParam binds the method parameter to a path segment. @QueryParam binds the method parameter to the value of an HTTP query parameter. more.. Jersey is the reference implementation of JAX-RS, spec for making RESTful webservices Class & method annotations Thursday, June 20, 13
  20. git clone [email protected]:fullcontact/dropwizard-techtalk.git I’ve prepared a skeleton project It’s Maven

    & Groovy based Aw yeah, who doesn’t love Groovy? Thursday, June 20, 13