org.thymeleaf
Class DOMExecution

Object
  extended by org.thymeleaf.DOMExecution

public final class DOMExecution
extends Object

This class manages a couple of flags used for indicating that a node in the template DOM (or the whole tree of nodes below it) has no reason to be executed (either because it should not be executed to avoid issues like code injection, or because we can assure there are no processors in any of the dialects that can be applied to it).

Among other uses, these flags are set into Text nodes that are created during template processing. The presence of this flag disallows the execution of text inlining on nodes already generated from template code, effectively avoiding code injection.

These flags are set as Node user data using the (Node.setUserData(String, Object, org.w3c.dom.UserDataHandler)) method.

This class should only be directly used when creating custom processors/dialects.

Since:
1.1
Author:
Daniel Fernández

Nested Class Summary
static class DOMExecution.NonExecutableNodeHandler
           
static class DOMExecution.NonExecutableTreeHandler
           
 
Method Summary
static void clearExecutabilityFlags(Node node)
           
static boolean isExecutableNode(Node node)
           Returns whether a node has any of the executable flags (either the node-specific one or the tree-wide one).
static boolean isExecutableTree(Node node)
           Returns whether a node has the executable tree flag set, which means that neither this node is executable nor any of its children.
static void setExecutableNode(Node node, boolean executable)
           Sets or cleans the flag indicating a node should not be executed.
static void setExecutableTree(Node node, boolean executable)
           Sets or cleans the flag indicating neither the node nor any of its children should not be executed.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isExecutableNode

public static boolean isExecutableNode(Node node)

Returns whether a node has any of the executable flags (either the node-specific one or the tree-wide one).

Parameters:
node - the node to be queried.
Returns:
true if the node is executable, false if not (has any of the flags set).

isExecutableTree

public static boolean isExecutableTree(Node node)

Returns whether a node has the executable tree flag set, which means that neither this node is executable nor any of its children.

Parameters:
node - the node to be queried.
Returns:
true if the node and its children are executable, false if not.

setExecutableNode

public static void setExecutableNode(Node node,
                                     boolean executable)

Sets or cleans the flag indicating a node should not be executed. This flag has no influence in the execution of this node's children.

Parameters:
node - the node to be applied the flag.
executable - whether the node should be considered executable (clean the flag) of non-executable (set the flag).

setExecutableTree

public static void setExecutableTree(Node node,
                                     boolean executable)

Sets or cleans the flag indicating neither the node nor any of its children should not be executed.

Parameters:
node - the node to be applied the flag.
executable - whether the node should be considered executable (clean the flag) of non-executable (set the flag).

clearExecutabilityFlags

public static void clearExecutabilityFlags(Node node)


Copyright © 2012 The THYMELEAF team. All Rights Reserved.