List of Figures

Chapter 1. Grails in a hurry...

Figure 1.1. The Grails ecosystem is a powerful confluence of people, ideas, and technology.

Figure 1.2. The Grails installation process

Figure 1.3. Our first app is up and running.

Figure 1.4. Adding our first bit of functionality

Figure 1.5. Our first view in action

Figure 1.6. SiteMesh decorates a raw GSP file with a standard set of titles and sidebars.

Figure 1.7. QOTD with some funky CSS skinning

Figure 1.8. The Grails console lets your run commands from a GUI.

Figure 1.9. Our random quote feature in action

Figure 1.10. The list() scaffold in action

Figure 1.11. Adding a quote has never been easier.

Figure 1.12. When constraints are violated, error messages appear in red.

Figure 1.13. HTML reports from the integration test run

Figure 1.14. Our Ajax view in action

Chapter 2. The Groovy essentials

Figure 2.1. An example session with the Grails shell, started with the shell command

Figure 2.2. The Grails console in action

Chapter 3. Modeling the domain

Figure 3.1. The Hubbub we’re heading towards

Figure 3.2. The basic Hubbub data model demonstrates all the basic relationship types.

Figure 3.3. Early screen designs for the Hubbub UI

Figure 3.4. The newly created Hubbub application

Figure 3.5. Each User object has an optional Profile object.

Figure 3.6. Each User can have zero to many Post objects.

Figure 3.7. A tricky many-to-many scenario between Users, Posts, and Tags

Figure 3.8. Modeling the “follows” relationship

Figure 3.9. The final Hubbub data model after all of our changes

Chapter 4. Putting the model to work

Figure 4.1. Scaffolding also includes relationships and validations.

Figure 4.2. Validation errors are handled for scaffolds, and so are file uploads and textareas for large fields.

Figure 4.3. You can create your own error messages in resource bundle files.

Figure 4.4. The User scaffold lets you select and attach a Profile.

Figure 4.5. You can change the skin for scaffolds to use your own layouts.

Figure 4.6. The generated template files you can install and modify for scaffolds

Figure 4.7. A basic Hubbub search form in action

Figure 4.8. The Search Results screen displays several chucks.

Figure 4.9. A more advanced search screen with Boolean operators

Figure 4.10. An advanced search screen with ANDing and ORing

Figure 4.11. A basic results screen shows two profiles matching our criteria

Chapter 5. Controlling application flow

Figure 5.1. From URL to controller to view

Figure 5.2. Our first timeline in action

Figure 5.3. Adding posting capabilities to Hubbub

Figure 5.4. Binding a params map to a Post object

Figure 5.5. Adding a blank post generates an error.

Figure 5.6. Request scope is the shortest lived, and servletContext the longest.

Figure 5.7. Parameters are split into bound objects based on their prefix.

Figure 5.8. You can bind multiple domain objects on a single form and include error handling.

Figure 5.9. Field-level markup of errors is difficult but achievable in Grails 1.1.

Figure 5.10. Our image-upload form in action

Figure 5.11. Rendering a profile picture

Chapter 6. Developing tasty views, forms, and layouts

Figure 6.1. A registration form that uses the core form tags

Figure 6.2. The <g:paginate> tag in action

Figure 6.3. SiteMesh in operation merging pages

Figure 6.4. A mockup of our Hubbub UI

Figure 6.5. The YUI Grids Builder makes cross-browser CSS layouts easy.

Figure 6.6. The nighttime theme in action

Figure 6.7. Our planned navigation menu

Figure 6.8. The Navigation plugin painlessly handles all your menu needs.

Figure 6.9. Our Ajax spinner in action

Figure 6.10. Our TinyURL feature in action

Chapter 7. Building reliable applications

Figure 7.1. The Grails test class hierarchy. All of Grails’ test cases are ultimately derived from JUnit’s TestCase.

Figure 7.2. Setting an expectation on the object returned by mockFor()

Figure 7.3. The structure of a unit test that uses Grails’ mocking support, with examples of each step

Chapter 8. Using plugins: adding Web 2.0 in 60 minutes

Figure 8.1. The plugin architecture

Figure 8.2. Grails plugin installation logic

Figure 8.3. Example plugin dependencies for a project

Figure 8.4. Our 3-D pie chart in action

Figure 8.5. Our Google bar chart in action

Figure 8.6. A multiseries line chart

Figure 8.7. A new message arriving with suitable markup

Figure 8.8. The default Searchable interface is pretty usable from the get-go.

Figure 8.9. Our first custom search form in action

