Examples of SanitizedContent


Examples of com.google.template.soy.data.SanitizedContent

  }


  @Override public SoyData apply(SoyData value, List<SoyData> args) {
    if (value instanceof SanitizedContent) {
      SanitizedContent sanitizedContent = (SanitizedContent) value;
      if (sanitizedContent.getContentKind() == SanitizedContent.ContentKind.HTML) {
        return value;
      }
    }
    return SoyData.createFromExistingData(
        EscapingConventions.EscapeHtml.INSTANCE.escape(value.toString()));
View Full Code Here

Examples of com.google.template.soy.data.SanitizedContent

  /**
   * Creates an empty string constant.
   */
  public static SanitizedContent emptyString(ContentKind kind) throws IOException {
    return new SanitizedContent("", kind);
  }
View Full Code Here

Examples of com.google.template.soy.data.SanitizedContent

   */
  public static SanitizedContent fromResource(
      Class<?> contextClass, String resourceName, Charset charset, ContentKind kind)
      throws IOException {
    pretendValidateResource(resourceName, kind);
    return new SanitizedContent(
        Resources.toString(Resources.getResource(contextClass, resourceName), charset), kind);
  }
View Full Code Here

Examples of com.google.template.soy.data.SanitizedContent

    assertTofuOutput("", "", escapeHtmlDirective);
    assertTofuOutput("a&amp;b &gt; c", "a&b > c", escapeHtmlDirective);
    assertTofuOutput(
        "&lt;script&gt;alert(&#39;boo&#39;);&lt;/script&gt;",
        "<script>alert('boo');</script>", escapeHtmlDirective);
    SanitizedContent fooTagHtml =
        UnsafeSanitizedContentOrdainer.ordainAsSafe("<foo>", SanitizedContent.ContentKind.HTML);
    assertTofuOutput(
        fooTagHtml,
        // Sanitized HTML is not escaped.
        fooTagHtml,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.