39,59 €
This book is intended for those developers who are keen to master the internal workings of Play Framework to effectively build and deploy web-related apps.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 257
Veröffentlichungsjahr: 2015
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2015
Production reference: 1260515
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-380-3
www.packtpub.com
Author
Shiti Saxena
Reviewers
Didier Bathily
Jérôme Leleu
Jon Parsons
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Subho Gupta
Content Development Editor
Sriram Neelakantan
Technical Editors
Novina Kewalramani
Manal Pednekar
Shruti Rawool
Copy Editors
Sonia Michelle Cheema
Vikrant Phadke
Project Coordinator
Vijay Kushlani
Proofreaders
Stephen Copestake
Safis Editing
Indexer
Monica Ajmera Mehta
Graphics
Sheetal Aute
Disha Haria
Production Coordinator
Arvindkumar Gupta
Cover Work
Arvindkumar Gupta
Shiti Saxena is a software engineer with around 4 years of work experience. She is currently working with Imaginea (a business unit of Pramati). She has previously worked with Tata Consultancy Services Ltd. and Genpact.
A true polyglot, she's had exposure to various languages, including Scala, JavaScript, Java, Python, Perl, and C. She likes to work with Play Scala and AngularJS.
She blogs at http://eraoferrors.blogspot.in and maintains open source projects on GitHub.
She loves to travel, is a movie buff, and likes to spend time playing her piano whenever she is not programming.
She has authored Getting Started with SBT for Scala (https://www.packtpub.com/application-development/getting-started-sbt-scala).
I am indebted to my mother, Nithi, and my sisters, Shaila, Anshu, and Aastha, for their constant support. I am grateful to Aastha for helping me out with the images of this book.
A special thanks to my cousin Rohit for being there for me; he has guided, mentored, understood, and pampered me throughout. This book would not have been possible without his help. I would also like to thank his organization, Tuplejump.Inc, for giving me the idea of using real-time applications with Play Framework.
I'd like to thank Jay and Vijay Pullur for taking the initiative to start Pramati and everyone who's a part of it for making it a great place to work at.
I'd like to thank Apurba for believing in me and supporting me in my journey. I wouldn't have learned a lot of things if it wasn't for his guidance.
I'd also like to thank Guillaume Bort, Sadek Drobi, the Play Framework community, and Typesafe without whose efforts, bringing this technology to the forefront and writing this book wouldn't have been possible.
I am grateful to my friends for being there for me when I needed them.
A huge thanks to the team of Packt Publishing for coordinating and being patient with me when I wasn't able to meet their deadlines. I am also thankful to the reviewers, Didier, Jérôme, and Jon, for their valuable feedback, which has helped improve this book.
I would like to express my gratitude to everyone who has helped me reach this stage in my life. Thanks!
Didier Bathily is a Malian software engineer living in France, who founded an IT development company in 2011 with his friends (http://www.njin.fr).
His involvement in this field and passion for new technologies have given him some versatility in software development. Indeed, for customer's njin, he develops modern web applications in Scala / Play Framework, mobile applications for iOS or Android, and games for iOS or Mac OS X applications.
You can find him on GitHub at https://github.com/dbathily and on Twitter at https://twitter.com/dbathily.
Jérôme Leleu is a software architect living in Paris, France.
A consultant for 7 years, he has worked in many different companies and fields with different people. He has participated in many IT projects as a developer, technical lead, or projects manager, mostly involving J2EE technology.
Now, working in a French telecom company, he is the software architect of the web SSO, which supports very high traffic: millions of authentications from millions of users every day.
He is involved in open source development as a CAS (WebSSO) chairman. He is interested in security/protocol issues and has developed several libraries at http://www.pac4j.org to implement client support for protocols such as CAS, OAuth, and OpenID.
He is now the founder of an SSO cloud provider based on CAS (https://www.casinthecloud.com).
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
The Play Framework is an open source web application framework that is written in Java and Scala. It follows the Model-View-Controller architectural pattern.
It enables the user to use Scala for application development, keeping key properties and features of the Play Framework intact. This results in faster and scalable web apps. Also, it uses a more functional and "Scala idiomatic" style of programming, without sacrificing simplicity and developer friendliness.
This book will provide advanced information on developing Scala web applications using the Play Framework. This will help Scala web developers master Play 2.0 and use it for pro-Scala web app development.
Chapter 1, Getting Started with Play, explains how to build simple applications using the Play Framework. We also explore the project structure so that you can understand how the framework plugs in the required settings through a build file.
Chapter 2, Defining Actions, explains how we can define an application-specific action with default parsers and results, and also with custom parsers and results.
Chapter 3, Building Routes, is where we see how essential routing is in a Play application. Apart from this, we also check out various default methods that Play provides for simplifying the process of routing.
Chapter 4, Exploring Views, explains how to create views using Twirl and the various other helper methods provided by Play. In this chapter, you also learn how you can support multiple languages in your Play application using the built-in i18n API.
Chapter 5, Working with Data, demonstrates different ways of causing application data to persist in an application that we build using the Play Framework. In addition to this, you also get to understand how the Play Cache API can be used and how it works.
Chapter 6, Reactive Data Streams, discusses the concepts of Iteratee, Enumerator, and Enumeratee and how they can be implemented in the Play Framework and used internally.
Chapter 7, Playing with Globals, gives an insight into the features provided for a Play application through the global plugin. We also discuss hooks for the request-response life cycle, using which we can intercept requests and responses and modify them if required.
Chapter 8, WebSockets and Actors, briefly covers the Actor Model and the usage of Akka Actors in an application. We also define a WebSocket connection in a Play application with various constraints and requirements, using different approaches.
Chapter 9, Testing, shows you how a Play application can be tested using Specs2 and ScalaTest. We go through the different helper methods available for simplifying testing of a Play application.
Chapter 10, Debugging and Logging, is where we configure the debugging of a Play application in the IDE. In this chapter, you get to learn how to start a Play application in the Scala console. This chapter also places emphasis on the logging API provided by the Play Framework and the methods of customizing the log format.
Chapter 11, Web Services and Authentication, explains the WS (WebService) plugin and the API exposed through it. We also access users' data from the service providers using OpenID and OAuth 1.0a.
Chapter 12, Play in Production, explains how to deploy a Play application on production. While deploying the application, we also check the different packaging options (RPM, Debian, ZIP, Windows, and so on) available by default.
Chapter 13, Writing Play Plugins, gives an explanation of all plugins, with their declaration, definition, and best practices.
Before starting with this book, make sure that you have all of the necessary software installed. The prerequisites for this book are as follows:
This book is intended for those developers who are keen on mastering the internal working of Play Framework to effectively build and deploy web-related apps. It is assumed that you have a basic understanding of the core app development techniques.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail us at <[email protected]>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.