Try OpenEdge Now
skip to main content
Configuration
Configuring third-party Web applications : OpenEdge Management REST API framework : Configuring a third-party Web application
 

Configuring a third-party Web application

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:
Table 123. WEB-INF/web.xml
<servlet>
    <servlet-name>RestServlet</servlet-name>
    <servlet-class>com.progress.fathom.FathomAPIServlet</servlet-class>
    <init-param>
        <param-name>configuration</param-name>
        <param-value>/WEB-INF/restconfig.xml</param-value>
    </init-param>
            <init-param>
        <param-name>urlprefix</param-name>
        <param-value>/rest</param-value>
    </init-param>
     
    <multipart-config>
    </multipart-config>
</servlet>
<servlet-mapping>
    <servlet-name>RestServlet</servlet-name>
    <url-pattern>/rest/*</url-pattern>
</servlet-mapping>
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>