Operation

This document covers the following topics:


Deploying Web Application with Liberty

The following are some specific configurations for Liberty if you want to deploy the Natural OpenAPI Web application with your own Liberty.

Deploying War File

The NaturalOpenAPIServer.war must be copied to the /config/apps/ directory.

Configuring Server.XML

The following configuration should be added to the Liberty server.xml file to deploy the Natural OpenAPI Server.

In addition, the SPRING_CONFIG_LOCATION environment variable must be configured to point to the location of the application.properties file.

<?xml version="1.0" encoding="UTF-8"?>
                <server description="Natural _OpenAPI">
                
                <featureManager>
                <feature>servlet-6.0</feature>
                <feature>mpConfig-3.1</feature>
                </featureManager>
                
                <httpEndpoint id="defaultHttpEndpoint" httpPort="9080" httpsPort="9443"/>
                
                <!--
                appProperties is Liberty's per-application config mechanism: values here
                are scoped strictly to the <webApplication> that declares them and are
                exposed through MicroProfile Config - MpConfigEnvironmentInitializer in
                the app reads them from there.
                -->
                <webApplication id="app1" name="app1" location="/config/apps/NaturalOpenAPIServer.war" contextRoot="/app1">
                <appProperties>
                <property name="SPRING_CONFIG_LOCATION" value="file:///config/application.properties"/>
                </appProperties>
                </webApplication>
                </server>

Deploying OpenAPI Resources

To deploy the services described in the Developer Overview > Generating OpenAPI Resources section, the Natural OpenAPI Server must be configured with the location of the service files.

The service file location can be configured in the following ways:

  • Using natural.integration.services.directory – Set this property in the application.properties file to specify the directory containing the service files. Place the service files in the specified directory.

  • Using natural.integration.services.files – Set this property to specify the names of the specific service files to be deployed. The specified files must be located in the classpath of the application.

When the Natural OpenAPI Server starts, it loads the configured service files and registers the OpenAPI services defined in those files.

Each service file contains the definition and mapping information required to expose a Natural subprogram as a REST API service. Once the server has successfully started, all services defined in the loaded service files are available to clients through the Natural OpenAPI Server. For more information, see the management.endpoints.web.exposure.include parameter in the General Configuration section.

Adding or modifying a service therefore requires updating the corresponding service file and restarting the server or using the reload actuator endpoint for the changes to be loaded and the services to become available.