Figure 8.10. Hit-term highlighting in action

Figure 8.11. Implementing pagination on our search

Figure 8.12. The Searchable suggest-query feature in action

Figure 8.13. Applying a tooltip to our followers section

Figure 8.14. Using a rich-text editor to enter bio data

Figure 8.15. Using a calendar picker for date selection

Figure 8.16. Our autocompleting tags in action

Chapter 9. Wizards and workflow with webflows

Figure 9.1. Our basic workflow as a flowchart

Figure 9.2. Our form displays errors and repopulates failing fields.

Figure 9.3. Flows support custom error messages created with message bundles.

Figure 9.4. Adding a new custom shipping subflow after the address step

Chapter 10. Don’t let strangers in—security

Figure 10.1. An HQL query run first with a perfectly safe input value (on the left) and a second time with an example SQL injection attack (on the right). In the latter case, all posts in the database are returned by the query.

Figure 10.2. Trying to access Hubbub via HTTPS with Firefox 3. The browser doesn’t like the self-signed certificate, but you can accept it by adding it as an exception (see the link at the bottom of the screen).

Figure 10.3. Hitting an unknown page displays information about the platform by default. Try to avoid gifting attackers such useful information.

Figure 10.4. How the typical Grails security plugin fits into the request/response cycle. The “?” highlights where the request may or may not be forwarded to the application at the plugin’s discretion.

Figure 10.5. The relationship between the core access-control domain classes. The model is simple.

Figure 10.6. The Spring Security plugin’s standard login page, with the “Remember me” check box

Figure 10.7. A simple access-control logic flow that we want to functionally test. The expected behavior depends on the URL of a request and whether the user is logged in or not.

Chapter 11. Remote access

Figure 11.1. The key concepts of REST. The Hubbub post (a domain instance) is our resource, and the XML returned to the client is a representation of that resource.

Figure 11.2. Sending a test POST request to Hubbub using the Poster plugin for Firefox. The request should create a new post for the specified user, and the ID of the new post should be returned in the response.

Figure 11.3. The process of content negotiation in action. The client lets the server know what types of content it would like to receive, and the server returns the content as one of those formats.

Figure 11.4. How a client interacts with a web service using the request-response model. Beneath that is the basic structure of a SOAP request—note the similarity to HTTP.

Chapter 12. Understanding messaging and scheduling

Figure 12.1. A PDF request flows through a message queue to a target process.

Figure 12.2. Message queues operate from point to point, with each message going to a single process.

Figure 12.3. Topics broadcast all messages to all clients.

Figure 12.4. The ActiveMQ console is available via a browser interface.

Figure 12.5. Our Jabber gateway architecture

Figure 12.6. Browsing the Jabber queue using ActiveMQ’s web interface

Figure 12.7. Inspecting a message on the queue

Figure 12.8. The basic components of a cron expression

Figure 12.9. Pausing a job via our new admin UI

Chapter 13. Advanced GORM kung fu

Figure 13.1. The P6Spy profiler in action

Figure 13.2. The sample legacy database

Figure 13.3. The Branch browser combo box launches an Ajax submit.

Figure 13.4. Our basic manager details are in place.

Figure 13.5. Navigating all relationships from the UI

Figure 13.6. Our new domain structure

Chapter 14. Spring and transactions

Figure 14.1. Inversion of Control compared to the traditional approach of dependency management: all objects are created by the IoC container rather than by the object themselves.

Figure 14.2. Typical application architecture using services to encapsulate business logic

Figure 14.3. The Hibernate session is an in-memory cache that stores data changes locally and then persists them to the database when it’s flushed.

Chapter 15. Beyond compile, test, and run

Figure 15.1. The typical development cycle for Grails applications. The code, test, and package steps are implemented by the Grails build system; the others must be implemented manually or by a plugin.

Figure 15.2. Targets in Grails automatically fire start and end events, and the event() method allows you to fire them manually.

Figure 15.3. The Tomcat Manager application

Figure 15.4. Where Hibernate’s schema export fits into application startup and shutdown. The strings on the right highlight which dbCreate settings are active for each phase.

Figure 15.5. The effect of renaming the account table’s user_id column to username without affecting the data

Chapter 16. Plugin development

Figure 16.1. The directory structure of a plugin project. Note how it’s almost identical to the structure of a Grails application. The plugin descriptor is highlighted.

Figure 16.2. The artifacts provided by the security plugin

Figure 16.3. A Grails application referencing an in-place plugin (security-plugin) with two other plugins installed normally. The security-plugin directory contains the plugin source code.

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

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