/** * Returns a {@link SafeHtml} constructed from a trusted string, i.e., without * escaping the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the {@link SafeHtml} contract. * * @param s the input String * @return a {@link SafeHtml} instance */ public static SafeHtml fromTrustedString(String s) { return new SafeHtmlString(s); }
/** * Returns the safe HTML accumulated in the builder as a {@link SafeHtml}. * * @return a SafeHtml instance */ public SafeHtml toSafeHtml() { return new SafeHtmlString(sb.toString()); } }
/** * Returns a {@link SafeHtml} containing the escaped string. * * @param s the input String * @return a {@link SafeHtml} instance */ public static SafeHtml fromString(String s) { return new SafeHtmlString(htmlEscape(s)); }
/** * HTML-sanitizes a string. * * <p> * The input string is processed as described above. The result of sanitizing * the string is guaranteed to be safe to use (with respect to XSS * vulnerabilities) in HTML contexts, and is returned as an instance of the * {@link SafeHtml} type. * * @param html the input String * @return a sanitized SafeHtml instance */ public static SafeHtml sanitizeHtml(String html) { if (html == null) { throw new NullPointerException("html is null"); } return new SafeHtmlString(simpleSanitize(html)); }
return new SafeHtmlString(s);
/** * Returns a {@link SafeHtml} constructed from a trusted string, i.e., without * escaping the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the {@link SafeHtml} contract. * * @param s the input String * @return a {@link SafeHtml} instance */ public static SafeHtml fromTrustedString(String s) { return new SafeHtmlString(s); }
/** * Returns a {@link SafeHtml} constructed from a trusted string, i.e., without * escaping the string. No checks are performed. The calling code should be * carefully reviewed to ensure the argument meets the {@link SafeHtml} contract. * * @param s the input String * @return a {@link SafeHtml} instance */ public static SafeHtml fromTrustedString(String s) { return new SafeHtmlString(s); }
/** * Returns the safe HTML accumulated in the builder as a {@link SafeHtml}. * * @return a SafeHtml instance */ public SafeHtml toSafeHtml() { return new SafeHtmlString(sb.toString()); } }
/** * Returns the safe HTML accumulated in the builder as a {@link SafeHtml}. * * @return a SafeHtml instance */ public SafeHtml toSafeHtml() { return new SafeHtmlString(sb.toString()); } }
/** * Returns a {@link SafeHtml} containing the escaped string. * * @param s the input String * @return a {@link SafeHtml} instance */ public static SafeHtml fromString(String s) { return new SafeHtmlString(htmlEscape(s)); }
/** * Returns a {@link SafeHtml} containing the escaped string. * * @param s the input String * @return a {@link SafeHtml} instance */ public static SafeHtml fromString(String s) { return new SafeHtmlString(htmlEscape(s)); }
/** * HTML-sanitizes a string. * * <p> * The input string is processed as described above. The result of sanitizing * the string is guaranteed to be safe to use (with respect to XSS * vulnerabilities) in HTML contexts, and is returned as an instance of the * {@link SafeHtml} type. * * @param html the input String * @return a sanitized SafeHtml instance */ public static SafeHtml sanitizeHtml(String html) { if (html == null) { throw new NullPointerException("html is null"); } return new SafeHtmlString(simpleSanitize(html)); }
/** * HTML-sanitizes a string. * * <p> * The input string is processed as described above. The result of sanitizing * the string is guaranteed to be safe to use (with respect to XSS * vulnerabilities) in HTML contexts, and is returned as an instance of the * {@link SafeHtml} type. * * @param html the input String * @return a sanitized SafeHtml instance */ public static SafeHtml sanitizeHtml(String html) { if (html == null) { throw new NullPointerException("html is null"); } return new SafeHtmlString(simpleSanitize(html)); }
return new SafeHtmlString(s);
return new SafeHtmlString(s);