Deploying the REST gateway

[Version 8.6 and later] You can deploy and configure the REST gateway for WebSphere® eXtreme Scale in WebSphere Application Server or in a Liberty profile server.

Before you begin

Verify that a Liberty profile server is created. For more information, see Installing the Liberty profile.

About this task

The REST gateway is a servlet that is defined in the wxsRESTGateway.war web archive (WAR) file. With this REST gateway, you use a Uniform Resource Identifier (URI) to access data in the data grid.

Procedure

  1. Enable the REST gateway feature by either manually editing the server.xml file or by using the Liberty Profile Developer Tools.
    • Enable the REST gateway in the Liberty profile server.xml file.
      <featureManager>
        <feature>eXtremeScale.rest-1.1</feature>
      </featureManager>
    • Enable the REST gateway in the Liberty profile server.xml file using Liberty Profile Developer Tools.
      • Start IBM®WebSphere Application Server Version 8.6 Liberty Profile Developer Tools. For more information, see Scenario: Running grid servers in the Liberty profile using Eclipse tools.
      • In the Design tab, select Feature Manager. Click Add in the Feature Manager Details section. Select and add the eXtremeScale.rest-1.1 feature.
      • With the Feature Manager selected, click Add in the Feature Manager Details section. Select and add the servlet-3.0 feature.
      • Save the server.xml file.
    • Enable the REST gateway in WebSphere Application Server. You can override the default behavior by modifying the wxsRestGateway.properties file in the REST gateway.
  2. Configure the REST gateway.
    1. Configure the REST gateway in the server.xml file. Enter the following line of code:
      <xsREST contextRoot=”myContextRoot” remoteDomain=”myDomain”/>
      Attention: The attributes, contextRoot and remoteDomain, are optional. The default content root is resources.
    2. Optional: To override the server ObjectGrid definition, specify the following attribute in the <xsREST> tag:
      xsREST contextRoot="wxs.web.rest" objectGridClientXML="overrideXML"
    3. Configure an eXtreme Scale server. For more information, see Configuring eXtreme Scale servers to run in the Liberty profile.
    4. Configure a container service.
      The following options are available to configure a container service:
      • Copy a valid objectgrid.xml file (with or without an accompanying objectGridDeployment.xml file) into the wlp_home/usr/servers/server_name/grids directory. This grids directory is monitored by the product at run time. Changes to files in this directory initiate events in the Liberty profile runtime environment. For example, when new objectgrid.xml, objectGridDeployment.xml, or both files are found, a new container server is created. When one of these files are deleted, eXtreme Scale stops that container server. When files are modified, eXtreme Scale stops and restarts the container. Multiple shard containers can exist in the same eXtreme Scale server, which requires that subdirectories exist inside the grids directory.
      • Install an eXtreme Scale bundle. This bundle must reference a blueprint.xml file that contains server metadata. This method of starting a server is similar to how you can start servers in OSGi environments in WebSphere eXtreme Scale Version 7.1.1, without the Liberty profile. In Version 8.5, the server element is no longer required in the blueprint.xml file. Therefore, you must define the server metadata in the server.xml file. Install and start bundles by dragging and dropping them into the grids directory in the same way that you drop XML files in the grids directory.
      • Use the embedded server API. This option is similar to the process for starting the server in a stand-alone environment. With the Liberty profile, however, you must ensure that you run your code to start the eXtreme Scale server.

      For more information, see Starting and stopping servers in the Liberty profile.

  3. Start the Liberty profile server to run the REST client gateway.

What to do next

When the REST gateway is enabled, anyone with access to the servlet can access data in a data grid. Therefore, you must use web application security in WebSphere Application Server to control authorization. For more information about securing your web applications that use this REST gateway, see Securing web applications in the WebSphere Application Server Information Center.

The wxsRESTGateway.war file, which contains the web.xml file for the security configuration is in the following locations, depending on your installation:
  • wlp_install_root/wxs/web/rest
  • was_install_root/optionalLibraries/ObjectGrid/restgateway
  • wxs_standalone_install_root/ObjectGrid/restgateway

You can now begin using the REST data service in the Liberty profile to communicate with the data grid through a URI. For more information, see Developing data grid applications with the REST gateway.