Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 5. Controlling application flow > Intercepting requests with filters

5.6. Intercepting requests with filters

So far in this chapter, we’ve spent a lot of time looking at the frontend user experience. But there are also important techniques that you need to implement at the backend. In this section we’ll explore the use of filters for augmenting the Grails request/response pipeline with your own custom processing.

5.6.1. Writing your first filter

Grails filters give you a powerful tool for intercepting every request (or a subset of requests) and for performing business logic before or after the controller action fires. If you’ve worked with Java Servlet filters, you might recognize Grails filters as providing similar functionality, although Grails filters only intercept controller requests, not static file requests for JavaScript, CSS, image files, and the like.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial