public class ContentHelper extends Object
The instance of this class is made available as helper
via DefaultGlobalContextExtender
.
Modifier and Type | Field and Description |
---|---|
static ContentHelper |
INSTANCE
Contains the instance which is passed into the velocity context as "helper".
|
Modifier and Type | Method and Description |
---|---|
static String |
escapeXML(Object aText)
Removes all XML characters (<, >, ", ', &) from the input and replaces it with the well known
replacement characters.
|
String |
getResourceAsInlineString(String resource)
Returns the contents of the given template as a single line string which can be embedded into a string
enclosed by ' (e.g. a JavaScript string).
|
String |
nl2br(String content)
Replaces new line with <br> tags.
|
String |
stripXML(String content)
Removes all XML tags from a given content.
|
public static final ContentHelper INSTANCE
public String nl2br(String content)
content
- the content to parse@Nonnull public static String escapeXML(@Nullable Object aText)
aText
- the text to replacepublic String stripXML(String content)
content
- content to strip XML of@Nonnull public String getResourceAsInlineString(String resource)
resource
- the template to fetchCopyright © 2018. All rights reserved.