Book Image

Mastering play framework for scala

By : Shiti Saxena
Book Image

Mastering play framework for scala

By: Shiti Saxena

Overview of this book

Table of Contents (21 chapters)
Mastering Play Framework for Scala
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with Play
Index

GlobalSettings


Every Play application has a global object which can be used to define application-wide objects. It can also be used to customize the application's life cycle and the request-response life cycle.

The global object for an application can be defined by extending the trait GlobalSettings. By default, the name of the object is expected to be Global and it is assumed to be in the app directory. This can be changed by updating application.global in the conf/application.conf property. For example, if we wish to use a file with AppSettings in the app/com/org name:

application.global=app.com.org.AppSettings

The GlobalSettings trait has methods that can be used to interrupt both the application's life cycle and the request-response life cycle. We will see its methods as and when required in the following sections.

Now, let's see how this works.

An app developed through the Play Framework is represented by an instance of the Application trait, since its creation and the build is to be handled...