Class HTMLEncoder
- java.lang.Object
- 
- org.apache.myfaces.renderkit.html.util.HTMLEncoder
 
- 
 public abstract class HTMLEncoder extends Object Converts Strings so that they can be used within HTML-Code.
- 
- 
Constructor SummaryConstructors Constructor Description HTMLEncoder()
 - 
Method SummaryAll Methods Static Methods Concrete Methods Modifier and Type Method Description static 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 voidencode(char[] string, int offset, int length, boolean encodeNewline, Writer writer)Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.static voidencode(char[] string, int offset, int length, Writer writer)Variant 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 voidencode(Writer writer, String string)Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.static voidencode(Writer writer, String string, boolean encodeNewline)Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNbsp is true.static voidencode(Writer writer, String string, boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp)Variant 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.
 
- 
- 
- 
Method Detail- 
encodepublic static String encode(FacesContext context, String string) Variant 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
 
 - 
encodepublic static String encode(FacesContext context, String string, boolean encodeNewline) Variant 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
 
 - 
encodepublic static void encode(Writer writer, String string) throws IOException Variant ofencode(jakarta.faces.context.FacesContext, java.lang.String)where encodeNewline is false and encodeNbsp is true.- Parameters:
- writer-
- string-
- Throws:
- IOException
 
 - 
encodepublic static void encode(Writer writer, String string, boolean encodeNewline) throws IOException Variant 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
 
 - 
encodepublic static void encode(char[] string, int offset, int length, Writer writer) throws IOExceptionVariant 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 IOExceptionVariant 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 IOExceptionVariant 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 IOExceptionEncodes 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
 
 
- 
 
-