Chapter 11. Remote access
In this chapter
- Making your application available to software clients
- Leveraging HTTP via the REST pattern
- Exporting services to remote clients
Now that you have a good grounding in securing an application from attack and unauthorized access, it’s time to look at how other software (other than web browsers) can use and interact with your Grails applications.
The prominence of controllers and GSPs shows how heavily geared Grails is toward browser-based web applications, but there’s often no reason to limit yourself to a single UI—anyone who has used Twitter knows that you can use a variety of different clients to view and post tweets. An HTML interface isn’t much use for such software clients because they usually control the presentation of the information themselves. What we need is a way for software clients to interact with the data in the system—in effect, a public API to the application.
Such an API can be exposed in many different ways, and this chapter will introduce you to a few of the more common ones. The primary focus will be on a mechanism that has become popular in recent years and that suits web applications well: REST. Grails has core support for this technique, and that’s another reason to look at it closely. We’ll also take a peek at a couple of plugin options that may suit your requirements better: remoting (with RMI) and Web Services via the SOAP protocol.