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