See the light - agile, industrial strength, rapid web application development made easy

(Quick Reference) # 8.1.6.3 Using Named Configurations for Object Marshallers - Reference Documentation Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith, Lari Hotari Version: 2.3.8 ## 8.1.6.3 Using Named Configurations for Object Marshallers It is also possible to register named configurations. For example:
    XML.createNamedConfig('publicApi') {
      it.registerObjectMarshaller(Book) { Book book, XML xml ->
        // do public API
      }
    }
    XML.createNamedConfig('adminApi') {
      it.registerObjectMarshaller(Book) { Book book, XML xml ->
        // do admin API
      }
    }
Then when you use either the `render` or `respond` methods you can wrap the call in a named configuration if necessary to customize rendering per request:
    XML.use( isAdmin ? 'adminApi' : 'publicApi') {
        render book as XML
    }
or
    XML.use( isAdmin ? 'adminApi' : 'publicApi') {
        respond book
    }
| Quick Reference (hide)