Play! as you REST<br />Using Play! Framework to build RESTful Services<br />Silicon Valley Code Camp<br />October 8th, 201...
Agenda<br />RESTful Interface<br />Traditional J2EE Development<br />Rise of developer-friendly and fun frameworks<br />Pl...
What is REST<br />It supports HTTP as the Transport Protocol<br />The HTTP verbs map to the action being performed on a re...
Examples of RESTful URLs<br />GET	/v1/person/1234<br />POST /v1/person/1234/status<br />{“status”: “Hello, developers!”}<b...
Traditional J2EE Web Development<br />Code a servlet (or something that becomes a servlet down the line) using Jersey or S...
Rise of Developer-friendly Frameworks<br />Faster turnaround and prototyping<br />No need for build -> deploy -> fix -> bu...
Play! Framework<br />Inspired by Djangoand Rails<br />A complete web-framework offering:<br />A Server (netty)<br />IDE in...
Play! Overview<br />
Play! Components<br />The Controller<br />Which gets requests, and has the logic to process them and generate a response b...
Demo Time!<br />Download Play! 1.2.3 <br />Build a simple Play! Java Application<br />Go over the folder structure<br />ec...
More Goodies hidden in Play!<br />Quick persistence without a database?<br />db=mem<br />Memcached support<br />MySQL and ...
Bundled Libraries<br />Play comes bundled with<br />ehcache<br />hibernate ORM<br />apache commons<br />Google Gson<br />e...
Let’s build an API<br />A system to store and query users<br />Create a (very) simple model <br />Use MongoDB to persist t...
Service Endpoints<br />GET all users		/users<br />GET a user by ID  /users/{id}<br />DELETE a user by ID /users/{id}<br />...
Things I am not covering<br />Custom deserialization of Mongo ObjectId() with Gson<br />Merges on Updates<br />Caching usi...
What to look forward to<br />Play! 2.0<br />Scala as the templating language<br />Support for sbt as the build system (vs....
We’re hiring!corp.ign.com/careers, and @ignjobs<br />Scala<br />Java<br />PHP/Zend<br />Rails<br />ElasticSearch<br />Mong...
About<br />Manish Pandit <br />Sr. Engineering Manager<br />	IGN Entertainment<br />http://linkedin.com/in/mpandit<br />@l...
Upcoming SlideShare
Loading in...5
×

Silicon Valley Code Camp 2011: Play! as you REST

2,284

Published on

My talk from Silicon Valley Code Camp 2011 on PlayFramework.

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
2,284
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Silicon Valley Code Camp 2011: Play! as you REST

  1. 1. Play! as you REST<br />Using Play! Framework to build RESTful Services<br />Silicon Valley Code Camp<br />October 8th, 2011<br />
  2. 2. Agenda<br />RESTful Interface<br />Traditional J2EE Development<br />Rise of developer-friendly and fun frameworks<br />Play! Framework Overview<br />Working Session – Implement and Deploy a RESTful service using Play! Framework (Java).<br />
  3. 3. What is REST<br />It supports HTTP as the Transport Protocol<br />The HTTP verbs map to the action being performed on a resource<br />The resource is the noun on which an action is being performed. The noun is generally qualified by an identifier.<br />The noun is a business entity, a part of the model.<br />REST is not a standard, but an architecture. Hence everyone tends to explain it differently but drives to the same meaning.<br />
  4. 4. Examples of RESTful URLs<br />GET /v1/person/1234<br />POST /v1/person/1234/status<br />{“status”: “Hello, developers!”}<br />DELETE /elasticsearch/people/status/_mapping<br />PUT /v2.0/photos/e5c2f436-f149-11e<br />GET /v1.0/social/rest/people/nickname.mpanditign/@friends<br />GET https://accounts.google.com/o/oauth2/token<br />
  5. 5. Traditional J2EE Web Development<br />Code a servlet (or something that becomes a servlet down the line) using Jersey or Spring, etc.<br />Stick the name and path in a web.xml<br />Package a war file via a build process like ant, maven, ivy, etc.<br />Copy the war file in the container’s webapp folder<br />Bounce the server<br />Pray that it works, if not, go to step 1.<br />
  6. 6. Rise of Developer-friendly Frameworks<br />Faster turnaround and prototyping<br />No need for build -> deploy -> fix -> build cycle<br />Integrated Testing Support via Specs<br />Convention over Configuration<br />Lightweight, focused towards making rapid development and deployment a priority. <br />Developers can focus on the fun stuff, instead of writing configurations and build scripts<br />
  7. 7. Play! Framework<br />Inspired by Djangoand Rails<br />A complete web-framework offering:<br />A Server (netty)<br />IDE integration with Eclipse, TextMate, IntelliJ<br />Templating Language (Groovy, Scala [2.0])<br />RESTful by being on a share-nothing, stateless architecture<br />Modules for all major dependencies and seamless integration<br />Hot Reload - you need the IDE and the Browser. No build scripts.<br />Convention Over Configuration<br />None of the J2EE bloat<br />
  8. 8. Play! Overview<br />
  9. 9. Play! Components<br />The Controller<br />Which gets requests, and has the logic to process them and generate a response by interacting with the Model<br />The routes file<br />Where URLs are mapped to Controller Methods<br />The View<br />Templates, etc. to render the response from the controller<br />The Model<br />The “beans” or data-aware domain objects.<br />
  10. 10. Demo Time!<br />Download Play! 1.2.3 <br />Build a simple Play! Java Application<br />Go over the folder structure<br />eclipsify it, pull in Eclipse<br />Demonstrate the hot-reload<br />Add a new method in the controller<br />Run tests via the built-in TestRunner<br />Mess up a test<br />Add a new test for the new method<br />
  11. 11. More Goodies hidden in Play!<br />Quick persistence without a database?<br />db=mem<br />Memcached support<br />MySQL and PostgreSQL support<br />Test Data stored as Fixtures in a YAML<br />Modes – dev, production<br />dev shows detailed errors with source code<br />Mail hosts<br />Scheduled Jobs via annotations (demo later?)<br />Built in Logger, so you wont work with awesome log4j configs.<br />
  12. 12. Bundled Libraries<br />Play comes bundled with<br />ehcache<br />hibernate ORM<br />apache commons<br />Google Gson<br />ezmorph<br />MySQL and Postgres drivers<br />memcached driver<br />xstream for XML<br />Antlr<br />…and more!<br />
  13. 13. Let’s build an API<br />A system to store and query users<br />Create a (very) simple model <br />Use MongoDB to persist the model in the db<br />
  14. 14. Service Endpoints<br />GET all users /users<br />GET a user by ID /users/{id}<br />DELETE a user by ID /users/{id}<br />POST (create) a new user /users<br />PUT (update) a user /users/{id}<br />
  15. 15. Things I am not covering<br />Custom deserialization of Mongo ObjectId() with Gson<br />Merges on Updates<br />Caching using built-in Cache façade <br />
  16. 16. What to look forward to<br />Play! 2.0<br />Scala as the templating language<br />Support for sbt as the build system (vs. Python)<br />Stateless JPA called Ebean instead of Hibernate<br />Native support for both Java and Scala<br />
  17. 17. We’re hiring!corp.ign.com/careers, and @ignjobs<br />Scala<br />Java<br />PHP/Zend<br />Rails<br />ElasticSearch<br />MongoDB<br />MySQL<br />HTML5<br />Jquery Mobile<br />Sencha Touch<br />Phonegap<br />Wordpress<br />ActionScript/Flash<br />Redis/Memcached<br />CI/CD<br />
  18. 18. About<br />Manish Pandit <br />Sr. Engineering Manager<br /> IGN Entertainment<br />http://linkedin.com/in/mpandit<br />@lobster1234<br />
  1. Gostou de algum slide específico?

    Recortar slides é uma maneira fácil de colecionar informações para acessar mais tarde.

×