You can deploy and configure the REST
gateway for the data grid in WebSphere® Application Server or in a Liberty profile server.
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
- Enable the REST gateway feature by either manually editing
the server.xml file or by using the Liberty Profile
Developer Tools.
- Configure the REST gateway.
- 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.
- Configure an eXtreme Scale server.
- 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.
- 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.