Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Play for Java
Play for Java
Play for Java
Ebook566 pages4 hours

Play for Java

Rating: 0 out of 5 stars

()

Read preview

About this ebook

Summary

Play for Java shows you how to build Java-based web applications using the Play 2 framework. The book starts by introducing Play through a comprehensive overview example. Then, you'll look at each facet of a typical Play application, both by exploring simple code snippets and by adding to a larger running example. Along the way, you'll contrast Play and JEE patterns and learn how a stateless web application can fit seamlessly in an enterprise environment.

About the Book

For a Java developer, the Play web application framework is a breath of fresh air. With Play you get the power of Scala's strong type system and functional programming model, and a rock-solid Java API that makes it a snap to create stateless, event-driven, browser-based applications ready to deploy against your existing infrastructure.

Play for Java teaches you to build Java-based web applications using Play 2. This book starts with an overview example and then explores each facet of a typical application by discussing simple snippets as they are added to a larger example. Along the way, you'll contrast Play and JEE patterns and learn how a stateless web application can fit seamlessly in an enterprise Java environment. You'll also learn how to develop asynchronous and reactive web applications.

The book requires a background in Java. No knowledge of Play or of Scala is assumed.

Purchase of the print book includes a free eBook in PDF, Kindle, and ePub formats from Manning Publications.

What's Inside
  • Build Play 2 applications using Java
  • Leverage your JEE skills
  • Work in an asynchronous way
  • Secure and test your Play application

About the Authors

Nicolas Leroux is a core developer of the Play framework. Sietse de Kaper develops and deploys Java-based Play applications.

Table of Contents
    PART 1 INTRODUCTION AND FIRST STEPS
  1. An introduction to Play
  2. The parts of an application
  3. A basic CRUD application
  4. PART 2 CORE FUNCTIONALITY
  5. An enterprise app, Play-style
  6. Controllers—handling HTTP requests
  7. Handling user input
  8. Models and persistence
  9. Producing output with view templates
  10. PART 3 ADVANCED TOPICS
  11. Asynchronous data
  12. Security
  13. Modules and deployment
  14. Testing your application
LanguageEnglish
PublisherManning
Release dateFeb 28, 2014
ISBN9781638352860
Play for Java
Author

Nicolas Leroux

Nicolas Leroux is Technical Director at Lunatech Research in The Netherlands and is a core developer of the Play framework. Nicolas is also a frequent speaker at conferences where he introduces Play to the audience.

Related to Play for Java

Related ebooks

Programming For You

View More

Related articles

