org.kuali.rice.krad.uif.freemarker
Class JsonStringEscapeDirective
java.lang.Object
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:
- the quote character '"' is prefixed with a backslash
- newline characters are replaced with backslash followed by 'n'
- carriage return characters are replaced with backslash followed by 'r'
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
Fields inherited from interface freemarker.template.TemplateModel |
NOTHING |
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 |
JsonStringEscapeDirective
public JsonStringEscapeDirective()
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-2013 The Kuali Foundation. All Rights Reserved.