Package com.zfabrik.util.html
Class Escaper
java.lang.Object
com.zfabrik.util.html.Escaper
Various encoding and decoding utility functions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
escapeToHTML
(String in) Escape a string to be used as an HTML String literalstatic String
escapeToJS
(String in) Escape a string to be used as a Javascript String literal.static String
escapeToJSON
(String in) Escape a string to be used as a JSON String literal.static String
URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.static String
URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.static String
URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.static String
URL encode/decode This implementation helps addressing two things: As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g.
-
Constructor Details
-
Escaper
public Escaper()
-
-
Method Details
-
escapeToJSON
Escape a string to be used as a JSON String literal. -
escapeToJS
Escape a string to be used as a Javascript String literal. -
escapeToHTML
Escape a string to be used as an HTML String literal -
urlEncode
URL encode/decode This implementation helps addressing two things:- As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
- Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.
-
urlEncode
URL encode/decode This implementation helps addressing two things:- As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
- Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.
-
urlDecode
URL encode/decode This implementation helps addressing two things:- As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
- Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.
-
urlDecode
URL encode/decode This implementation helps addressing two things:- As Apache's mod_proxy unfortunately (and almost utterly incomprehensibly) unescapes URLs before passing them on to the backend, you can use this method to use an alternative character (e.g. "!") rather than "%" as escape character.
- Using this method, you can spare catching UnsupportedEncodingExceptions, that are never thrown or you'd be in much bigger trouble anyway. This method always uses utf-8 encoding.
-