The REST API framework in OpenEdge is built on the standard JAVA servlet framework. The code for the REST API framework is built into the fathom.jar file and is available to third-party Web applications. The servlet receives its configuration from an XML file which specifies the classes that are to be scanned for annotations.
Note: The servlet must be defined in the Java Web application web.xml file.
An example of REST servlet definition and configuration in an XML file is provided in Table 3:
The file format of the configuration XML file is simple. The file can define any number of implementations. Each <fathomapi/> node defines the fully qualified name of a class that extends the FathomAPIServletHandler class. To handle URL mapping and request access to a context, the derived class must inherit from the FathomAPIServletHandler class.
The XML file specifies the classes that are to be scanned for annotations to map them to URLs. Servlet mapping is defined in the web.xml file and all the URLs in the classes are made available for mapping by the Java servlet beneath this servlet mapping. In the above example, all the URLs mapped from the classes are made available beneath /<webcontextpath/rest/.
An example of a complete restconfig.xml file is provided in Table 4:
Table 124. WEB-INF/restconfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<fathomapis>
<fathomapi>
<!-- this is optional. This provides standard /api human readable content -->
<class>com.progress.fathom.api.OEMAPI</class>
</fathomapi>
<fathomapi>
<!-- simple example that shows how to consume and generate JSON content via REST API -->
<class>com.progress.fathom.sample.webapp.RestExample</class>
</fathomapi>
</fathomapis>