Compatible with Fusion version: 4.2.0 through 5.2.2
Deprecation and removal noticeThis connector is deprecated as of August 24, 2020 and is removed or expected to be removed as of May 18, 2022. Use the index pipeline for fetching content.For more information about deprecations and removals, including possible alternatives, see Deprecations and Removals.
String instead of java.lang.String, these classes must be imported.
The java.lang package is not imported by default, because its classes would conflict with Object, Boolean, Math, and other built-in JavaScript objects.
To import a Java class, use the JavaImporter object and the with statement, which limits the scope of the imported Java packages and classes.
Java.type API extension.
See this tutorial for details: http://winterbe.com/posts/2014/04/05/java8-nashorn-tutorial/
There is a known issue with JavaImporter that causes intermittent errors with patterns like with (imports) { } *. The preferred approach is Java.type().
A pattern that works well is:
Java.type() usage:
The JavaScript Program
The Javascript context provides the following variables:
The program must return one of the following kinds of objects:
If the JavaScript script is implemented as a function, the return statement must return one of the above types. If the script is not function-based, the last line in the script must evaluate to one of these object types.