Package org.owasp.html
Class CssSchema
- java.lang.Object
-
- org.owasp.html.CssSchema
-
public final class CssSchema extends Object
Describes the kinds of tokens a CSS property's value can safely contain.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CssSchema.Property
Describes how CSS interprets tokens after the ":" for a property.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>
allowedProperties()
The set of CSS properties allowed by this schema.static void
main(String... argv)
Dumps key and literal list to stdout for easy examination.static CssSchema
union(CssSchema... cssSchemas)
A schema that represents the union of the input schemas.static CssSchema
withProperties(Iterable<? extends String> propertyNames)
A schema that includes all and only the named properties.static CssSchema
withProperties(Map<? extends String,? extends CssSchema.Property> properties)
A schema that includes all and only the named properties.
-
-
-
Field Detail
-
DEFAULT
public static final CssSchema DEFAULT
A schema that includes only those properties on the default schema white-list.
-
-
Method Detail
-
withProperties
public static CssSchema withProperties(Iterable<? extends String> propertyNames)
A schema that includes all and only the named properties.- Parameters:
propertyNames
- a series of lower-case CSS property names that appear in the built-in CSS definitions. It is an error to mention an unknown property name. This class'smain
method will dump a list of known property names when run with zero arguments.
-
withProperties
public static CssSchema withProperties(Map<? extends String,? extends CssSchema.Property> properties)
A schema that includes all and only the named properties.- Parameters:
properties
- maps lower-case CSS property names to property objects.
-
union
public static CssSchema union(CssSchema... cssSchemas)
A schema that represents the union of the input schemas.- Returns:
- A schema that allows all and only CSS properties that are allowed by at least one of the inputs.
- Throws:
IllegalArgumentException
- if two schemas have properties with the same name, but different (per .equals)CssSchema.Property
values.
-
allowedProperties
public Set<String> allowedProperties()
The set of CSS properties allowed by this schema.- Returns:
- an immutable set.
-
main
public static void main(String... argv)
Dumps key and literal list to stdout for easy examination.
-
-