JSON how to set configuration inside code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

JSON how to set configuration inside code

Tridib Samanta
Hi Experts,
 
I am trying to switch the value of   deep copy mode from code. How can I set the configuration for it inside code?
 
ConfigurationHolder.config.grails.converters.json.default.deep = true/false does not work :(
 
Looking for your answers...
 
Thanks
Tridib

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: JSON how to set configuration inside code

ld@ldaley.com

On 12/01/2011, at 8:44 AM, Tridib Samanta wrote:

I am trying to switch the value of   deep copy mode from code. How can I set the configuration for it inside code?
 
ConfigurationHolder.config.grails.converters.json.default.deep = true/false does not work :(

Switching this at runtime is not going to work because it is read once at startup.


It turns out that there is a completely undocumented set of features built in to the converter mechanism that will let you do what you want. You are going to have to read through the source though and work it out.

Some starting points are:


That allows you to create a threadlocal config.

To create a config, take a look at:


Instead of registering a DeepDomainClassMarshaller, you want to register DomainClassMarshaller.


Good luck.

Loading...