DWR PluginThis plugin wraps around functionality provided by the DWR framework. Plugin is targeting version 2.0 of DWR. To learn more about DWR visit their site
InstallationFrom your application's directory issue the following command: grails install-plugin dwrThe operation requires network connection the first time you execute it, afterwards plugin will be cahced and you would be able to install it with no network available. When installation is complete you can use DWR features within your application. You would need to configure DWR for it to be usable. So, keep reading on how to do it.If you are impatient you can download the demo, install the plugin into the demo application then run 'grails run-app' and you will have the demo accessible at /dwrdemo.
Demo for the impatientDownload DWR demo application. The application is a Grails adaptation of the demo application that is(was) shipped with DWR. The demo is developed with 0.6-SNAPSHOT, so if you use version less than that run grails upgrade (it will downgrade but it's all the same)
ConfigurationRegularaly, DWR is configured by dwr.xml file that users place in WEB-INF directory of the web application. We configure DWR within grails a bit differently. The plugin provides a configuration builder. Here is a little sample of how one would configure an interface with it:
an equivalent dwr.xml definition would be:
closure called dwrconfig. To give you an example of the complete syntax, here is how your bootstrap class might look like:
Note, how dwrconfig closure contains an element that does not exists in dwr.xml - service. This is a feature that allows you to expose grails services. In the above example we are exposing a service named testService and its interface would be accessed to the browser through /dwr/interface/TestService.js . You can use all the inner elements that are meaningfull such as auth, include/exclude.
Version 0.1 - features
- DWR config builder.
- include/exclude calls accept a comma separated string of method names.
- auth call's methods argument accepts a comma separated string of method names.
- services can be exposed through service call.
- convert calls, to declare converters.
- signatures call accepts multi-line strings.
- param call accepts multi-line string as its value parameter.
- Grails 0.6 and up is required for this plugin to work. Note, it might work with earlier version of grails but it was not tested.