Package eu.webtoolkit.jwt
Class Utils
java.lang.Object
eu.webtoolkit.jwt.Utils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration for HTML encoding flags. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassignFontMatch(eu.webtoolkit.jwt.FontSupport.FontMatch fm1, eu.webtoolkit.jwt.FontSupport.FontMatch fm2) static byte[]Performs Base32-decoding of data.static Stringstatic Stringbase32Encode(byte[] bytes) Performs Base32-encoding of data.static Stringbase32Encode(byte[] bytes, boolean crlf) static StringPerforms Base32-encoding of data.static Stringbase32Encode(String s, boolean crlf) static byte[]Performs Base64-decoding of data.static Stringstatic Stringbase64Encode(byte[] bytes) Performs Base64-encoding of data.static Stringbase64Encode(byte[] bytes, boolean crlf) static StringPerforms Base64-encoding of data.static Stringbase64Encode(String s, boolean crlf) static voidstatic voidstatic StringcreateDataUrl(byte[] data, String mimeType) getWidgetStyleClasses(WWidget widget) static byte[]hexStrToBytes(long value) Converts the long value to a byte array containing the hexstring.static intstatic byte[]static byte[]static byte[]static Stringhmac_sha1WithEncoding(long msg, byte[] key) static StringhmacWithEncoding(byte[] msg, byte[] key, String algo) static StringhtmlAttributeValue(String text) Escape the given text for inclusion in an HTML attributestatic StringhtmlEncode(WString text) Performs HTML encoding of text.static StringhtmlEncode(WString text, EnumSet<Utils.HtmlEncodingFlag> flags) Performs HTML encoding of text.static StringhtmlEncode(String text) Performs HTML encoding of text.static StringhtmlEncode(String value, Utils.HtmlEncodingFlag flag, Utils.HtmlEncodingFlag... flags) Performs HTML encoding of text.static StringhtmlEncode(String text, EnumSet<Utils.HtmlEncodingFlag> flags) Performs HTML encoding of text.static byte[]Computes an MD5 hash.static voidparseFormUrlEncoded(String s, Map<String, String[]> parameters) static booleanremoveScript(CharSequence text) Remove tags/attributes from text that are not passive.static byte[]static Stringstatic StringPerforms url decoding.static StringPerforms url encoding (aka percentage encoding).
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
md5
Computes an MD5 hash. This utility function computes an MD5 hash, and returns the hash value. -
sha1
-
urlEncode
Performs url encoding (aka percentage encoding). This utility function percent encodes a text so that it can be embodied verbatim in a URL (e.g. as a fragment).- See Also:
-
urlDecode
Performs url decoding. This utility function percent encodes a text so that it can be embodied verbatim in a URL (e.g. as a fragment).- See Also:
-
parseFormUrlEncoded
-
base64Encode
Performs Base64-encoding of data. -
base64Encode
-
base64Encode
Performs Base64-encoding of data. -
base64Encode
-
base64Decode
Performs Base64-decoding of data.- Throws:
IOException
-
base64DecodeS
-
base32Encode
Performs Base32-encoding of data. -
base32Encode
-
base32Encode
Performs Base32-encoding of data. -
base32Encode
-
base32Decode
Performs Base32-decoding of data.- Throws:
IOException
-
base32DecodeS
-
htmlEncode
Performs HTML encoding of text. This utility function escapes characters so that the text can be embodied verbatim in a HTML text block. -
htmlEncode
Performs HTML encoding of text.Calls
Utils.htmlEncode(text, EnumSet.noneOf(HtmlEncodingFlag.class)) -
htmlEncode
Performs HTML encoding of text. This utility function escapes characters so that the text can be embodied verbatim in a HTML text block. By default, newlines are ignored. By passing theUtils.HtmlEncodingFlag.EncodeNewLinesflag, these may be encoded as line breaks (<br>). -
htmlEncode
Performs HTML encoding of text.Calls
Utils.htmlEncode(text, EnumSet.noneOf(HtmlEncodingFlag.class)) -
htmlEncode
public static String htmlEncode(String value, Utils.HtmlEncodingFlag flag, Utils.HtmlEncodingFlag... flags) Performs HTML encoding of text. -
htmlAttributeValue
Escape the given text for inclusion in an HTML attributeThis utility function escapes characters so that the \p text can be used as the value of an HTML attribute between double quotes.
The double quotes are not included in the output.
Example usage:
String attribute = "name=\"" + htmlAttributeValue(value) + "\""; -
removeScript
Remove tags/attributes from text that are not passive. This removes tags and attributes from XHTML-formatted text that do not simply display something but may trigger scripting, and could have been injected by a malicious user for Cross-Site Scripting (XSS). This method is used by the library to sanitize XHTML-formatted text set inWText, but it may also be useful outside the library to sanitize user content when directly using JavaScript. Modifies the text if needed. When the text is not proper XML, returns false. -
strip
-
assignFontMatch
public static void assignFontMatch(eu.webtoolkit.jwt.FontSupport.FontMatch fm1, eu.webtoolkit.jwt.FontSupport.FontMatch fm2) -
copyList
-
copyList
-
hexToInt
-
hexStrToBytes
public static byte[] hexStrToBytes(long value) Converts the long value to a byte array containing the hexstring.The hexstring of a long value is simple its hexadecimal representation in string format. i.e. 12 would be C. The string will always be then converted to be 16 bytes long.
The string is then converted to an array of bytes.
-
createDataUrl
-
hmac
-
hmacWithEncoding
-
hmac_sha1
-
hmac_sha1WithEncoding
-
hmac_md5
-
getWidgetStyleClasses
-