Configuring JavaScript Programs
Use the following statement to configure a JavaScript program for the SRC VTA:
From configuration mode, access the statement that configures a JavaScript script and specify the name of the JavaScript program. For example, to configure a JavaScript script called js1:
[edit]user@host# edit shared vta group vta1 processor scripts javascript js1Specify a function body in JavaScript.
[edit shared vta group vta1 processor scripts javascript js1]user@host# set script scriptTo refer to the event attributes being processed, include the attribute name delimited by angle brackets (<and>). The JavaScript program can verify whether the event has the referenced attribute. If a referenced attribute does not exist in the event, the attribute’s value is null. The JavaScript program must return a value.
(Optional) Specify the Java type of the return attribute.
[edit shared vta group vta1 processor scripts javascript js1]user@host# set return-type return-typeWhere the return-type is one of the following:
Integer
Long
Float
Double
String
Boolean
(Optional) Specify the name of the return attribute.
[edit shared vta group vta1 processor scripts javascript js1]user@host# set return-attribute return-attributeSpecify an attribute that provides the return value of the script as a valid Java identifier that subsequent actions and event handlers can refer to. If this attribute is not set, the return value is not added to the event as an event attribute.
JavaScript scripts must return an attribute value. The name of a return attribute cannot start with an underscore (_) because these event attributes are reserved for internal use.