com.google.template.soy.data
Enum SanitizedContent.ContentKind

java.lang.Object
  extended by java.lang.Enum<SanitizedContent.ContentKind>
      extended by com.google.template.soy.data.SanitizedContent.ContentKind
All Implemented Interfaces:
Serializable, Comparable<SanitizedContent.ContentKind>
Enclosing class:
SanitizedContent

public static enum SanitizedContent.ContentKind
extends Enum<SanitizedContent.ContentKind>

A kind of textual content.


Enum Constant Summary
ATTRIBUTES
          An attribute name and value, such as dir="ltr".
CSS
          A CSS3 declaration, property, value or group of semicolon separated declarations.
HTML
          A snippet of HTML that does not start or end inside a tag, comment, entity, or DOCTYPE; and that does not contain any executable code (JS, <object>s, etc.) from a different trust domain.
JS
          Executable Javascript code or expression, safe for insertion in a script-tag or event handler context, known to be free of any attacker-controlled scripts.
JS_STR_CHARS
          A sequence of code units that can appear between quotes (either single or double) in a JS program without causing a parse error, and without causing any side effects.
TEXT
          Unsanitized plain-text content.
URI
          A properly encoded portion of a URI.
 
Method Summary
static SanitizedContent.ContentKind valueOf(String name)
          Returns the enum constant of this type with the specified name.
static SanitizedContent.ContentKind[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

HTML

public static final SanitizedContent.ContentKind HTML
A snippet of HTML that does not start or end inside a tag, comment, entity, or DOCTYPE; and that does not contain any executable code (JS, <object>s, etc.) from a different trust domain.


JS

public static final SanitizedContent.ContentKind JS
Executable Javascript code or expression, safe for insertion in a script-tag or event handler context, known to be free of any attacker-controlled scripts. This can either be side-effect-free Javascript (such as JSON) or Javascript that entirely under Google's control.


JS_STR_CHARS

public static final SanitizedContent.ContentKind JS_STR_CHARS
A sequence of code units that can appear between quotes (either single or double) in a JS program without causing a parse error, and without causing any side effects.

The content should not contain unescaped quotes, newlines, or anything else that would cause parsing to fail or to cause a JS parser to finish the string it is parsing inside the content.

The content must also not end inside an escape sequence ; no partial octal escape sequences or odd number of '\'s at the end.


URI

public static final SanitizedContent.ContentKind URI
A properly encoded portion of a URI.


ATTRIBUTES

public static final SanitizedContent.ContentKind ATTRIBUTES
An attribute name and value, such as dir="ltr".


CSS

public static final SanitizedContent.ContentKind CSS
A CSS3 declaration, property, value or group of semicolon separated declarations.


TEXT

public static final SanitizedContent.ContentKind TEXT
Unsanitized plain-text content. This is effectively the "null" entry of this enum, and is sometimes used to explicitly mark content that should never be used unescaped. Since any string is safe to use as text, being of ContentKind.TEXT makes no guarantees about its safety in any other context such as HTML.

Method Detail

values

public static SanitizedContent.ContentKind[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (SanitizedContent.ContentKind c : SanitizedContent.ContentKind.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static SanitizedContent.ContentKind valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null