You are previewing Beginning Groovy and Grails: From Novice to Professional.
O'Reilly logo
Beginning Groovy and Grails: From Novice to Professional

Book Description

Web frameworks are playing a major role in the creation of today's most compelling web applications, because they automate many of the tedious tasks, allowing developers to instead focus on providing users with creative and powerful features. Java developers have been particularly fortunate in this area, having been able to take advantage of Grails, an open source framework that supercharges productivity when building Java–driven web sites. Grails is based on Groovy, which is a very popular and growing dynamic scripting language for Java developers and was inspired by Python, Ruby, and Smalltalk.

Beginning Groovy and Grails is the first introductory book on the Groovy language and its primary web framework, Grails.

This book gets you started with Groovy and Grails and culminates in the example and possible application of some real–world projects. You follow along with the development of each project, implementing and running each application while learning new features along the way.

What you'll learn

  • Understand the fundamentals of the open source, dynamic Groovy scripting language and the Grails web framework.

  • Capitalize upon Grails' well–defined framework architecture to build web applications faster than ever before.

  • Improve your web application with cutting–edge interface enhancements using Ajax.

  • Use Grails' object–relational mapping solution, GORM, to manage your data store more effectively than ever before.

  • Take advantage of Groovy to create reporting services, implement batch processing, and create alternative client interfaces.

  • Deploy and upgrade your Grails–driven applications with expertise and ease.

  • Discover an alternative client in Groovy as well.

Who this book is for

Java and web developers looking to learn and embrace the power and flexibility offered by the Grails framework and Groovy scripting language.

Table of Contents

  1. Title Page
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. Foreword
  6. About the Authors
  7. About the Technical Reviewer
  8. Acknowledgments
  9. Introduction
    1. Who This Book Is For
    2. How This Book Is Structured
    3. Prerequisites
    4. Downloading the Code
    5. Contacting the Authors
  10. CHAPTER 1: Introduction to Groovy
    1. Groovy Language Features
    2. Groovy Installation
    3. Groovy by Example
    4. Summary
  11. CHAPTER 2: Groovy Basics
    1. Scripts
    2. Assertions
    3. Strings
    4. Methods and Closures
    5. Collections
    6. Regular Expressions
    7. Operators
    8. Summary
  12. CHAPTER 3: More Advanced Groovy
    1. Groovy Unit Testing
    2. Working with XML
    3. Generating Text with Templates
    4. Expandos
    5. Meta Object Protocol
    6. Domain-Specific Languages
    7. Summary
  13. CHAPTER 4: Introduction to Grails
    1. What Is Grails?
    2. Grails Architecture
    3. Installing Grails
    4. Collab-Todo Application
    5. Getting Started with Scaffolding
    6. Understanding the Scaffolding Process
    7. Summary
  14. CHAPTER 5: Building the User Interface
    1. Starting with the End in Mind
    2. Making the Topbar Functional
    3. Testing
    4. Externalizing Strings
    5. Errors and Validation
    6. Flash and Flash Messages
    7. Controlling the Application
    8. Creating an Audit Log Using Action Interceptors
    9. Using Filters
    10. Summary
  15. CHAPTER 6: Building Domains and Services
    1. GORM
    2. Collab-Todo's Domain
    3. Creating Domain Objects
    4. Validation
    5. Querying the Database
    6. Database Migration
    7. Services
    8. Summary
  16. CHAPTER 7: Security in Grails
    1. What Is Security?
    2. An Overview of Grails Security Solutions
    3. Custom Security Implementation
    4. JSecurity
    5. CAS
    6. Spring Security (aka Acegi Security)
    7. Summary
  17. CHAPTER 8: Web 2.0—Ajax and Friends
    1. Advanced Presentation Components
    2. Tag Libraries
    3. Ajax in Grails
    4. RSS Feeds
    5. Summary
  18. CHAPTER 9: Web Services
    1. RESTful Web Services
    2. RESTful in Grails
    3. Summary
  19. CHAPTER 10: Reporting
    1. The Report
    2. Overview of the Reporting Function
    3. Reporting Tools
    4. Creating the To-Do Report
    5. The Report Tag
    6. The ReportController and the ReportService
    7. Tying It All Together
    8. The Report List
    9. An Alternate Approach
    10. Summary
  20. CHAPTER 11: Batch Processing
    1. Installing the Quartz Plug-in
    2. Creating a Job
    3. Building a Batch-Reporting Facility
    4. Summary
  21. CHAPTER 12: Deploying and Upgrading
    1. Deploying Grails Applications
    2. Automating Tasks with Gant
    3. Upgrading Grails Applications
    4. Summary
  22. CHAPTER 13: Alternative Clients
    1. Overview
    2. Setup
    3. Command-Line Scripts
    4. Rich Groovy Client
    5. Summary
  23. Index