Interface IRenderer
Note that this interface does not enforce type-safety through generic type parameters. This reflects it's main usage in the web context as well as Java type erasure.
So renderers are required to check types at runtime and to throw adequate exceptions.
Default rendering parameters (setParam)
PARAM_DEFAULT_OUTPUT
(de.uplanet.lucy.server.renderer.defaultOutput)
this value is returned if the rendering value was empty, (not used in a pipe)PARAM_ERROR_MODE
(default:exceptionThrow
)
(de.uplanet.lucy.server.renderer.errorMode)
Error mode, valid values: (value of enum classIRenderer.ErrorMode
)exceptionThrow
, throws a Renderer Exception, if an error occurserrorMsg
, returns the error value given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable or not parseableerrorMsgOnCast
, returns the error value given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castableerrorMsgOnParse
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not parseable
PARAM_ERROR_MSG
(default:""
)
(de.uplanet.lucy.server.renderer.IRenderer.errorMsg)
Text will be returned ifPARAM_ERRORMODE=errorMsg
and an error occurs.PARAM_JAVASCRIPT_ENCODE
(default:false
)
(de.uplanet.lucy.server.renderer.IRenderer.javaScriptEncode)
Text will be encoded for use in JavaScript context.PARAM_HTML_ENCODE
(default:false
)
(de.uplanet.lucy.server.renderer.IRenderer.htmlEncode)
Text will be encoded for use in HTML context.PARAM_HTML_BR_INSERT
(de.uplanet.lucy.server.renderer.IRenderer.htmlBRInsert)
CRLF, CR or LF will replaced by <br> .
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Thede.uplanet.lucy.server.renderer.IRenderer.defaultOutput
property specifies the output that's generated by the renderer if no input data are provided.static final String
Error mode, valid values: value of enum classIRenderer.ErrorMode
(default:exceptionThrow
)
exceptionThrow
, throw aRendererException
iif an error occurserrorMsg
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable or not parseable.errorMsgOnCast
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable.errorMsgOnParse
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, if the input value is not parseable.static final String
de.uplanet.lucy.server.renderer.IRenderer.errorMsg
static final String
de.uplanet.lucy.server.renderer.IRenderer.htmlBRInsert
static final String
de.uplanet.lucy.server.renderer.IRenderer.htmlEncode
static final String
de.uplanet.lucy.server.renderer.IRenderer.javaScriptEncode
-
Method Summary
Modifier and TypeMethodDescriptiongetOutput
(IValueHolder<?> p_vh) Get the rendered results as a string.void
Set a renderer parameter.void
writeOutput
(de.uplanet.lucy.server.renderer.IPipedRenderer p_child, IValueHolder<?> p_vh) Write the rendered results to the given child renderer.void
writeOutput
(Writer p_out, IValueHolder<?> p_vh) Write the rendered results to the given output stream.
-
Field Details
-
PARAM_DEFAULT_OUTPUT
Thede.uplanet.lucy.server.renderer.IRenderer.defaultOutput
property specifies the output that's generated by the renderer if no input data are provided.The default value for this property is the empty string.
-
PARAM_ERROR_MODE
Error mode, valid values: value of enum classIRenderer.ErrorMode
(default:exceptionThrow
)
exceptionThrow
, throw aRendererException
iif an error occurserrorMsg
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable or not parseable.errorMsgOnCast
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, when the input value is not castable.errorMsgOnParse
, returns the error value, given by thede.uplanet.lucy.server.renderer.IRenderer.errorMsg
parameter, if the input value is not parseable.
-
PARAM_ERROR_MSG
de.uplanet.lucy.server.renderer.IRenderer.errorMsg
default: ""
Text will return if
PARAM_ERRORMODE == errorMsg
and an error occurred. -
PARAM_JAVASCRIPT_ENCODE
de.uplanet.lucy.server.renderer.IRenderer.javaScriptEncode
-
PARAM_HTML_ENCODE
de.uplanet.lucy.server.renderer.IRenderer.htmlEncode
-
PARAM_HTML_BR_INSERT
de.uplanet.lucy.server.renderer.IRenderer.htmlBRInsert
-
-
Method Details
-
writeOutput
void writeOutput(Writer p_out, IValueHolder<?> p_vh) throws de.uplanet.lucy.server.renderer.RendererException, IOException Write the rendered results to the given output stream.If the given value holder provides a
Closeable
data object, the renderer will call theclose()
method if it uses it.- Parameters:
p_out
- The output stream.p_vh
- The value to be rendered.- Throws:
de.uplanet.lucy.server.renderer.RendererException
- - If an error occurred. This exception may wrap other exceptions that occurred while rendering the input.IOException
- - If an I/O error occurred.
-
writeOutput
void writeOutput(de.uplanet.lucy.server.renderer.IPipedRenderer p_child, IValueHolder<?> p_vh) throws de.uplanet.lucy.server.renderer.RendererException, IOException Write the rendered results to the given child renderer.If the given value holder provides a
Closeable
data object, the renderer will call theclose()
method if it uses it.- Parameters:
p_child
- The child renderer.p_vh
- The value to be rendered.- Throws:
de.uplanet.lucy.server.renderer.RendererException
- - If an error occurred. This exception may wrap other exceptions that occurred while rendering the input.IOException
- - If an I/O error occurred.
-
getOutput
Get the rendered results as a string.If the given value holder provides a
Closeable
data object, the renderer will call theclose()
method if it uses it.- Parameters:
p_vh
- The value to be rendered.- Returns:
- The rendered value.
- Throws:
de.uplanet.lucy.server.renderer.RendererException
- - If an error occurred. This exception may wrap other exceptions that occurred while rendering the input.
-
setParam
void setParam(String p_strName, Object p_value) throws de.uplanet.lucy.server.renderer.RendererException Set a renderer parameter.- Parameters:
p_strName
- The name of the parameter.p_value
- The value of the parameter.- Throws:
de.uplanet.lucy.server.renderer.RendererException
-