Contents

About the Authors

About the Technical Reviewer

Acknowledgments

images Chapter 1: Introduction to Groovy

Installation

Groovy by Example

Converting Java to Groovy

Converting a JavaBean to a GroovyBean

Simplifying the Code

Using Groovy Collection Notation and Closure

Getting Rid of main()

Groovy Language Key Features

Assertion

Annotations for AST Transformation

Builder

Closure

GDK

Metaprogramming

Native Support for Lists and Maps

Native Support for Regular Expression

Object Orientation: Everything is an Object in Groovy

String interpolation

Static and Dynamic Typing

Static Type Checking

Static Compilation

Optional Syntax

Summary

images Chapter 2: Groovy Basics

Scripts

Using Script Functions

Compiling Groovy

Running Groovy

Assertions

Power Asserts

Strings

GStrings

Single Line Strings

Multiline Strings

Slashy Strings

Multiline Slashy Strings

Dollar Slashy Strings

Regular Expressions

Groovy Regular Expression Operators

Common Uses of Regular Expressions

Collective Datatypes

Arrays

Lists

Maps

Ranges

Sets

Control Structure

Groovy Truth

Logical Branching

Looping

Exception Handling

Methods

Closures

Implicit Variables

Explicit Declaration of Closure

Reusing the Method as a Closure

Closures and Collection

Closures as Map Keys and Values

Currying Closure

Closure Trampoline

Closure Memoization

Operators

Operator Overloading

Specialized Operators

Summary

images Chapter 3: More Advanced Groovy

Object Orientation in Groovy

Classes and Scripts

Groovy Constructors

Inheritance

Polymorphism

Groovy Unit Testing

Working with XML

Writing XML with Java

Groovy Builders

Writing XML with Groovy MarkupBuilder

Reading XML with XmlSlurper

Native JSON support

Reading JSON

JsonBuilder

Prettyprinting JSON Content

Generating Text with Templates

Runtime Metaprogramming

Metaobject Protocol

Metaclass

Using invokeMethod() and get/setProperty()

Using methodMissing()

Expandos

ExpandoMetaClass

Categories

Runtime Mixins

Compile-time Metaprogramming

AST Transformations

Built-in AST Transformations

Domain-Specific Languages

Summary

images Chapter 4: Introduction to Grails

What Is Grails?

Grails Features

Integrated Open Source

Grails Architecture

Installing Grails

Collab-Todo Application

Creating Collab-Todo application

Running the Application

Creating the Controller

Testing the Controller

Scaffolding

Creating a Domain Class

Dynamic Scaffolding

Static Scaffolding

Creating Domain Relationships

H2 Console

Grails Plugins

Grails Interactive Mode

Summary

images Chapter 5: Building the User Interface

Starting with the End in Mind

Creating the Footer

Creating the Topbar

Adding More Look and Feel

Grails Tags

Static Resources

Making the Topbar Functional

The Login View

The login Action

Handling the Login and Logout Actions

Externalizing Strings

Errors and Validation

Flash and Flash Messages

Creating an Audit Log Using Action Interceptors

Using Filters

Summary

images Chapter 6: Building Domains and Services

GORM

Collab-Todo’s Domain

Creating Domain Objects

Basic Domain Creation

Creating Relationships

Overwriting Default Settings

Adjusting the Mappings

Validation

Constraints

Calling the Validator

Validation Messages

Querying the Database

GORM’s CRUD Support

Creating Queries

Services

Creating a Service

Calling the Service

Injecting into the Service

Initializing the Service

Setting a Bean to Be Transactional

Service Context Available in the Service

Summary

images Chapter 7: Security in Grails

What Is Security?

Authentication

Access Control

An Overview of Grails Security Solutions

Custom Security Implementation

Registering a User

Logging In and Out

Securing the Controllers

CAS

CAS Installation

CAS Configuration

CAS Usage

Spring Security

Security Domain Classes

Securing URLs

SecurityTagLib

Summary

images Chapter 8: Web 2.0—Ajax and Friends

Advanced Presentation Components

Adding RichText Capabilities

Adding Search Capabilities

Allowing File Uploads

Tag Libraries

Creating the Tag Library

Referencing the Tag Library

Ajax in Grails

Using Ajax Frameworks in Grails

Dynamic Rendering of Data

RSS Feeds

Summary

images Chapter 9: Web Services

RESTful Web Services

RESTful in Grails

URL Mappings

Content Negotiation

RestController

Summary

images Chapter 10: Reporting

The Report

Reporting Tools

Overview

Installing JasperReports and iReports

Creating the Todo Report

Defining the Data Source

Using iReports

Enhancing the Report

Compiling the Report

The Report Tag

Tag Library Overview

Creating the Tag

The ReportController and the ReportService

Tying It All Together

Gathering the Report Data

Adding the Report Tag to the Application

The Report List

An Alternate Approach

Summary

images Chapter 11: Batch Processing

Installing the Quartz Plugin

Creating a Job

Building a Batch-Reporting Facility

Creating a Nightly Reporting Job

Retrieving the User’s Todos

Invoking the Report Service

Invoking the E-Mail Service

Summary

images Chapter 12: Deploying and Upgrading Grails Applications

Deploying Grails Applications

Using Environments

Understanding Grails Configurations

Packaging the Application for Deployment

Deploying to an Application Server

Upgrading Grails Applications

Configuration Changes

Command Line Changes

H2

jQuery

Controller Public Methods

Unit Test Framework

Summary

images Chapter 13: Introduction to Griffon

Installing Griffon

Creating Your First Application

Directory Structure

Griffon Application Life Cycle

Initialization

Startup

Ready

Shutdown

Stop

Views

Builder Overview

Griffon View

Special Nodes

Models and Bindings

Controllers

Injected Properties

Injected Methods

Initialization and Destruction Hook

Actions

Summary

Index

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset