Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Events
Videos
Audiobooks
Packt Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Grails 1.1 Web Application Development
Grails 1.1 Web Application Development

Grails 1.1 Web Application Development: Reclaiming Productivity for faster Java Web Development

Arrow left icon
Profile Icon Jon Dickinson
Arrow right icon
$45.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback May 2009 328 pages 1st Edition
eBook
$24.29 $26.99
Paperback
$45.99
Arrow left icon
Profile Icon Jon Dickinson
Arrow right icon
$45.99
Full star icon Full star icon Full star icon Full star icon Full star icon 5 (1 Ratings)
Paperback May 2009 328 pages 1st Edition
eBook
$24.29 $26.99
Paperback
$45.99
eBook
$24.29 $26.99
Paperback
$45.99

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

Grails 1.1 Web Application Development

Chapter 1. Getting Started with Grails

Grails is a dynamic web development framework on the Java platform for rapid application development. It has taken the coding by convention approach popularized by Ruby on Rails, and applied it as a wrapper over long established open source Java frameworks such as Hibernate and Spring. It uses the flexibility of Groovy to provide a Domain-Specific Language (DSL) for web development.

The goal is to be able to develop web applications with the minimum amount of effort without having to repeat yourself. Grails provides a consistent and reliable environment between all of your projects.

Why Grails?

Web development is a tricky business. Even a simple web application has a number of context changes ready to trip up the unwary developer. HTTP requests must be parsed and converted into internal code representations. Once parsed, the data must be validated to make sure no invalid or dangerous information has been sent. The data extracted from these requests is then persisted to rows in database tables. To send a response back to the user, data must be retrieved from the database and converted into the domain model. It is then rendered from the domain model into HTML format and sent back over HTTP. With every user action going through all these different conversions, we can see how web development can become expensive, and this is just the server side. We haven't even considered all the client-side coding that goes into web applications with the rich user experiences that are becoming the norm in the Web 2.0 era.

Over the years, there have been a number of frameworks created to alleviate the cost of building web applications. Web frameworks such as Struts, Spring MVC, Stripes, and JSF help in mapping the HTTP requests to code logic. Object to relational database mapping frameworks allow domain objects to be persisted directly to the database, Hibernate being the most notable. These frameworks have allowed larger and more complicated web applications to be implemented by reducing the workload of the application developer. Unfortunately, a side effect of multiple frameworks is an increased level of configuration that needs to be produced and maintained. The level of knowledge required to create framework configuration files is probably less than writing the code. However, it is notoriously difficult to debug and test the configuration.

Grails helps application developers provide value faster by:

  • Requiring less configuration

  • Faster setup

  • Shorter develop/test cycle

  • Consistent development environment

  • Domain-specific language for web development

  • Fewer dependencies

Less configuration

The first benefit Grails provides is a convention-based approach to remove the need for reams of configuration, while still leveraging the power of the mature underlying frameworks. In practice, this means that you don't spend a lot of time wiring your code together in XML configuration files, or muddy your code with endless annotations. Instead, if a class is created, according to the convention in the correct location, it will be wired into Spring as needed or will be treated as a Hibernate entity ready to be persisted in the database.

Faster setup

The convention based approach applies to your development environment as well as the code. As soon as you create a Grails project, you have a defined structure and a set of scripts already available to compile, test, run and package your project. Having all these scripts managed in a consistent and conventional manner greatly reduces the time required to get a project up and running.

Grails also comes configured with a bundled database and application server. So once you have Grails installed, and your project created, there is nothing else you need before you start development.

No longer do you need to spend time setting up a development environment for each project. Tweaking your Ant build scripts slightly for each new environment is a thing of the past, and so is configuring an application and database server for development.

Shorter develop/test cycle

Grails uses a bundled Jetty (http://www.mortbay.org/jetty/) installation for the application server, which is configured to execute against the working code base of your application. Grails is also built on top of Groovy — a dynamic language for the JVM that adds powerful new features to Java. Groovy compiles down to the Java bytecode, which allows it to integrate with any existing Java code. Chapter 4 introduces you to the Groovy language, if you have not used it before.

In development mode, Grails provides an auto-reloading feature (http://www.grails.org/Auto+Reloading), which allows you to make changes to your code and see the changes in your browser with the next refresh. There is no need to restart the application, or to re-deploy to an application server.

Consistent development environment

It is best practice in software development to try and ensure that all developers in a project are working in the same way and have a common environment on each machine. In reality, there are often conflicts between the configurations of different team member's development environments; team members may configure their application servers differently or use different database versions. You can waste valuable time debugging false problems in your software just because another team member has a configuration slightly different from yours.

Grails comes with a pre-defined application structure. This ensures that all developers will be working in the same way with the same environment configuration.

Domain-specific language for web development

Any experienced Java web developer will be familiar with the Servlet Specification, which provides a standard set of interfaces for working with HTTP. Grails builds on this specification and provides a DSL for developing web applications. The underlying specification is still available to developers, if they wish to use it, but in- depth knowledge is no longer required. By leveraging the flexibility of the Groovy language, Grails provides an intuitive and simple domain language specific to the web development, upon which you can build great web applications.

Fewer dependencies

The cost of getting up and running with Grails is remarkably low. You will need to download and install the following:

  • Java 1.5 or greater

  • Grails 1.1 or greater

Note that there is no need to download Groovy; it comes bundled with the Grails download.

Compare this to getting set up on a normal Java web project, where the typical download and install list would look something like this:

  • Java

  • DB server (for example, MySQL, HSQL DB)

  • Application server (for example, Tomcat)

  • Hibernate

  • Spring

  • Web framework (for example, Struts, Spring MVC)

  • View rendering framework (for example, Velocity, Freemarker)

  • Logging framework (for example, commons logging and Log4J)

You will eventually need to download and install an application server and a database server. Fortunately, this work can be put off until later down the line when you are thinking about deployment.

Chapter 1. Getting Started with Grails

Grails is a dynamic web development framework on the Java platform for rapid application development. It has taken the coding by convention approach popularized by Ruby on Rails, and applied it as a wrapper over long established open source Java frameworks such as Hibernate and Spring. It uses the flexibility of Groovy to provide a Domain-Specific Language (DSL) for web development.

The goal is to be able to develop web applications with the minimum amount of effort without having to repeat yourself. Grails provides a consistent and reliable environment between all of your projects.

Why Grails?

Web development is a tricky business. Even a simple web application has a number of context changes ready to trip up the unwary developer. HTTP requests must be parsed and converted into internal code representations. Once parsed, the data must be validated to make sure no invalid or dangerous information has been sent. The data extracted from these requests is then persisted to rows in database tables. To send a response back to the user, data must be retrieved from the database and converted into the domain model. It is then rendered from the domain model into HTML format and sent back over HTTP. With every user action going through all these different conversions, we can see how web development can become expensive, and this is just the server side. We haven't even considered all the client-side coding that goes into web applications with the rich user experiences that are becoming the norm in the Web 2.0 era.

Over the years, there have been a number of frameworks created to alleviate the cost of building web applications. Web frameworks such as Struts, Spring MVC, Stripes, and JSF help in mapping the HTTP requests to code logic. Object to relational database mapping frameworks allow domain objects to be persisted directly to the database, Hibernate being the most notable. These frameworks have allowed larger and more complicated web applications to be implemented by reducing the workload of the application developer. Unfortunately, a side effect of multiple frameworks is an increased level of configuration that needs to be produced and maintained. The level of knowledge required to create framework configuration files is probably less than writing the code. However, it is notoriously difficult to debug and test the configuration.

Grails helps application developers provide value faster by:

  • Requiring less configuration
  • Faster setup
  • Shorter develop/test cycle
  • Consistent development environment
  • Domain-specific language for web development
  • Fewer dependencies

Less configuration

The first benefit Grails provides is a convention-based approach to remove the need for reams of configuration, while still leveraging the power of the mature underlying frameworks. In practice, this means that you don't spend a lot of time wiring your code together in XML configuration files, or muddy your code with endless annotations. Instead, if a class is created, according to the convention in the correct location, it will be wired into Spring as needed or will be treated as a Hibernate entity ready to be persisted in the database.

Faster setup

The convention based approach applies to your development environment as well as the code. As soon as you create a Grails project, you have a defined structure and a set of scripts already available to compile, test, run and package your project. Having all these scripts managed in a consistent and conventional manner greatly reduces the time required to get a project up and running.

Grails also comes configured with a bundled database and application server. So once you have Grails installed, and your project created, there is nothing else you need before you start development.

No longer do you need to spend time setting up a development environment for each project. Tweaking your Ant build scripts slightly for each new environment is a thing of the past, and so is configuring an application and database server for development.

Shorter develop/test cycle

Grails uses a bundled Jetty (http://www.mortbay.org/jetty/) installation for the application server, which is configured to execute against the working code base of your application. Grails is also built on top of Groovy — a dynamic language for the JVM that adds powerful new features to Java. Groovy compiles down to the Java bytecode, which allows it to integrate with any existing Java code. Chapter 4 introduces you to the Groovy language, if you have not used it before.

In development mode, Grails provides an auto-reloading feature (http://www.grails.org/Auto+Reloading), which allows you to make changes to your code and see the changes in your browser with the next refresh. There is no need to restart the application, or to re-deploy to an application server.

Consistent development environment

It is best practice in software development to try and ensure that all developers in a project are working in the same way and have a common environment on each machine. In reality, there are often conflicts between the configurations of different team member's development environments; team members may configure their application servers differently or use different database versions. You can waste valuable time debugging false problems in your software just because another team member has a configuration slightly different from yours.

Grails comes with a pre-defined application structure. This ensures that all developers will be working in the same way with the same environment configuration.

Domain-specific language for web development

Any experienced Java web developer will be familiar with the Servlet Specification, which provides a standard set of interfaces for working with HTTP. Grails builds on this specification and provides a DSL for developing web applications. The underlying specification is still available to developers, if they wish to use it, but in- depth knowledge is no longer required. By leveraging the flexibility of the Groovy language, Grails provides an intuitive and simple domain language specific to the web development, upon which you can build great web applications.

Fewer dependencies

The cost of getting up and running with Grails is remarkably low. You will need to download and install the following:

  • Java 1.5 or greater
  • Grails 1.1 or greater

Note that there is no need to download Groovy; it comes bundled with the Grails download.

Compare this to getting set up on a normal Java web project, where the typical download and install list would look something like this:

  • Java
  • DB server (for example, MySQL, HSQL DB)
  • Application server (for example, Tomcat)
  • Hibernate
  • Spring
  • Web framework (for example, Struts, Spring MVC)
  • View rendering framework (for example, Velocity, Freemarker)
  • Logging framework (for example, commons logging and Log4J)

You will eventually need to download and install an application server and a database server. Fortunately, this work can be put off until later down the line when you are thinking about deployment.

Installing Grails

Now that you have had the salesman's pitch for Grails, it's time to see if it can live up to the hype. So, let's get started.

Download Grails from http://www.grails.org and extract the downloaded files to your development folder. Create an environment variable called GRAILS_HOME and point it to the extract location.

Installing Grails

You will then need to add the %GRAILS_HOME%/bin to your path. It's that easy!

Installing Grails

While working on a Mac, you can modify the environment.plist file in the .MacOSX directory as shown in the following screenshot:

Installing Grails

Although Grails is built on top of Groovy, there is no need to install Groovy separately. Grails comes with the groovy-all-x.x.x.jar bundled and executes your Groovy code directly.

The first step is to create a new Grails application with the Grails script, ' create-app'. You will create a new application called 'teamwork'. Open up your command line, go to your development area and run:

>grails create-app teamwork

You should see something like the following output:

Welcome to Grails 1.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /tools/grails-1.1
...
Created Grails Application at <your_development_location>/teamwork

This will create a folder called teamwork and will set up your application structure within this folder. Verify that the application has been configured correctly. Go to the teamwork directory and check that you have a folder structure as shown in the following screenshot:

Installing Grails

The grails-app folder will contain the main source code for your application. By examining the layout of this folder, you can see the beginnings of the convention for the layout of your application. The Model View Controller (MVC) (http://java.sun.com/blueprints/patterns/MVC-detailed.html) pattern is enforced through this convention.

Here is the breakdown of the layout:

  • The domain directory contains the Model classes.
  • The views directory contains the view code.
  • The controller directory contains the controller files.
  • The conf directory contains any configuration code that we need to implement.
  • The i18n directory contains message bundles to support internationalization.
  • Helper services will reside in the classes that go into the services directory.
  • Tag libraries, which are refreshingly trivial to be implemented in Grails, reside in the taglib directory.

Once you have confirmed that the structure of your project directory is correct, go into the teamwork directory in your command line and run:

>grails run-app

Wait for the message, Server running. Browse to http://localhost:8080/teamwork, to appear in your command line. Then you can open a browser, and you will see the default Grails start page as shown in the following screenshot:

Installing Grails

This is an equivalent of your "Hello World" example, when using any other framework. The result is a Java application server running on port 8080 with your application deployed to the context teamwork. This is not bad going for a five-minute job.

Grails comes with Jetty and HSQLDB already configured, which is why we have been able to get an application up and running so quickly. Jetty is a Java application server that can be ran as an embedded component within any Java application. HSQLDB is a lightweight Java SQL database engine that can be run in-memory with minimal configuration.

Grails applications are packaged as a WAR file for deployment, and so, are not limited to running under Jetty. But developing in this environment provides several benefits including:

  • Fast deployment time
  • Pre-configured setup
  • Automatic reloading of code changes during development

Build a team communication portal

Now that we have installed Grails and the default page is up and running, it is time to start creating our application. The aim of this book is to build a communication portal for teams. The application will allow team members to share messages and files with the rest of the team. You will need to implement the following:

  • Manage the users of the application
  • Control access
  • Allow users to send messages
  • Allow team members to share files
  • Improve organization of data through tagging
  • Add an XML API via a REST (Representational State Transfer) web service
  • Allow messages and files to be searched
  • Add RSS feeds

Once you have finished implementing the application, you will see how to deploy the application into a production environment using Tomcat and MySQL.

Finally, you will finish up with some additional areas to consider and investigate further, which have not been discussed in this book.

Left arrow icon Right arrow icon

Key benefits

  • Ideal for Java developers new to Groovy and Grailsóthis book will teach you all you need to create web applications with Grails
  • Create, develop, test, and deploy a web application in Grails
  • Take a step further into Web 2.0 using AJAX and the RichUI plug-in in Grails
  • Packed with examples and clear instructions to lead you through the development and deployment of a Grails web application

Description

Web development is trickyóeven a simple web application has a number of context changes ready to trip up the unwary. Grails takes the everyday pain out of web application development, allowing us to focus on delivering real application logic and create seamless experiences that will address the needs of our users. This book will take the pain out of Grails by showing you exactly how to build a web application with a minimum of fuss. With this book, even if you are new to Grails, you will be up and running before you know it. You will be able to code faster and your code will be better. This clear and concise book is packed with examples and clear instructions to help you build your first Grails application and gives you the skills to speed up your application development by adding a different angle for learning about the topic. After a brief introduction to the dynamic JVM-based Groovy programming language, which teaches you enough about Groovy to understand the relationship between Grails and the Groovy scripting language, it shows how to use Grails and a number of key plug-ins to deliver valuable web applications. It also takes you through creating, developing, testing, and deploying an example team collaboration application in Grails. Using an incremental and iterative approach you will learn how to build a basic web application with secure authentication and different levels of authorization. You will learn how to handle file upload allowing users to share files. Some advanced features of object-oriented persistence will be introduced through adding tags for messages and files to giving users a robust categorization system. You will then build on the basic application to enhance the user experience through AJAX and the RichUI plug-in. You will take a further step into the world of Web 2.0 by adding an RSS feed and a REST service to the application. Once the entire application is up and running, you will learn how to create your own plug-in for tagging. Finally, you will learn how to deploy this application to a production environment.

Who is this book for?

This book is aimed at Java web developers looking for ways to build web applications quickly, and wanting to find out how it's done quickly. If you are frustrated with integrating the many different frameworks that are available for web development and want to get on with building slick web applications for your users, then this book is for you. Grails is built on the Groovy language, but experience in Groovy is not required, as you will learn enough about Groovy to understand how to use Grails.

What you will learn

  • Understand the relationship between Grails and the Groovy scripting language
  • Learn enough about Groovy to get you writing your first Grails applications
  • Use the built-in AJAX support to enhance user interaction and create slick user interfaces with the RichUI plug-in
  • Develop and use a REST service interface and provide an API through REST
  • Handle file upload and versioning allowing users to share files
  • Use Grails scaffolding to generate a user interface to allow management of users and roles within the application.
  • Secure your application with the JSecurity plug-in and use plug-ins to solve common problems
  • Reduce object persistence issues using Grails Object-Relational Mapper
  • Create your own Grails plug-in for tagging to limit the amount of data that is displayed on your home page
  • Get to grips with automated testing to write functional tests that drive the application
  • Expose your application to other developers with a RESTful API
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 27, 2009
Length: 328 pages
Edition : 1st
Language : English
ISBN-13 : 9781847196682
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : May 27, 2009
Length: 328 pages
Edition : 1st
Language : English
ISBN-13 : 9781847196682
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 185.97
Solutions Architect's Handbook
$93.99
Mastering Ansible, 4th Edition
$45.99
Grails 1.1 Web Application Development
$45.99
Total $ 185.97 Stars icon

Table of Contents

14 Chapters
Getting Started with Grails Chevron down icon Chevron up icon
Managing Users with Scaffolding Chevron down icon Chevron up icon
Posting Messages Chevron down icon Chevron up icon
Introduction to Groovy Chevron down icon Chevron up icon
Authentication with JSecurity Plug-in Chevron down icon Chevron up icon
Testing Chevron down icon Chevron up icon
File Sharing Chevron down icon Chevron up icon
More GORM and Criteria Chevron down icon Chevron up icon
Services Chevron down icon Chevron up icon
Managing Content through Tagging Chevron down icon Chevron up icon
AJAX and RIA Frameworks Chevron down icon Chevron up icon
Searching, RSS, and REST Services Chevron down icon Chevron up icon
Build your own Plug-in Chevron down icon Chevron up icon
Deployment and the Real World Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Full star icon Full star icon 5
(1 Ratings)
5 star 100%
4 star 0%
3 star 0%
2 star 0%
1 star 0%
Jacek Laskowski Sep 09, 2009
Full star icon Full star icon Full star icon Full star icon Full star icon 5
When I first received the book I was pretty sceptical if I could learn anything from another book about Grails right after having read 3 before. What made me think it was worth giving it a try was that the author is a British and that the reviewers are a Java champion and PhD. Hence, even though I could probably not have learned a lot about Grails or Groovy themselves, I would at the very least have learnt a bit of English. It didn't take me long to find out how much I was mistaken. The book was different than the others I read as its main concern was to combine designing and developing an web application being a team communication portal with Grails/Groovy lessons. From the very beginning to its end it's clear that the idea to convey was not how to write another book about Grails with its foundation based on proven solutions like Groovy, Hibernate and Spring Framework covered, but for its simplicity to build a modern web application. Every chapter was about some part of the web application and how it was to implement it in Grails. I'd say it was about how to make your projects more agile and goal-oriented (which was to build a fully functional application) rather than to show how sexy your project could be right after introducing Grails. Every chapter started with some intro to the issues Grails developers would face when our web apps were of more use and their solutions. The author called us "the pragmatic user-centered people".The book begun with presenting available projects and acronyms overwhelming Java newcomers (which certainly is the reason why so many say Java is tough). There's a place for Ruby on Rails, Hibernate, Spring Framework, Groovy and DSL. It's clear that we're approaching a moment in Java ecosystem lifecycle where having so many means one can still not find the one. At some point, the author mentioned about Stripes, but not Wicket or JBoss Seam, which I thought were better recognized as web application frameworks. It turned out that it was just at the final chapter where Wicket and Google Web Toolkit found their place in the book, but JBoss Seam didn't.In the 2nd chapter I found a very interesting explanation about no package classes in Java and although I had known it's not a good practice to create ones I didn't know what the real issue was. Even after having read the Grails books earlier I didn't know that the names of the Groovy class properties were important and the scaffolding uses them to construct human-readable names for the views. It's clear now, but it had not been until I found it explained in this book. That's these gems which made the book worth its time. How many of us know that the scaffolding uses only 6 columns to build views? I didn't. The chapter 2 finished as early as it had started. It was quick and easy, perhaps too fast for Grails novices, but enough to let them create their first Grails webapp.In the 3rd chapter I was pleasantly surprised when I had made a comment to myself about manual handling the lastUpdated and dateCreated properties after which came the author's comment that Grails takes care of it and we don't have to. Nice surprises come at a cost (of heart attacks or coffee on your keyboard). It was the time when one could read much about controllers, actions, views, taglibs, templates and models. With the explanation of the parameters of the dynamically-added save() method and the issue addressed by the redirect-after-save solution I knew I was learning Grails more and more. A couple of words about the XSS attack and how Grails takes care of it summed up the chapter.The Grails operator overloading made an entrance to the 4th chapter. Java pros who are looking for leveraging Grails in their projects will certainly appreciate it. While the other books covered a lot about this topic, this one laid out just enough to add some new features to the web application. What I was pleasantly surprised by were the two methods - redirect() and render() which I had known existed in the Grails controllers, but had never understood they're added dynamically exactly as the methods of Grails domain classes. I didn't know that defining Groovy variables with the def keyword creates GroovyObject instances either. I had thought it's merely an Object instance. The other interesting points were about scripts in packages and asserts in Groovy turned on by default and out of the sudden (as it was not enough about Groovy) the author presented Groovy in more details. The so-called "whirwind tour of the Groovy language" was very informatory yet it made a gentle entry into the world of Groovy programming. The basics were laid out in a comprehensible manner.The 5th chapter made a good point about grails.project.plugins.dir in BuildConfig.groovy so it's not an issue anymore to upgrade Grails while developing your applications with plugins. It was then when the first plugin in this book - JSecurity - was presented and why the dynamic finders are called dynamic. It's not that they're added dynamically, but...well, I'm sure you don't want me to spoil it. Read about it in the book. It's clear that the book was written by a Groovy/Grails practitioner at the very least (if not a Groovy/Grails guru). While presenting JSecurity there're the tip and trick block about accessControl in filters. I was about to have complained it's not fully explained when the block appeared. Exactly when needed. When it was clear that the controllers were doing too much work, the author showed Grails services. Keeping the pace was not an issue at all. Again, exactly in time when the different parts of Grails were presented. The book answered some of the questions which every web application developer has to work out and so did for the "n+1 queries" issue.The 6th chapter made valid points about testing approaches and why they're necessary. I'd call it a testing refresher. Testing is quite often considered as an added benefit and only a few can take hassle to write them, but Grails simplifies it to an extreme minimum. The book presented it well and I'm sure that after having read the chapter nobody will ever be able to ignore it.What I didn't like in the chapter 7. was the decision about storing the files in the database without much explanation why. I could find one myself, but I wish I had read about the author's take on it.The chapter 9. turned its attention to the issue of developing controllers with too much business logic instead of just controlling the flow and using Grails services for it. Again, it's easy to repeat what's generally considered as a best practice, but it was this book that explained it to me clearly so it eventually became obvious. The part of the chapter about loosely- vs strongly-typed parameters was very informatory too. I'm not sure I could read about it in the other books.The chapter 10. mentioned a bit about folksonomy which I had never heard before. Explaining the collect() method and the Elvis operator briefly was just enough to implement the necessary features in the web app. The author paid much attention to learning by mistakes and test-driven development. GORM inheritance was explained briefly with unimportant stuff left out. Grails 1.1 new feature - the template namespaces - was very precious addition.The chapter 11. presented Prototype and RichUI plugins whereas the chapter 12. came with the Searchable plugin. As the author said it was "one more, but this time we can use this as an opportunity to become more familiar with Groovy builders, rather than instantly another plugin". Quite a pragmatic approach, isn't it? It was again explained what the differences between Grails controllers and services are. Enough to keep that in mind for the rest of my life. Good design was a foundation for the book and the author never forgot to point out its benefits. New REST service mapping in Grails 1.1 was explained too. As the wrap-up for the chapter the author showed how to create a simple command for GAnt, which was just on a single page without even mentioning GAnt by its name.In the chapter 13. the author took "a closer look at how other plug-ins work so we could borrow some ideas from them". Taking it all in small steps helped a lot. There was a plan laid out, small discussion and implementation afterwards. It seems a lot of work, but the book made it very slick. It was however a very tough chapter which I barely understood. These advanced topics about developing your own Grails plugin were beyond my mental capabilities.The last chapter was about setting up an environment with MySQL and Tomcat. I was glad to have read the Next Steps chapter about GORM-JPA, integration with other presentation frameworks and data migration. I wish the chapter about presentation frameworks with GWT and Wicket mentioned had been longer. Perhaps a good idea for the next book about Grails?As the summary goes: "Each chapter builds on a sample application so that everything you learn about Grails is in the context of real examples". I could only add that the sample app turned out to be a fully-fledged webapp. There're some typos in the book too, but they're harmless and one should not even take it into account while making a decision to read it or not. You should definitely read it and I wish you find the book as much informative as I did.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
Modal Close icon
Modal Close icon