Reviews for Play for Java

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Play for Java - Nicolas Leroux

    Copyright

    For online information and ordering of this and other Manning books, please visit www.manning.com. The publisher offers discounts on this book when ordered in quantity. For more information, please contact

         Special Sales Department

         Manning Publications Co.

         20 Baldwin Road

         PO Box 261

         Shelter Island, NY 11964

         Email: 

    orders@manning.com

    ©2014 by Manning Publications Co. All rights reserved.

    No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, without prior written permission of the publisher.

    Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in the book, and Manning Publications was aware of a trademark claim, the designations have been printed in initial caps or all caps.

    Recognizing the importance of preserving what has been written, it is Manning’s policy to have the books we publish printed on acid-free paper, and we exert our best efforts to that end. Recognizing also our responsibility to conserve the resources of our planet, Manning books are printed on paper that is at least 15 percent recycled and processed without the use of elemental chlorine.

    ISBN 9781617290909

    Printed in the United States of America

    1 2 3 4 5 6 7 8 9 10 – EBM – 19 18 17 16 15 14

    Brief Table of Contents

    Copyright

    Brief Table of Contents

    Table of Contents

    Foreword

    Preface

    Acknowledgments

    About this Book

    1. Introduction and first steps

    Chapter 1. An introduction to Play

    Chapter 2. The parts of an application

    Chapter 3. A basic CRUD application

    2. Core functionality

    Chapter 4. An enterprise app, Play-style

    Chapter 5. Controllers—handling HTTP requests

    Chapter 6. Handling user input

    Chapter 7. Models and persistence

    Chapter 8. Producing output with view templates

    3. Advanced topics

    Chapter 9. Asynchronous data

    Chapter 10. Security

    Chapter 11. Modules and deployment

    Chapter 12. Testing your application

    Index

    List of Figures

    List of Tables

    List of Listings

    Table of Contents

    Copyright

    Brief Table of Contents

    Table of Contents

    Foreword

    Preface

    Acknowledgments

    About this Book

    1. Introduction and first steps

    Chapter 1. An introduction to Play

    1.1. What Play is

    1.1.1. Key features

    1.1.2. Java and Scala

    1.1.3. Play is not Java EE

    1.2. High-productivity web development

    1.2.1. Working with HTTP

    1.2.2. Simplicity, productivity, and usability

    1.3. Reactive programming

    1.3.1. Event-driven

    1.3.2. Scalable

    1.3.3. Resilient

    1.3.4. Responsive

    1.4. Play 2 enterprise features

    1.4.1. Simplicity

    1.4.2. Traditional data access

    1.4.3. Flexibility

    1.4.4. Integration

    1.4.5. Large-team applications

    1.4.6. Security

    1.4.7. Modularity

    1.5. Hello Play!

    1.5.1. Installing Play

    1.5.2. Creating your first application

    1.5.3. Play application structure

    1.5.4. Running the application

    1.5.5. Accessing the running application

    1.5.6. Changing the controller class

    1.5.7. Add a compilation error

    1.5.8. Use an HTTP request parameter

    1.5.9. Add an HTML page template

    1.6. The console

    1.7. Summary

    Chapter 2. The parts of an application

    2.1. Introducing our application

    2.2. A rundown of a Play application

    2.3. Play’s configuration files

    2.4. Build configuration files

    2.5. Public assets

    2.6. Application code

    2.6.1. Compiled assets

    2.7. Setting up an IDE

    2.7.1. Eclipse

    2.7.2. NetBeans

    2.7.3. IntelliJ IDEA

    2.7.4. Using a debugger

    2.8. Summary

    Chapter 3. A basic CRUD application

    3.1. Adding a controller and actions

    3.2. Mapping URLs to action methods using routes

    3.3. Adding a model and implementing functionality

    3.3.1. Creating a model class

    3.4. Mocking some data

    3.5. Implementing the list method

    3.5.1. The list template

    3.6. Adding the product form

    3.6.1. Constructing the form object

    3.6.2. Rendering the HTML form

    3.6.3. Rendering input fields

    3.7. Handling the form submission

    3.8. Adding a delete button

    3.9. Summary

    2. Core functionality

    Chapter 4. An enterprise app, Play-style

    4.1. Recalling what an enterprise application is

    4.2. Determining today’s enterprise application challenges

    4.3. Understanding Play’s application in an enterprise context

    4.4. Defining our warehouse enterprise application

    4.5. Summary

    Chapter 5. Controllers—handling HTTP requests

    5.1. Controllers and action methods

    5.1.1. Action methods

    5.1.2. Examining our controller

    5.2. Returning results from action methods

    5.2.1. Results

    5.2.2. Redirect result

    5.2.3. Using results

    5.3. Using routing to wire URLs to action methods

    5.3.1. Translating HTTP to Java code

    5.3.2. The routes files explained

    5.3.3. Dynamic path parts

    5.3.4. Completing our routes file

    5.3.5. Reverse routing

    5.4. Interceptors

    5.4.1. The @With annotation

    5.4.2. Explaining our CatchAction

    5.4.3. Action composition

    5.5. About scopes

    5.5.1. A bit of history about the scopes

    5.5.2. Storing data with Play

    5.5.3. The context object

    5.5.4. The request scope

    5.5.5. The response scope

    5.5.6. The session scope

    5.5.7. The flash scope

    5.5.8. What about security?

    5.6. Summary

    Chapter 6. Handling user input

    6.1. Forms

    6.1.1. Displaying the new product form

    6.1.2. Displaying the edit product form

    6.1.3. Processing form input

    6.2. Data binding

    6.2.1. Binding single values

    6.2.2. Binding multiple values

    6.2.3. Custom data binders and formatters

    6.3. Body parsers

    6.3.1. The body-parser API

    6.4. Validation

    6.4.1. Using the built-in validators

    6.4.2. Partial validation

    6.4.3. Creating a custom validator

    6.4.4. Displaying the validation errors on the form

    6.5. File uploads

    6.6. Summary

    Chapter 7. Models and persistence

    7.1. Modeling the real world in code

    7.1.1. The reasons for getters and setters

    7.1.2. Let Play eliminate some noise for you

    7.1.3. Creating our classes

    7.2. Persistence and Object-Relational Mapping (ORM)

    7.2.1. About relational databases

    7.2.2. Bridging the relational world and the OO world

    7.2.3. Introducing Ebean

    7.3. Mapping basic entities

    7.3.1. Configuring Ebean and the database

    7.3.2. Inspecting the H2 database

    7.3.3. Saving our first entities

    7.4. Mapping relationships

    7.4.1. Mapping a one-to-many relationship

    7.4.2. Making the one-to-many relationship bidirectional

    7.4.3. Giving our warehouse an address

    7.4.4. Mapping the product–tag relationship

    7.5. Querying for objects

    7.5.1. Retrieving by ID

    7.5.2. Using the Finder API

    7.5.3. Loading initial data

    7.5.4. Creating more complex queries

    7.6. Using JPA instead of Ebean

    7.6.1. Configuring Play

    7.6.2. Adding Persistence.xml

    7.6.3. Built-in JPA helpers

    7.7. Summary

    Chapter 8. Producing output with view templates

    8.1. The benefits of compiled, type-safe templates

    8.2. Scala template syntax

    8.2.1. Template definition

    8.2.2. Template body

    8.2.3. Expression scope

    8.3. Your basic building blocks

    8.3.1. Iterating

    8.3.2. Making decisions

    8.4. Structuring pages with template composition

    8.4.1. Includes

    8.4.2. Layouts

    8.5. Using LESS and CoffeeScript: the asset pipeline

    8.5.1. LESS

    8.5.2. CoffeeScript

    8.5.3. The asset pipeline

    8.6. Internationalization

    8.6.1. Configuration and message files

    8.6.2. Using messages in your application

    8.7. Summary

    3. Advanced topics

    Chapter 9. Asynchronous data

    9.1. What do we mean by asynchronous data?

    9.2. Handling asynchronous data

    9.2.1. Handling asynchronous requests

    9.2.2. Returning the asynchronous result

    9.3. Scheduling asynchronous tasks

    9.4. Streaming HTTP responses

    9.4.1. Standard responses and Content-Length header

    9.4.2. Serving files

    9.4.3. Chunked responses

    9.5. Unidirectional communication with Comet

    9.6. Bidirectional communication with WebSockets

    9.6.1. WebSockets explained

    9.6.2. A more advanced application with WebSockets

    9.7. Summary

    Chapter 10. Security

    10.1. Play security concepts

    10.1.1. Play 2 session

    10.1.2. Cross-site scripting

    10.1.3. SQL injection

    10.1.4. Cross-site request forgery

    10.2. Adding basic authentication with filters

    10.3. Fine-grained authentication with action composition

    10.4. Summary

    Chapter 11. Modules and deployment

    11.1. Modules

    11.1.1. Using modules

    11.1.2. Creating modules

    11.2. Splitting your application into multiple sub-applications

    11.3. Deploying to production

    11.3.1. Packing up your application

    11.3.2. Working with multiple configurations

    11.3.3. Creating native packages for a package manager

    11.3.4. Setting up a front-end proxy

    11.3.5. Using SSL

    11.3.6. Deploying to a cloud provider

    11.3.7. Deploying to an application server

    11.4. Summary

    Chapter 12. Testing your application

    12.1. Testing Play applications

    12.1.1. Writing tests

    12.1.2. Running tests

    12.2. Functional testing

    12.2.1. Testing your controllers

    12.2.2. Template testing

    12.2.3. Testing the router

    12.3. Integration testing

    12.3.1. Testing your HTTP interface

    12.3.2. Browser testing

    12.4. Summary

    Index

    List of Figures

    List of Tables

    List of Listings

    Foreword

    Before Struts existed I wrote an entire Java web application inside a single Servlet method because that is basically how I’d done things in Perl. Back then web apps were simple and the tools were immature. As the web evolved, dozens of Java web frameworks emerged which were all built on the same Servlet foundation. Being over 15 years old, the Servlet foundation is showing its age. The traditional Java web frameworks haven’t kept up with the modern needs for higher developer productivity and emerging web techniques like RESTful JSON services, WebSockets, asset compilers, and reactive architectures.

    Play Framework was created to revolutionize Java web application development. Play is built for modern web needs and puts developer productivity at the core of the framework. I love that with Play I just hit Refresh in my browser and I instantly see my changes, whether they’re Java, JavaScript, or CSS. There is no container to redeploy into or restart. If there are compile errors I see them in a helpful way in my browser. Things like testing tools, persistence libraries, JSON support, and other commonly needed pieces come out-of-the-box with Play. By being RESTful by default, supporting push channels, and utilizing non-blocking connections, Play provides a solid foundation for scalable reactive applications.

    When I made the transition from Perl to object-oriented Java web apps, I needed some help to get me over the hurdles of figuring out new ways to do things. Luckily books like Thinking in Java (Bruce Eckel) and Java Servlet Programming (Jason Hunter) helped me move into a new way of thinking which allowed me to quickly and easily make the transition to something new and better. I have no doubt that the book you’re reading now will do the same for you. Nicolas and Sietse have been using Play from its early days. They’re experts who haven’t just played with the framework, they’ve built numerous production applications using Play. They’ve experienced the challenge of adopting something new and know the pains you can avoid.

    Web programming has changed dramatically since the early Servlet days. Play has revolutionized the development experience for building modern Java web applications. This book will help you quickly make the transition to more productive ways to build modern web apps. I’m confident that down the road you will look back on this book like I look back on Eckel’s and Hunter’s books. I just wish this book had existed when I learned Play.

    JAMES WARD

    PRODUCT OWNER OF PLAY FRAMEWORK AT TYPESAFE

    @_JAMESWARD | WWW.JAMESWARD.COM

    Preface

    Back in 2009, I discovered Play by chance while surfing the web. I was surprised at how easy it was to get started with the framework. At the time, I was doing most of my web development using the Seam web framework. Play was a game changer then, and I started to build all my applications using it. Soon enough, I joined Guillaume Bort, the founder of Play, and contributed to the framework.

    The framework started to gain more and more traction, though mostly in Europe. Time passed, and we released Play 1.1 and then Play 1.2. Then Guillaume started to envision a complete rewrite of Play using Scala as a core language, giving Play extra power. The goal was to empower Play’s users while keeping the main success ingredients: Play’s simplicity and rapidity. Guillaume soon joined forces with Sadek Drobi. Sadek put his functional programming knowledge into the mix and Play 2 was born! Though the Play 2 core uses advanced Scala features, Play 2 focuses on simplicity and has a fully supported Java API. Play 2 Java is probably the best option for building scalable web applications with simplicity in mind without sacrificing scalability and other features.

    While I contributed little to Play 2’s features codewise, my main contribution to Play 2 adoption is this book. I hope it will become an invaluable aid to professional Play developers. In truth, my coauthor Sietse and I could have added even more information to this book, but we hope that we’ve struck a good balance between useful content and weight. We also hope that you will enjoy the book and that it will help you unleash the full potential of Play while keeping its simplicity in mind.

    NICOLAS LEROUX

    Soon after Nicolas introduced Play at Lunatech, it became clear that this was going to be the framework we’d be using for all new projects. Play gets it. For it, in this case, a lot of things can be substituted. Play gets HTTP and the web in general, how developing web application works, what makes a nice and clean API, and more. This was clear from the early Play 1 beta versions, and that’s why we’ve used it on many projects since 1.0 came out. It didn’t disappoint.

    Now, with Play 2, Play continues to improve web development for the Java platform.

    It’s interesting that we have to say Java platform, rather than just Java. The Java platform is no longer synonymous with the Java language—there are a lot of different languages targeting the JVM, all trying to improve the developer experience in their own way. Play 2 embraces Scala, partly for its benefits as a reactive[¹] language, but also for all the benefits that a strictly type-safe language provides. By supplying a first-class Java API to the framework, Play 2 provides the best of both worlds.

    ¹ Read the Reactive Manifesto at http://www.reactivemanifesto.org/ if you want to know what that means, exactly.

    We wrote this book in the hope that it will help you take advantage of all the benefits that web development using Play offers. But, perhaps more importantly, we also wanted to teach you all the core concepts behind Play. They’re just good principles when developing for the web, and Play makes it easy to apply them. We hope we succeeded in these goals, and that you’ll enjoy this book and developing Play applications.

    SIETSE DE KAPER

    Acknowledgments

    We first want to thank Karen Miller, our development editor at Manning, who put up with our many missed deadlines and gave us great feedback during the writing process. We’d also like to thank our awesome copyeditors, Benjamin Berg, Melinda Rankin, and Andy Carroll, for catching an amazing number of grammatical errors in the early revisions of the book. The greater Manning team deserves kudos as well; they’ve made for a very pleasant writing experience over the past year and a half.

    We would like to think James Ward for writing such a great foreword to our book.

    Thanks to Wayne Ellis for being our technical proofreader, catching those bugs we missed, and helping improve the source code for the book.

    Big thanks to our team of reviewers, who provided invaluable feedback during various stages of the book’s development: Dr. Lochana C. Menikarachchi, Franco Lombardo, Jeroen Nouws, John Tyler, Koray Güçlü, Laurent DeCorps, Michael Schleichardt, Patria H. Lukman, Ricky Yim, Rob Williams, Ryan Cox, Santosh Shanbhag, and William E. Wheeler.

    Special thanks to the Play for Scala book team—our colleagues Peter Hilton, Erik Bakker, and Francisco Canedo—for cooperating with us on the book. We’d like to thank Lunatech for providing us with a great work environment that makes it possible to do cool stuff like work with and contribute to Play.

    In addition, we’d like to give a big warm thank you to the Play community. Without the community, the Play project wouldn’t be as successful as it is today. In addition to the Play community, we would like to especially thank all our readers who posted on the Manning Online Author forum after reviewing the Early Access (MEAP) chapters. Special thanks to Steve Chaloner, Infra, Askar, and all others for providing such great feedback.

    Of course, our biggest supporters are our families, who supported us even though they don’t have a clue what the book is about.

    NICOLAS would like to thank his wife Sylke for her support during the book project, and his girls Emilie and Isabelle for distracting him when in need of a break.

    SIETSE would like to thank his wife Joekie for her endless patience and loving support—not just during the writing of this book, but always.

    About this Book

    This book will get you started developing web applications with Play 2, using the Java programming language. But, perhaps more importantly, it’ll also teach you the concepts behind web development with Play.

    There are many Java web frameworks, but most of them have a key flaw: they try to hide the web behind an abstraction layer, rather than embracing it. That is the most important difference between Play and most other Java web frameworks (Servlets, we’re looking at you!).

    Developing a web application with Play requires a certain mindset. Throughout the book, we try to teach you how to achieve that. If you’re a Java EE veteran, we’ll do our best to lessen the culture shock. But if you’re new to web development with Java, or web development in general, we’ve got your back, too. We do our best to explain everything about web development that you need to know.

    The only assumption we make is that you have some background in Java programming—you should be comfortable reading and writing Java code. We’ve used Java 7 syntax throughout this book, since that is the supported version of Java at the time of writing.

    You’ve probably already heard that Play 2 is written in Scala. That is absolutely true, and we feel that the language and the tools available for the platform are an excellent choice to write a web platform in. We also feel that there is no reason you should have to build a web application in Scala. Play developers apparently agree, because Play has a first-class Java API, which means you can write a full application using Play 2 without writing a single line of Scala.

    In this book, we avoid discussing Scala wherever possible. There is one subject where this wasn’t avoidable: view templates in Play 2 are based on the Scala language. But in the rest of the book we treat it as just another template language, showing you the basic constructs you need to create your templates. We promise you don’t need to learn any Scala to follow along with this book.

    As we write this, the current version of Play is 2.2. That means that all the code we demonstrate assumes a Play version of 2.2.x, and we’ve tested every code sample under version 2.2.0.

    Roadmap

    This book is organized in three parts. The first part introduces you to all the basic concepts of Play. The second part dives deeper into the core elements of a Play application, while the third part demonstrates more advanced things that you can do with Play. Here’s a quick overview of all the chapters.

    Chapter 1 introduces Play, and highlights some of its important features. It then shows you how to install Play and create a simple Hello World application.

    Chapter 2 takes a look at what makes up a Play application. It goes over all the directories and files, and explains what every component is for. We also show you how you can import a Play application into your IDE.

    Chapter 3 shows a simple web application, without going into too much detail. In this chapter, we’ll see every important part of Play in action: controllers, actions, templates, and forms. This is the start of an application that we’ll develop in the book.

    Chapter 4 takes a step back and looks at where Play fits in a more conventional enterprise architecture. It contrasts Play with conventional JEE development, and shows how Play can tackle major challenges in such an architecture.

    Chapter 5 is all about controllers. It explains what controllers are and how action methods help you interface with the web. It also explains how routing works and introduces the different scopes.

    Chapter 6 covers how to handle user input. We show you how to use Play’s Form API, as well as how binding and validation work.

    Chapter 7 introduces database persistence. We explain the concept of an ORM and show you how to use the Ebean ORM tool with Play. At the end of the chapter, we discuss how you can use JPA with Play instead of Ebean, should you choose to do so.

    Chapter 8 explains how view templates work. It explains the template syntax, and shows how to use composition to structure your pages in a reusable manner. At the end of the chapter, we look at using Play’s support for LESS and CoffeeScript, and introduce the internationalization API.

    Chapter 9 covers one of the more powerful features of Play: asynchronous request handling. It explains why long-running tasks are better performed in the background, and how to achieve that easily. It also shows how you can have a web application with streaming data, using WebSockets or Comet.

    Chapter 10 explains how you can build a secure application in Play. It also explains how you can avoid common security problems, and how you can use filters to implement authentication.

    Chapter 11 covers the build process of Play. It explains the configuration files, and shows you how to package your code in reusable modules. Finally, it shows you what’s involved with taking your application to production.

    Chapter 12 introduces the tools that Play has for testing your application. It explains the different kinds of automated tests there are, and how you can write them for your application.

    Code conventions and downloads

    All source code in listings or in text is in a fixed-width font like this to separate it from ordinary text. Code annotations accompany many of the listings, highlighting important concepts. The current version of Play is 2.2 at the time of writing. That means that all the code we demonstrate assumes a Play version of 2.2.x, and we’ve tested every code sample under version 2.2.0.

    Source code for all working examples in this book is available for download from GitHub at https://github.com/playforjava, as well as from the publisher’s website at www.manning.com/PlayforJava.

    Author Online

    The purchase of Play for Java includes free access to a private web forum run by Manning Publications where you can make comments about the book, ask technical questions, and receive help from the authors and other users. To access the forum and subscribe to it, visit www.manning.com/PlayforJava. This page provides information on how to get on the forum once you’re registered, what kind of help is available, and the rules of conduct on the forum.

    Manning’s commitment to readers is to provide a venue for meaningful dialogue between individual readers and between readers and the authors. It is not a commitment to any specific amount of participation on the part of the authors, whose contribution to the forum remains voluntary (and unpaid). Let your voice be heard, and keep the authors on their toes!

    The Author Online forum and the archives of previous discussions will be accessible from the publisher’s website as long as the book is in print.

    About the authors

    Nicolas Leroux is a senior architect and Technical Director at Lunatech Research where he’s worked since 2001 and where he is mainly involved in JEE projects for Lunatech’s customers. Since 2009, Nicolas has developed a passion for the Play framework and is a core developer of its open source project. He was involved in the first version of the Play framework and is contributing to the second one. Nicolas also enjoys introducing Play to new audiences and is a frequent speaker at conferences.

    SIETSE DE KAPER started his career as a software developer at Lunatech Research in 2007. He has worked on several commercial web applications using various web frameworks—mostly Java, but also PHP, Ruby, and Scala. Sietse started developing applications with the Play framework when version 1.0 came out in October 2009. After using Play on several projects, he now considers it the most effective framework in the Java ecosystem.

    About the cover illustration

    The figure on the cover of Play for Java is captioned a Farmer from Dobrota, Montenegro. The illustration is taken from the reproduction, published in 2006, of a nineteenth-century collection of costumes and ethnographic descriptions entitled Dalmatia by Professor Frane Carrara (1812–1854), an archaeologist and historian, and the first director of the Museum of Antiquity in Split, Croatia. The illustrations were obtained from a helpful librarian at the Ethnographic Museum (formerly the Museum of Antiquity), itself situated in the Roman core of the medieval center of Split: the ruins of Emperor Diocletian’s retirement palace from around AD 304. The book includes finely colored illustrations of figures from different regions of Dalmatia, accompanied by descriptions of the costumes and of everyday life.

    Dobrota is a small town on the Adriatic coast, officially a part of the municipality of Kotor, an ancient Mediterranean port on Kotor Bay, surrounded by fortifications built in the Venetian period. Today it is increasingly a tourist destination, due to the dramatic limestone cliffs and beautiful coastal vistas. The man on the cover is wearing an embroidered vest over black woolen pantaloons and a wide colorful sash. He is carrying a long pipe, a musket, and has pistols inserted in his sash. The rich and colorful embroidery on his costume is typical for this region, and marks this as an outfit for special occasions and not for working the land.

    Dress codes have changed since the nineteenth century, and the diversity by region, so rich at the time, has faded away. It is now hard to tell apart the inhabitants of different continents, let alone different towns or regions. Perhaps we have traded cultural diversity for a more varied personal life—certainly for a more varied and fast-paced technological life.

    At a time when it is hard to tell one computer book from another, Manning celebrates the inventiveness and initiative of the computer business with book covers based on the rich diversity of regional life of two centuries ago, brought back to life by illustrations from collections such as this one.

    Part 1. Introduction and first steps

    In Part 1, we introduce Play and show the basics of creating a Play application.

    Chapter 1 introduces Play, its core concepts, and its key features. We install Play and create our first application.

    Chapter 2 breaks down the structure of a Play application, explaining what each file and folder is for.

    Chapter 3 shows how to create a more fleshed-out application, giving you a taste of the key MVC components in a Play application.

    Chapter 1. An introduction to Play

    This chapter covers

    What the Play framework is

    What high-productivity

    Enjoying the preview?
    Page 1 of 1