public void toJson(Object data, Writer out) throws IOException
{
// Get the output stream and setup the mime type
try
{
ScriptBuffer buffer = new ScriptBuffer();
buffer.appendData(data);
String output = ScriptBufferUtil.createOutput(buffer, converterManager, true);
out.write(output);
}
catch (ConversionException ex)
{
log.warn("--ConversionException: class=" + ex.getConversionType().getName(), ex);
ScriptBuffer buffer = new ScriptBuffer();
buffer.appendData(ex);
try
{
String output = ScriptBufferUtil.createOutput(buffer, converterManager, true);
out.write(output);