Convertigo Public Knowledge base

Add custom Java class to a back end project

Custom Java classes can be added to a project as JAR files in the <project>/libs or <workspace>/libs folders.

You can already use the native Java 1.8 classes in a SequenceJS step.

var md5 = use("org.apache.commons.codec.digest.DigestUtils.md5hex"); log.message("md5: " + md5("hello world"));

The use can be used to load a native Java function and speedup the loading of this function for next calls.

The idea is to share memory between multiple request, cross sessions.
This can be useful in some case, to keep global object or function.

var myfun = project.get("myfun"); if (myfun == null) { myfun = function (a, b) { return a + b; } project.set("myfun", myfun); } myfun(1, 2);

The server object works like project but global to the server.

See more details here

(c) Convertigo 2023