Copyright© 2008-2018 SiteVision AB, all rights reserved.
@Requireable(value="EndecUtil") public interface EndecUtil
An instance of the SiteVision class implementing this interface can be obtained via
Utils.getEndecUtil()
.
See Utils
for how to obtain an instance of the Utils
interface.
Modifier and Type | Method and Description |
---|---|
String |
base64decode(String aString)
Decodes a base64 encoded string
|
String |
base64encode(String aString)
Encodes a string using base64 encoding
|
String |
br(String aString)
Converts line breaks to xhtml <br /> elements.
|
String |
decodeURL(String aURL)
Decodes a URL safe String into its original form using the default charset.
|
String |
encodeURL(String aURL)
Encodes a String into its URL safe form using the default charset.
|
String |
escapeIdentifier(String aPrefix,
String anIdentifier)
Escapes/encodes an identifier.
|
String |
escapeJcrName(String aJcrName)
Escapes/encodes a jcr name (property name or node name) that might contain illegal characters.
|
String |
escapeXML(String aString)
Escapes/encodes the characters in a String using XML entities.
|
String |
getBaseSubstitute(String aString)
Replaces characters to their base subtitute.
|
String |
unEscapeHTML4(String aString)
Unescapes/decodes a string containing HTML 4 entities to a string containing the actual Unicode characters corresponding to the entities.
|
String |
unEscapeIdentifier(String aPrefix,
String anIdentifier)
Unescapes/decodes an escaped/encoded identifier.
|
String |
unEscapeJcrName(String aJcrName)
Unescapes/decodes a jcr name (property name or node name) that might be escape/encoded.
|
String |
unEscapeXML(String aString)
Unescapes/decodes a string containing basic XML entities to a string containing the actual Unicode characters corresponding to the entities.
|
String escapeXML(String aString)
Example: "One <br /> & two" -> "One <br /> & two"
aString
- a String
that needs to be escapedString unEscapeXML(String aString)
Supports the 5 basic XML entities (gt, lt, quot, amp, apos) and numerical unicodes (decimal and hex).
Examples:
[ One <br /> & two
] will become:
[ One <br /> & two
]
[ "Hej å hå" är kopieringsskyddat© sägs det
] will become:
[ "Hej å hå" är kopieringsskyddat© sägs det
]
aString
- a String
that contains escaped xml entitiesunEscapeHTML4(String)
String unEscapeHTML4(String aString)
Supports HTML 4.0 entities, including numerical unicodes (decimal and hex).
Examples:
[ One <br /> & two
] will become:
[ One <br /> & two
]
[ "Hej å hå" är kopieringsskyddat© sägs det
] will become:
[ "Hej å hå" är kopieringsskyddat© sägs det
]
aString
- a String
that contains escaped html 4 entitiesunEscapeXML(String)
String encodeURL(String aURL)
Handles the www-form-urlencoded encoding scheme, also misleadingly known as URL encoding
aURL
- the string to convert to a URL safe formnull
if aURL
is null
or can't be encoded.String decodeURL(String aURL)
Handles the www-form-urlencoded encoding scheme, also misleadingly known as URL encoding
aURL
- URL safe String to convert to its original formnull
if aURL
is null
or can't be decoded.String br(String aString)
Example: "Line 1\nLine 2" -> "Line 1<br />Line2"
aString
- a String
to convertString getBaseSubstitute(String aString)
Example: "xml ëBå_$-1205" -> "xmleBa1205"
aString
- a String
that should be base substitutedString escapeJcrName(String aJcrName)
Any operation that includes a JCR name that contains illegal characters must be escaped. For example:
javax.jcr.Node aNode = ...
javax.jcr.NodeIterator aNodeIterator = aNode.getNodes("aNameThatShouldBeEscaped");
javax.jcr.Property aProperty = aNode.getProperty("aNameThatShouldBeEscaped");
Illegal characters are:
.
("dot")[
("left bracket")]
("right bracket")/
("slash")*
("asterix")|
("pipe")aJcrName
- a name that should be escaped/encodedString unEscapeJcrName(String aJcrName)
Any operation that includes getting a JCR name must be unescaped if it contains illegal characters. For example:
javax.jcr.Node aNode = ...
javax.jcr.Property aProperty = ...
java.lang.String aNameThatNeedsToBeUnEscaped = aNode.getName();
java.lang.String anotherNameThatNeedsToBeUnEscaped = aProperty.getName();
aJcrName
- a name that might be escaped/encodedString base64encode(String aString)
aString
- a String
that should be base64 encodedaString
base64 encoded. Returns null
if aString
is null
String base64decode(String aString)
aString
- a base64 encoded String
aString
base64 decoded. Returns null
if aString
is null
or can't be decoded.String escapeIdentifier(String aPrefix, String anIdentifier)
aPrefix | anIdentifier | Returned |
---|---|---|
null | null | "" |
"" | null | "" |
null | "" | "" |
"" | "" | "" |
"pcx" | null | "pcx" |
null | "pcx" | "pcx" |
"pcx" | "" | "pcx" |
"pcx" | "123" | "pcx123" |
"pcx" | "1.23" | "pcx1_23" |
"pcx" | "1.23.45" | "pcx1_23_45" |
aPrefix
- a prefix added to the resultanIdentifier
- a string idString unEscapeIdentifier(String aPrefix, String anIdentifier)
aPrefix | anIdentifier | Returned |
---|---|---|
null | null | "" |
"" | null | "" |
null | "" | "" |
"" | "" | "" |
"pcx" | null | "" |
null | "pcx" | "pcx" |
"pcx" | "" | "" |
"pcx" | "pcx123" | "123" |
"pcx" | "pcx1_23" | "1.23" |
"pcx" | "pcx1_23_45" | "1.23.45" |
null | "pcx1_23" | "pcx1.23" |
"" | "pcx1_23" | "pcx1.23" |
"badprefix" | "pcx1_23" | "pcx1.23" |
aPrefix
- a prefix that will be removed from the resultanIdentifier
- a string idSiteVision - Portal and Content Management Made Easy
SiteVision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2018 SiteVision AB, all rights reserved.