org.kuali.rice.krad.uif.freemarker
Class JsonStringEscapeDirective

java.lang.Object
  extended by org.kuali.rice.krad.uif.freemarker.JsonStringEscapeDirective
All Implemented Interfaces:
freemarker.template.TemplateDirectiveModel, freemarker.template.TemplateModel

public class JsonStringEscapeDirective
extends Object
implements freemarker.template.TemplateDirectiveModel

A custom FreeMarker directive that adds escapes to nested content to make it valid for enclosure within a JSON string.

In other words, the content that is generated within this tag should be able to be enclosed in quotes within a JSON document without breaking strict JSON parsers. Note that this doesn't presently handle a wide variety of cases, just enough to properly escape basic html.

There are three types of replacements this performs:

Author:
Kuali Rice Team (rice.collab@kuali.org)

Field Summary
 
Fields inherited from interface freemarker.template.TemplateModel
NOTHING
 
Constructor Summary
JsonStringEscapeDirective()
           
 
Method Summary
 void execute(freemarker.core.Environment env, Map params, freemarker.template.TemplateModel[] loopVars, freemarker.template.TemplateDirectiveBody body)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonStringEscapeDirective

public JsonStringEscapeDirective()
Method Detail

execute

public void execute(freemarker.core.Environment env,
                    Map params,
                    freemarker.template.TemplateModel[] loopVars,
                    freemarker.template.TemplateDirectiveBody body)
             throws freemarker.template.TemplateException,
                    IOException
Specified by:
execute in interface freemarker.template.TemplateDirectiveModel
Throws:
freemarker.template.TemplateException
IOException


Copyright © 2005–2014 The Kuali Foundation. All rights reserved.