Scripting - Custom development
Using script in custom developement
When using scripting in other objects (user defined objects), you can not only use java scripts, you can also use Groovy, Ruby or JPython, if you like. You can use inline scripts and script saved on your file system.
Scripts always start with the <myesb:script> tag. Selecting the language can be done vai the attribute lang=
<!-- javascript on file system -->
<myesb:script
id="testjavascript"
lang="javascript"
location="file:/temp/testjavascript.js"
refresh-check-delay="2000"
/>
You can also add variables to the script. You do that, by adding a placeholder into the script, like this: <myesb:scriptvar name=”foo” value=”${placeholder}”/>
<!-- inline groovy script will replace > and < and add a property via a scriptvar -->
<myesb:script lang="groovy" id="testscript1" messagepart="msgprt0">
<myesb:scriptvar name="scriptvar1" value="Hello from inline groovy script via scriptvar"/>
<![CDATA[
properties.put("ScriptProperty",scriptvar1);
return
msgprt.getContent().replace("<","<").replace(">",">");
]]>
</myesb:script>