web stats
JavaScript of Java? - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Thread Tools Display Modes
Old 04-18-2012, 03:52 PM
gfletcher gfletcher is offline
Mirth Newb
Join Date: May 2011
Posts: 13
gfletcher is on a distinguished road
Default JavaScript of Java?


What kind of code are you supposed to use when writing scripts in a javascript transformer? Is it Java or JavaScript?

It looks like mostly JavaScript, but it looks like there are some Java functions that work, too. Like Java.Io.

Thank you,

Reply With Quote
Old 04-18-2012, 05:18 PM
narupley's Avatar
narupley narupley is online now
Mirth Employee
Join Date: Oct 2010
Posts: 7,123
narupley is on a distinguished road

In a transformer (or any other place you can do scripting in Mirth Connect), you're working within a Mozilla Rhino context (hence ECMAScript/JavaScript). The reason you're able to use Java classes is that Rhino provides you with various top-level objects that you can use to load Java objects into the JavaScript context. Packages is the main object that contains all of the Java packages currently included in your VM (java, com, org, etc.). For convenience, Rhino also includes the most common of these packages as top-level variables as well, so referencing "java" is the same as referencing "Packages.java".

There are actually many many more, surprisingly powerful, things you can do from within Rhino, from directly implementing Java interfaces and spawning new threads, to creating entire GUI applications complete with event listeners...
Reply With Quote

java javascript

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -8. The time now is 07:44 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation