Hi All, Current script mediator use Rhino as its JavaScript engine and we are in the process of upgrading the script mediator to use new Nashorn engine. So we will be providing the capability of using Rhino as javascript engine for java 7 users and Nashorn for java 8 users in script mediator. But in the process we have found some issues and solved them. Such as when trying to set Json payload the existing Rhino engine will use its native objects to pass Json payload so in existing script mediator it use different serialization techniques for each Rhino native object type. But in Nashorn the passed object will be always ScriptObjectMirror type. We have overcome this issue by serializing these objects using serialization functionality of Nashorn native "JSON" object. So when handling the Json payloads the used engine will not be an issue. But the main issue was usage of E4X xml objects when handling xml payloads with Rhino engine. Because as stated in[1] E4X is deprecated and it does not supported by Nashorn engine. To overcome this when using Nashorn, DOMparser can be used to parse xml strings rather than using xml objects. But then the users who are using script mediator with new Nashorn engine will not be able to use xml objects in javascript but they will be able to use setPayloadXML and getPayloadXML methods in script mediator by using string representations of xml. So the decision we need to make is whether to use existing mediator with Nashorn engine support but without using E4X(which is deprecated but still using Rhino engine it will be supported) or writing new mediator separately for javascript with Nashorn engine support.
[1] https://developer.mozilla.org/en-US/docs/Archive/Web/E4X/Processing_XML_with_E4X Thanks, -- Malaka. -- Malaka Gangananda - Software Engineer | WSO2 Email : [email protected] Mobile : +94713564340 <+94%2071%20356%204340> Web : http://wso2.com <http://wso2.com/signature>
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
