Skip to end of metadata
Go to start of metadata

Description

The Hessian plugin adds a remoting client that uses the Hessian/Burlap protocols. It is compatible with Grails' Remoting plugin 1.0.

Installation

The current version of griffon-hessian-plugin is 0.6
To install just issue the following command

Usage

The plugin will inject the following dynamic methods:

  • withHessian(Map params, Closure stmts) - executes stmts using the Hessian protocol
  • withBurlap(Map params, Closure stmts) - executes stmts using the Burlap protocol

Where params may contain

Property

Type

Required

Notes

url

String

(tick)

 

service

Class or String

(tick)

 

id

String

(error)

 

These methods are also accessible to any component through the singleton griffon.plugins.hessian.HessianConnector. You can inject these methods to non-artifacts via metaclasses. Simply grab hold of a particular metaclass and call HessianConnector.enhance(metaClassInstance).

Configuration

Dynamic method injection

Dynamic methods will be added to controllers by default. You can change this setting by adding a configuration flag in Config.groovy

Examples

This example relies on Grails as the service provider. Follow these steps to configure the service on the Grails side:

  1. Download a copy of Grails and install it.
  2. Create a new Grails application. We'll pick 'exporter' as the application name.
  3. Change into the application's directory. Install the remoting plugin.
  4. Create a service interface. This interface will be used on the Griffon side too.
    src/main/groovy/exporter/MathService.groovy
    Icon

    The service interface must be placed in a package other than the default one.

  5. Create an implementation for exporter.MathService
    grails-app/services/MathService.groovy
  6. Start the application
Icon

Keep an eye on http://jira.codehaus.org/browse/GRAILSPLUGINS-865 as the remoting plugin has problems with Grails +1.1

Now we're ready to build the Griffon application

  1. Create a new Griffon application. We'll pick MathClient as the name
  2. Install the hessian plugin
  3. Fix the view script to look like this
    griffon-app/views/MathClientView.groovy
  4. Let's add required properties to the model
    griffon-app/models/MathClientModel.groovy
  5. Now for the controller code. Notice that there is minimal error handling in place. If the user types something that is not a number the client will surely break, but the code is sufficient for now.
    griffon-app/controllers/MathClientController.groovy
  6. The final step will be to locate and jar up the exposed service interfaces and place them in your [Griffon] application's lib directory. They are located at ~/.grails/<version>/projects/exporter/classes
  7. Start the application

Running the application should result in a similar display as the following picture

All dynamic methods will create a new client when invoked unless you define an id: attribute. When this attribute is supplied the client will be stored as a property on the instance's metaClass. You will be able to access it via regular property access or using the id: again.
The service: property may be a String with the full qualified classname or a Class.

Java Api

Here's how the above service call may be written in Java

History

Version

Date

Notes

0.6

10-21-11

Release sync with Griffon 0.9.4

0.5

12-21-10

Release sync with Griffon 0.9.2

0.4.1

11-08-10

Fix a metaclass problem when injecting dynamic methods

0.4

10-27-10

Release sync with Griffon 0.9.1

0.3

07-22-10

Release sync with Griffon 0.9

0.2

03-01-10

Upgraded to Griffon 0.3

0.1

10-26-09

Initial release

  • No labels