0%

Book Description

SThe Play Framework makes it easy to build web applications with Java & Scala, and this user-friendly tutorial makes it simpler still. Focusing on HTTP, everything is integrated so you need virtually no prior coding ability.

  • While driving in Java, tasks are also presented in Scala – a great way to be introduced to this amazing language
  • Create a fully-fledged, collaborative web application – starting from ground zero; all layers are presented in a pragmatic way
  • Gain the advantages associated with developing a fully integrated web framework

In Detail

The Learning Play! Framework 2 has been created for web developers that are building web applications. The core idea is to focus on the HTTP features and to enable them through a simplification lens. Building a web application no longer requires a configuration phase, an environment setup, or a long development lifecycle - it's integrated!

Learning Play! Framework 2 will enable any web developers to create amazing web applications taking advantage of the coolest features. It's the fastest way to dive into Play!, focusing on the capabilities by using them in a sample application. Although essentially Java based code, a Scala version is presented as well – giving an opportunity to see some Scala in action.

After setting up the machine and learning some Scala, you will construct an application which builds from static to dynamic, before introducing a database.

Then we'll focus on how data can be consumed and rendered in several ways. This will enable some real time communication through WebSocket and Server-Sent Event – on both server and client sides.

The book will end with testing and deployment, which completes any web development project.

Table of Contents

  1. Learning Play! Framework 2
    1. Table of Contents
    2. Learning Play! Framework 2
    3. Credits
    4. About the Author
    5. Acknowledgement
    6. About the Reviewers
    7. www.packtpub.com
      1. Support files, e-books, discount offers, and more
        1. Why Subscribe?
        2. Free Access for Packt account holders
    8. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    9. 1. Getting Started with Play! Framework 2
      1. Preparing your machine
        1. Downloading the package
        2. Installing
          1. Microsoft Windows
          2. Mac OS X
          3. Ubuntu
        3. The Typesafe Stack
        4. Checking if it's okay in your terminal
      2. Creating your first project
      3. Keeping your habits
        1. Using Eclipse
          1. Eclipse Juno
          2. Using Scala IDE
        2. IntelliJ IDEA
        3. Sublime Text 2
      4. Simple Build Tool
        1. Adding a third-party dependency
        2. Repositories
      5. It's alive and not empty!
        1. Browsing the Java API
      6. Understanding the core pieces
        1. Routing
        2. Action
          1. Similarities between the Java and Scala action code
          2. Differences between the Java and Scala action code
        3. Templates
        4. Practicing
          1. Modifying the template
          2. Modifying the controller
          3. Modifying the content type to JSON
          4. Browsing our errors
      7. Summary
    10. 2. Scala – Taking the First Step
      1. Introducing Scala
        1. Expressing your code
          1. If-else
          2. Switch/Pattern matching
      2. Generic types
      3. Iterating over a sequence
        1. Function – foreach
        2. Function – map
        3. Function – filter
        4. Function – exists
        5. Function – find
        6. Function – apply
        7. Other interesting functions
      4. Partial application
      5. Summary
    11. 3. Templating Easily with Scala
      1. Shape it, compose it, re-use it
        1. Creating our first template
        2. Structuring it
        3. Adding content
        4. Composing templates
        5. Passing data structures
      2. Playing around
        1. Laying out
        2. Using domain models
        3. Re-using our code
      3. Skinning with LESS pain
      4. Summary
    12. 4. Handling Data on the Server Side
      1. Feeding some data
        1. Forming a (server) form
      2. Ingesting data
        1. Extracting the data
        2. Enhancing your data
        3. Validating our data
      3. Persisting them
        1. Activating a database
        2. Accessing the database
        3. Object-relational mapping
        4. Storing and fetching – a simple story
      4. Porting to Scala
        1. Models
        2. Parsing the DB result
        3. Speaking with the browser
      5. Summary
    13. 5. Dealing with Content
      1. Body parsing for better reactivity
      2. Creating a forum
        1. Reorganizing and logging in
        2. Chatting
      3. Handling multipart content types
      4. Rendering contents
        1. Imaging all of the chat
        2. Atomizing the chats
      5. Summary
    14. 6. Moving to Real-time Web Applications
      1. Ready, JSON, poll
        1. Configuring a dashboard
        2. Some sugar with your Coffee(Script)
        3. Words about CoffeeScript's syntax
          1. Explaining CoffeeScript in action
          2. Rendering the dashboard
        4. Updating the dashboard in live mode
      2. Dynamic maintains form
      3. Real time (advanced)
        1. Adding WebSocket
        2. Receiving messages
        3. Multiplexing events to the browser
        4. Live multichatting
      4. Summary
    15. 7. Web Services – At Your Disposal
      1. Accessing third parties
      2. Interacting with Twitter
        1. Using the Twitter API
        2. Integrating chatrum with Twitter search
      3. Long tasks won't block
      4. Summary
    16. 8. Smashing All Test Layers
      1. Testing atomically
        1. Running our atomic tests
      2. Writing applicative tests
      3. Testing workflows
      4. Summary
    17. 9. Code Once, Deploy Everywhere
      1. Continuous Integration (CloudBees)
      2. Deployment (Heroku)
      3. Monitoring (Typesafe Console)
      4. Summary
    18. A. Introducing Play! Framework 2
      1. Why do we need Play! Framework?
        1. Framework for the Web
        2. Not JEE-based, but JVM
      2. Underlying ideas and concepts
        1. Reactive
          1. NIO server
          2. Asynchronous
          3. Iteratee
          4. Wrap up
      3. What's new?
        1. Scala
        2. Simple Build Tool
        3. Templates
        4. Assets
      4. Amazing goodies
        1. HTML5
        2. External services
        3. Form validation
        4. Hot reloading
        5. Only two tools – IDE and browser
      5. Summary
    19. B. Moving Forward
      1. More features
        1. Plugin
        2. Global
        3. Session, cache, and i18n
        4. Frontend languages
      2. Scala-specific
      3. Ecosystem
    20. C. Materials
    21. Index