Adding User-Defined or Third-Party Java Classes for JavaScript Access
You can add user-defined Java classes or third party Java libraries directly to the classpath for the Presto Server. Simply copy them to one of these folders:
Important: | Deploying additional resources, such as custom XPath classes, to an external configuration folder simplifies future deployments or Presto Server clusters. |
web-apps-home/presto/WEB-INF/classes. This is the default location, but is not recommended as it complicates
Presto Server deployments.
web-apps-home/presto/WEB-INF/lib. This is the default location, but is not recommended as it complicates
Presto Server deployments.
Then, restart the Presto Server.
Directly adding classes is simple, but can make upgrades more complicated and does not allow you to use different versions of third party libraries than the Presto Server. To simplify migration or use specific versions of third party libraries, you add your user-define or third party classes and JARs to an application-scope folder.
To deploy classes in an application-scope
1. If needed, define a root folder for application scopes for the Presto Server.
The root folder for application scoping must reside in the same host as the Presto Server. The default root folder for application scoping is web-apps-home/apps but this can be any folder. To change this default:
a. Open the web-apps-home/presto/WEB-INF/classes/presto.config file for the Presto Server in any text editor.
b. Add the property jems.ext.applications.dir=folder-path with the absolute path to the folder you want to use as the root folder for all application scopes.
c. Save your changes.
2. Create a subfolder for your application directly under the application-scope root folder (see previous steps for more information).
3. Add your classes or JARs in this subfolder and restart the Presto Server.
4. Add application=your-application-subfolder to the <script> statement.