Class HTMLEncoder
java.lang.Object
org.apache.myfaces.renderkit.html.util.HTMLEncoder
Converts Strings so that they can be used within HTML-Code.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic voidencode(char[] string, int offset, int length, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, boolean encodeNonLatin, Writer writer) Encodes the given string, so that it can be used within a html page.static voidencode(char[] string, int offset, int length, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, Writer writer) Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp and encodeNonLatin are truestatic voidVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.static voidVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.static Stringencode(FacesContext context, String string) Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.static Stringencode(FacesContext context, String string, boolean encodeNewline) Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.static Stringencode(FacesContext context, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp) Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp and encodeNonLatin are truestatic Stringencode(FacesContext context, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, boolean encodeNonLatin) Encodes the given string, so that it can be used within a html page.static voidVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.static voidVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.static voidVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp and encodeNonLatin are truestatic voidencode(Writer writer, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, boolean encodeNonLatin) Encodes and writes the given string, so that it can be used within a html page.static StringencodeURIAttribute(FacesContext context, String string, String characterEncoding) Encode an URI, escaping or percent-encoding all required characters and following the rules mentioned on RFC 3986.static voidencodeURIAttribute(Writer writer, String string, String characterEncoding) Encode an URI, escaping or percent-encoding all required characters and following the rules mentioned on RFC 3986.
- 
Constructor Details- 
HTMLEncoderpublic HTMLEncoder()
 
- 
- 
Method Details- 
encodeVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.- Parameters:
- context-
- string- the string to convert
- Returns:
- the encoded string
 
- 
encodeVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.- Parameters:
- context-
- string- the string to convert
- encodeNewline- if true newline characters are converted to <br>'s
- Returns:
- the encoded string
 
- 
encodepublic static String encode(FacesContext context, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp) Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp and encodeNonLatin are true- Parameters:
- context-
- string- the string to convert
- encodeNewline- if true newline characters are converted to <br>'s
- encodeSubsequentBlanksToNbsp- if true subsequent blanks are converted to  's
- Returns:
- the encoded string
 
- 
encodepublic static String encode(FacesContext context, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, boolean encodeNonLatin) Encodes the given string, so that it can be used within a html page.- Parameters:
- context-
- string- the string to convert
- encodeNewline- if true newline characters are converted to <br>'s
- encodeSubsequentBlanksToNbsp- if true subsequent blanks are converted to  's
- encodeNonLatin- if true encode non-latin characters as numeric character references
- Returns:
- the encoded string
 
- 
encodeVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.- Parameters:
- writer-
- string-
- Throws:
- IOException
 
- 
encodeVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.- Parameters:
- writer-
- string-
- encodeNewline-
- Throws:
- IOException
 
- 
encodepublic static void encode(Writer writer, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp) throws IOException Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp and encodeNonLatin are true- Parameters:
- writer-
- string-
- encodeNewline-
- encodeSubsequentBlanksToNbsp-
- Throws:
- IOException
 
- 
encodepublic static void encode(Writer writer, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, boolean encodeNonLatin) throws IOException Encodes and writes the given string, so that it can be used within a html page.- Parameters:
- writer-
- string-
- encodeNewline-
- encodeSubsequentBlanksToNbsp-
- encodeNonLatin-
- Throws:
- IOException
 
- 
encodeVariant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.- Parameters:
- string- the string to convert
- offset-
- length-
- writer-
- Throws:
- IOException
 
- 
encodepublic static void encode(char[] string, int offset, int length, boolean encodeNewline, Writer writer) throws IOException Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.- Parameters:
- string- the string to convert
- offset-
- length-
- encodeNewline- if true newline characters are converted to <br>'s
- writer-
- Throws:
- IOException
 
- 
encodepublic static void encode(char[] string, int offset, int length, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, Writer writer) throws IOException Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp and encodeNonLatin are true- Parameters:
- string- the string to convert
- offset-
- length-
- encodeNewline- if true newline characters are converted to <br>'s
- encodeSubsequentBlanksToNbsp- if true subsequent blanks are converted to  's
- writer-
- Throws:
- IOException
 
- 
encodepublic static void encode(char[] string, int offset, int length, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp, boolean encodeNonLatin, Writer writer) throws IOException Encodes the given string, so that it can be used within a html page.- Parameters:
- string- the string to convert
- offset-
- length-
- encodeNewline- if true newline characters are converted to <br>'s
- encodeSubsequentBlanksToNbsp- if true subsequent blanks are converted to  's
- encodeNonLatin- if true encode non-latin characters as numeric character references
- writer-
- Throws:
- IOException
 
- 
encodeURIAttributepublic static String encodeURIAttribute(FacesContext context, String string, String characterEncoding) throws IOException Encode an URI, escaping or percent-encoding all required characters and following the rules mentioned on RFC 3986.- Parameters:
- context-
- string-
- characterEncoding-
- Returns:
- Throws:
- IOException
 
- 
encodeURIAttributepublic static void encodeURIAttribute(Writer writer, String string, String characterEncoding) throws IOException Encode an URI, escaping or percent-encoding all required characters and following the rules mentioned on RFC 3986.- Parameters:
- writer-
- string-
- characterEncoding-
- Throws:
- IOException
 
 
-