public class DefaultRenderingContext extends Object implements RenderingContext, FunctionExecutor
| Constructor and Description |
|---|
DefaultRenderingContext(DataContext dataContext,
ResourceLoader resourceLoader,
Appendable out,
FunctionExecutor globalFunctionExecutor,
AutoEscapeOptions autoEscapeOptions) |
| Modifier and Type | Method and Description |
|---|---|
void |
escape(String name,
String input,
Appendable output)
Escapes some text.
|
Value |
executeFunction(String name,
Value... args)
Lookup a function by name, execute it and return the results.
|
Macro |
findMacro(String name)
Lookup a macro that's already been registered.
|
EscapeMode |
getAutoEscapeMode()
Read the currently set auto escape mode.
|
AutoEscapeOptions |
getAutoEscapeOptions()
Returns the configured AutoEscapeOptions to be used while rendering the current template.
|
DataContext |
getDataContext()
Return the DataContext object associated with this RenderingContext.
|
Iterable<String> |
getIncludedTemplateNames()
Returns the ordered, mutable stack of names of included templates.
|
ResourceLoader |
getResourceLoader()
Returns the ResourceLoader object to use to fetch files needed to render the current template.
|
boolean |
isEscapingFunction(String name)
Look up a function by name, and report whether it is an escaping function.
|
boolean |
isRuntimeAutoEscaping()
Indicates whether runtime auto escaping is in progress.
|
void |
popAutoEscapeMode() |
void |
popEscapingFunction() |
void |
popExecutionContext() |
boolean |
popIncludeStackEntry(String templateName)
Removes an entry with a name of the template from the stack.
|
void |
pushAutoEscapeMode(EscapeMode mode)
Push a new auto escaping mode onto the context.
|
void |
pushEscapingFunction(String name)
Push a new escaping function onto the context.
|
void |
pushExecutionContext(Template template)
Push a new template onto the current execution context.
|
boolean |
pushIncludeStackEntry(String templateName)
Adds an entry with a name of the template to the stack keeping all names of already included
templates.
|
void |
registerMacro(String name,
Macro macro)
Register a macro in the current rendering context.
|
void |
setCurrentPosition(int line,
int column)
Sets the current position in the template.
|
void |
startRuntimeAutoEscaping()
Start an auto escaping context to parse and auto escape template contents as they are being
rendered.
|
void |
stopRuntimeAutoEscaping()
Stop runtime auto escaping.
|
void |
writeEscaped(String text)
Write some text out, using the current escaping function.
|
void |
writeUnescaped(CharSequence text)
Write some text out, without doing any escaping.
|
public static final Logger logger
public DefaultRenderingContext(DataContext dataContext, ResourceLoader resourceLoader, Appendable out, FunctionExecutor globalFunctionExecutor, AutoEscapeOptions autoEscapeOptions)
public Value executeFunction(String name, Value... args)
executeFunction in interface FunctionExecutorexecuteFunction in interface RenderingContextpublic void escape(String name, String input, Appendable output) throws IOException
FunctionExecutorescape in interface FunctionExecutorname - Strategy for escaping text. If null or "none", text will be left as is.input - Text to be escaped.output - Where to write the result to.IOExceptionpublic boolean isEscapingFunction(String name)
RenderingContextisEscapingFunction in interface FunctionExecutorisEscapingFunction in interface RenderingContextEscapingEvaluatorpublic void pushEscapingFunction(String name)
RenderingContextpushEscapingFunction in interface RenderingContextRenderingContext.popEscapingFunction()public void popEscapingFunction()
popEscapingFunction in interface RenderingContextRenderingContext.pushEscapingFunction(String)public void writeEscaped(String text)
RenderingContextwriteEscaped in interface RenderingContextRenderingContext.pushEscapingFunction(String),
RenderingContext.popEscapingFunction()public void writeUnescaped(CharSequence text)
RenderingContextwriteUnescaped in interface RenderingContextpublic void pushExecutionContext(Template template)
RenderingContextpushExecutionContext in interface RenderingContextRenderingContext.popExecutionContext()public void popExecutionContext()
popExecutionContext in interface RenderingContextRenderingContext.pushExecutionContext(Template)public void setCurrentPosition(int line,
int column)
RenderingContextsetCurrentPosition in interface RenderingContextpublic void registerMacro(String name, Macro macro)
RenderingContextregisterMacro in interface RenderingContextpublic Macro findMacro(String name)
RenderingContextfindMacro in interface RenderingContextpublic DataContext getDataContext()
RenderingContextgetDataContext in interface RenderingContextpublic ResourceLoader getResourceLoader()
RenderingContextgetResourceLoader in interface RenderingContextpublic AutoEscapeOptions getAutoEscapeOptions()
RenderingContextgetAutoEscapeOptions in interface RenderingContextpublic EscapeMode getAutoEscapeMode()
RenderingContextgetAutoEscapeMode in interface RenderingContextpublic void pushAutoEscapeMode(EscapeMode mode)
RenderingContextpushAutoEscapeMode in interface RenderingContextRenderingContext.popAutoEscapeMode()public void popAutoEscapeMode()
popAutoEscapeMode in interface RenderingContextRenderingContext.pushAutoEscapeMode(com.google.clearsilver.jsilver.autoescape.EscapeMode)public boolean isRuntimeAutoEscaping()
RenderingContextisRuntimeAutoEscaping in interface RenderingContextRenderingContext.isRuntimeAutoEscaping()public void startRuntimeAutoEscaping()
startRuntimeAutoEscaping in interface RenderingContextJSilverInterpreterException - if startRuntimeAutoEscaping is called while runtime
autoescaping is already in progress.RenderingContext.stopRuntimeAutoEscaping()public void stopRuntimeAutoEscaping()
RenderingContextstopRuntimeAutoEscaping in interface RenderingContextRenderingContext.startRuntimeAutoEscaping()public boolean pushIncludeStackEntry(String templateName)
RenderingContextpushIncludeStackEntry in interface RenderingContexttemplateName - name of the template to be added to the stack. If null a NullPointerException will be thrown.templateName was added.public boolean popIncludeStackEntry(String templateName)
RenderingContextpopIncludeStackEntry in interface RenderingContexttemplateName was on the stack.public Iterable<String> getIncludedTemplateNames()
RenderingContextgetIncludedTemplateNames in interface RenderingContextCopyright © 2010–2016 Google. All rights reserved.