Table of Contents
Preface
Chapter 1: Getting Started with Grails
Chapter 2: Managing Users with Scaffolding
Chapter 3: Posting Messages
Chapter 4: Introduction to Groovy
Chapter 5: Authentication with JSecurity Plug-in
Chapter 6: Testing
Chapter 7: File Sharing
Chapter 8: More GORM and Criteria
Chapter 9: Services
Chapter 10: Managing Content through Tagging
Chapter 11: AJAX and RIA Frameworks
Chapter 12: Searching, RSS, and REST Services
Chapter 13: Build Your Own Plug-in
Chapter 14: Deployment and the Real World
Index
- Chapter 1: Getting Started with Grails
- Why Grails?
- Less configuration
- Faster setup
- Shorter develop/test cycle
- Consistent development environment
- Domain-specific language for web development
- Fewer dependencies
- Installing Grails
- Build a team communication portal
- Summary
- Why Grails?
- Chapter 2: Managing Users with Scaffolding
- What is scaffolding?
- Create the domain classes
- Create the User domain class
- Create the Role domain class
- Creating controllers to enable scaffolding
- Control through constraints
- Meeting the relations
- Relating roles and users
- Ordering fields through constraints
- Bootstrapping demo data
- Summary
- Chapter 3: Posting Messages
- Message domain class
- Rendering a form
- Message controller
- Groovy Server Pages
- Create message view
- Grails layouts
- Show the form
- Handling user input
- Binding the request to the domain
- Validate and save
- Flash scope
- Redirect
- Render validation errors
- Feedback to the user
- Create a home page
- HomeController
- List all messages
- Home page view
- HomeController
- Styles and navigation
- Set the default page
- Update the layout
- Tidying up
- HTML encoding
- Overriding validation error messages
- Summary
- Chapter 4: Introduction to Groovy
- What is Groovy?
- Object-Oriented
- Dynamic
- Functional
- Loosely typed and strongly typed
- Why Groovy?
- Familiar syntax
- Direct integration with Java
- Running Groovy
- Installing Groovy
- Groovy shell
- Groovy console
- Execute Groovy scripts
- Groovy classes and scripts
- Groovy Features
- Semicolons
- Strings
- Numbers
- Lists
- Maps
- Ranges
- Truth and equality
- Closures
- Plain old Groovy objects
- Metaprogramming
- Adding dynamic behavior
- The great pretender
- Builders
- Summary
- What is Groovy?
- Chapter 5: Authentication with JSecurity Plug-in
- Where to find plug-ins?
- Installing a plug-in
- Configuring JSecurity plug-in
- How does JSecurity work?
- More about realms
- Create a simple realm
- Implement authenticate
- Dynamic finders
- Implement hasRole
- Install the authentication controller
- The authentication filter
- Password encryption
- Add the missing pieces
- Encryption of users' passwords
- Permission denied page
- Sign out link
- Who posted that?
- Relate messages to users
- Making it happen
- Showing the user
- Hibernate lazy loading
- Eager load users
- Summary
- Chapter 6: Testing
- Writing unit tests
- Why we write unit tests
- Confidence in code
- Improve design
- Developer productivity
- Document code
- How to write unit tests
- Test discreet units of code
- Trust your libraries
- Test your production code
- Descriptive test names
- Test one thing at a time
- Why we write unit tests
- JUnit refresher
- SetUp and TearDown
- Asserting expectations
- Unit tests in Grails
- Groovy test extensions
- Create a grails test
- Running our tests
- Grails testing plug-in
- Testing Metacontroller
- Testing validation
- Limitations of Grails in unit tests
- Integration testing
- External dependencies
- Repeatable tests
- Integration tests in Grails
- BootStrap for environments
- Functional testing
- Environment setup
- Repeatable tests
- Test performance
- Fragility of tests
- Making tests understandable
- Functional testing In Grails
- Benefits of functional testing in Grails
- Installing the functional testing plug-in
- Testing guidance
- Summary
- Writing unit tests
- Chapter 7: File Sharing
- File domain object
- FileController
- File Upload GSP
- Saving the file
- Grails file upload
- The save action
- Validation messages
- Viewing files
- Modeling for efficiency
- Downloading files
- Summary
- Chapter 8: More GORM and Criteria
- Sort order of relationships
- Update validation messages
- Querying with criteria
- Comparing criteria and dynamic finders
- Using logical operators
- Querying across relationships
- Specifying a fetch mode for relationships
- Criteria reference
- Logical criteria
- Setting criteria properties
- Updating FileController
- Updating the create file view
- Handling save
- Render file versions
- Fix file download
- Summary
- Chapter 9: Services
- Introducing services
- Dependency injection
- Service scope
- Implementing FileService
- Summary
- Introducing services
- Chapter 10: Managing Content through Tagging
- Add basic tagging
- Tagging domain model
- The Tag class
- The Tagger class
- Tagging a message
- Tagging a file
- GORM inheritance
- Taggable superclass
- Polymorphic queries
- Exposing tagging to the users
- Add the Tags input field
- Add multiple tags to Taggable
- Saving the users tags
- Displaying tags
- Tagging domain model
- Customize the home page
- Introducing templates
- Passing data to a template
- Render a map
- Render an object
- Render a collection
- Template namespace
- Create the message and file templates
- User tags
- User to tag relationship
- User ProfileController
- The myTags form
- Personalizing the home page
- Content service
- Update the HomeController
- Update the home page
- All Messages and Files
- Summary
- Add basic tagging
- Chapter 11: AJAX and RIA Frameworks
- Edit tags inline
- The remoteLink tag
- The formRemote tag
- Taggable controller
- Tag views
- Tagging domain changes
- Include the Prototype library
- Try it out
- Auto-complete tags
- Installing the RichUI
- Implement the auto-complete
- Suggest tags action
- RichUI autoComplete widget
- Introducing tag clouds
- RichUI tag cloud component
- Fetch the tag cloud map
- Filter by tags
- Rendering the tag cloud
- Summary
- Edit tags inline
- Chapter 12: Searching, RSS, and REST Services
- Searching
- Make our objects searchable
- Integrate searching
- Site-wide search
- Create the search controller
- View the search results
- Update the templates
- More searching
- RSS
- A note about builders
- Create the RSS feed
- Remove authorization check
- REST services
- REST overview
- URL mapping
- Mapping to variables
- Mapping to HTTP response codes
- Mapping to HTTP methods
- REST service mappings
- Mapping to wildcards
- Applying constraints
- Our Message API mapping
- Implementing the RESTful controller
- Retrieving messages
- Creating new messages
- Authentication for REST API
- A test script
- Summary
- Searching
- Chapter 13: Build Your Own Plug-in
- The tagger plug-in
- Extract the tagging code
- Accessing plug-in templates through Tag Libraries
- Calling tags from controllers
- Current limitations
- Packaging a plug-in
- Using plug-in events
- Grails plug-in lifecycle events
- doWithSpring
- doWithWebDescriptor
- doWithApplicationContext
- doWithDynamicMethods
- onChange and onConfigChange
- Inspecting Grails artifacts
- The GrailsApplication class
- Find Taggable domain classes
- Re-modeling tag relationships
- Adding Taggable behavior
- Groovy MetaClass
- Getting the home page working
- Items of Interest
- Create messages and files
- Update tags
- List messages and files
- RSS
- Grails plug-in lifecycle events
- Summary
- The tagger plug-in
- Chapter 14: Deployment and the Real World
- Set up the environment
- Install MySQL
- Install Tomcat
- Configure Grails
- Set up the DataSource
- DataSource configuration
- Environmentally aware
- Database management
- Update your DB configuration
- Control the bootstrap
- Package the WAR file
- Deploy
- Set up the DataSource
- Hosting options
- Next steps
- Java Hibernate classes with GORM
- Integrating with other presentation frameworks
- Data migration
- Summary
- Set up the environment



