Instant Play Framework Starter - Daniel Dietrich - E-Book

Instant Play Framework Starter E-Book

Daniel Dietrich

0,0
19,19 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.
Mehr erfahren.
Beschreibung

Play is a full-featured Java and Scala web framework for building modern, high-performance web applications. It is characterized by its simplicity and scalability. With its lightweight, stateless, and web-friendly architecture, Play focuses on developer experience to make web application development fun.Instant Play Framework Starter is the ideal companion to start developing web applications with Play. The building blocks of a typical web application are carefully designed following an on-going example.Instant Play Framework Starter starts with a quick setup and running a first sample. Then, the anatomy of a typical Play application is outlined. More features are added step by step to an example application. The result is the prototype of a highly scalable web application.The example is implemented in Java and in Scala. It consists of building blocks you will find in every Play application. In particular, you will learn how views are rendered with the template engine, how HTTP routes are used to define the navigation rules, and how to separate the application logic of controllers from the business logic of the model. This separation is the result of a careful application design, which makes it easy to add features like data binding and validation. Finally you will see how easy it is to adapt different database access libraries.

Instant Play Framework Starter will help you to get started with Play and develop your first application. Packed with examples, it is easy to follow the design of a real-world application. You are able to compare the difference between a Java- and a Scala-based Play application and to decide which language fits your needs best. All topics covered in the book are described with the aim to serve as a reference for future web application development with Play.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 69

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Instant Play Framework Starter
Credits
About the Author
About the Reviewers
www.packtpub.com
Support files, eBooks, discount offers and more
packtlib.packtpub.com
Why Subscribe?
Free Access for Packt account holders
1. Instant Play Framework Starter
So, what is Play?
Installation
Step 1 – What do I need?
Step 2 – Downloading Play
Step 3 – Setting the PATH environment variable
Step 4 – Testing the Play installation
And that's it!
Quick start – Creating your first Play application
Step 1 – Creating a new Play application
Structure of a Play application
The app/ folder
The conf/ directory
The project/ folder
The public/ folder
The test/ folder
Step 2 – Using the Play console
Starting our application
Play console commands
Closing the console
Step 3 – Modifying our application
Fast turnaround – change your code and hit reload!
Stripped down and optimized stack traces
Step 4 – Setting up your preferred IDE
IntelliJ IDEA
Eclipse
Other IDEs
Top features you need to know about
1 – Designing a Play application
Introducing our sample application
Defining the domain model
The Java model
The Scala model
Designing the HTTP interface with the routes file
Defining the application routes
Dynamic request paths and variables
Testing the routes
Handling HTTP requests by controller actions
Providing dummy implementations
URL redirection with reverse routes
Implementing controller actions
The Java code
The Scala code
What comes next
Composing the UI from view templates
Syntax of view templates
View parameters
View imports
View expressions
Composing view templates
Example
Nesting view templates
Implementing the phone book views
Prerequisites
The index view template
The list view template
The main view template
Fine-tuning the CSS style
Providing some test data
2 – Dealing with user input
Defining a form
The server side
Binding data with a Java form
Binding data with a Scala form
The client side
Validating user input
The server side
Defining constraints in Java
Defining constraints in Scala
The client side
Using form template helpers
3 – Connecting to a database
Accessing data with Ebean for Java
Customizing the configuration
Creating the database schema
Implementing the model
Running the application
Accessing data with Anorm for Scala
Customizing the configuration
Creating the database schema
Implementing the model
Running the application
Accessing data with Slick for Scala
Customizing the configuration
Implementing the model
The data access object
The data access layer
Generating the database schema
People and places you should get to know
Official sites
Articles and tutorials
Community
Blogs
Twitter

Instant Play Framework Starter

Instant Play Framework Starter

Copyright © 2013 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 2013

Production Reference: 1170513

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78216-290-2

www.packtpub.com

Credits

Author

Daniel Dietrich

Reviewers

Takafumi Ikeda

Jérôme Leleu

Acquisition Editor

James Jones

Commissioning Editor

Sharvari Tawde

Technical Editors

Sharvari Baet

Chirag Jani

Soumya Kanti

Project Coordinator

Suraj Bist

Proofreader

Paul Hindle

Production Coordinator

Aparna Bhagat

Cover Work

Aparna Bhagat

Cover Image

Valentina Dsilva

About the Author

Daniel Dietrich is a Senior Software Engineer living in Kiel, Germany. He studied Computer Science with Mathematics as a subsidiary subject and earned his diploma degree at the Christian-Albrechts University of Kiel. He specializes in enterprise grade frontend and backend development with a current focus on building a financial risk services platform.

Daniel has been developing software for over 25 years, thereof, 15 years professionally. He started to program at the age of 11. His creative work was influenced by computer competitions during the 90s. In the late 90s, he began to develop web applications.

Daniel worked as a Software Developer for several companies and is currently employed at the HSH Nordbank. He is focused on designing enterprise architectures and implementing Java enterprise applications. He has a special interest in JVM languages and web frameworks, especially Scala and the Play Framework.

I want to thank my beloved wife Andrea—I am deeply thankful for her support and her unconditional devotion.

I also want to thank my wonderful kids, Emil, Leni, and Paul for being so patient when daddy sits in front of his notebook.

A special thanks goes to Ingo Hammer for supporting me at the HSH Nordbank.

My last appreciation goes to everyone at Packt Publishing who was involved in this project, especially Poonam Jain, Meeta Rajani, Sharvari Tawde, and Suraj Bist.

About the Reviewers

Takafumi Ikeda is the maintainer of Play Framework 1 and currently works as the Developer Advocate of a mobile gaming platform. He is also the author of the Jenkins Play Framework plugin and is also the representative of Japanense Play Framework users group. He has written several articles about Play on Japan tech media and has also talked about technical matters, especially about Play, in tech conferences/seminars in Japan. You can contact him on Twitter @ikeike443 (in Japanese) or @Takafumi_Ikeda (in English).

Jérôme Leleu is a Software Architect living in Paris, France.

A Consultant for 7 years, he has worked in many different companies, fields, and with many different people. He has participated in many IT projects as a Developer, Technical Lead, or Projects Manager, mostly with J2EE technology.

Now working in a French telecom company, he is the Software Architect of the company's web SSO, which supports very high traffic: millions of authentications from millions of users every day. He's also leading the software architecture of the company website.

He is involved in open source development as a CAS (web SSO) Committer. Interested in security/protocol issues, he has developed several libraries, one of which is a Java and Scala client for the Play 2 Framework to protect an application with CAS, OAuth, OpenID, or HTTP protocols.

www.packtpub.com

Support files, eBooks, discount offers and more

You might want to visit www.packtpub.com for support files and downloads related to your book.

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.

packtlib.packtpub.com

Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital book library. Here, you can access, read and search across Packt’s entire library of books.

Why Subscribe?

Fully searchable across every book published by PacktCopy and paste, print and bookmark contentOn demand and accessible via web browser

Free Access for Packt account holders

If you have an account with Packt at www.packtpub.com, you can use this to access PacktLib today and view nine entirely free books. Simply use your login credentials for immediate access.

Chapter 1. Instant Play Framework Starter

Welcome to InstantPlay Framework Starter. This book has been especially created to provide you with all the information that you need to get started with the Play Framework for Java and Scala. You will learn the basics of Play, get involved with building your first application, and discover some tips and tricks for using Play.

This contains the following sections:

So, what is Play?