27 Deploying Coherence REST
This chapter includes the following sections:
- Deploying with the Embedded HTTP Server
Coherence provides multiple embedded HTTP server implementations that can be used to host RESTful Web services. - Deploying to WebLogic Server
WebLogic Server includes a Coherence integration that standardizes the way Coherence applications are packaged, deployed, and managed within a WebLogic Server domain. Coherence REST must follow the integration standards. - Deploying to a Java EE Server (Generic)
Coherence REST can be deployed to any standard Java EE environment. - Configuring REST Server Access to POF-Enabled Services
POF-enabled services must include the defined Coherence REST POF user types.
Parent topic: Using Coherence REST
Deploying with the Embedded HTTP Server
-
DefaultHttpServer
(backed by Oracle's lightweight HTTP server) -
NettyHttpServer
(backed by Netty HTTP server and recommended for production) -
SimpleHttpServer
(backed by Simple HTTP server) -
JettyHttpServer
(backed by Jetty HTTP server) -
GrizzlyHttpServer
(backed by Grizzly HTTP server)
The HTTP server must be enabled on a Coherence proxy server. To enable the HTTP server, edit the proxy's cache configuration file and add an <http-acceptor>
element, within the <proxy-scheme>
element, and include the host and port for the HTTP server. The <address>
element also supports external NAT addresses that route to local addresses; however, both addresses must use the same port number.
The following example configures the HTTP server to accept requests on localhost 127.0.0.1
and port 8080
. The example explicitly defines the HTTP server class and Jersey resource configuration class and uses /
as the context path for the Coherence REST application. However; these are default values and need not be included. The context path can be changed as required and additional Coherence REST applications can be defined with different context paths. See http-acceptor in Developing Applications with Oracle Coherence.
<proxy-scheme> <service-name>ExtendHttpProxyService</service-name> <acceptor-config> <http-acceptor> <class-name> com.tangosol.coherence.rest.server.DefaultHttpServer</class-name> <local-address> <address>127.0.0.1</address> <port>8080</port> </local-address> <resource-config> <context-path>/</context-path> <instance> <class-name> com.tangosol.coherence.rest.server.DefaultResourceConfig </class-name> </instance> </resource-config> </http-acceptor> </acceptor-config> <autostart>true</autostart> </proxy-scheme>
If you are using POF, make sure that the pof-config.xml
file includes the location of the REST POF types. See Configuring REST Server Access to POF-Enabled Services.
Parent topic: Deploying Coherence REST
Deploying to WebLogic Server
This section includes the following topics:
- Task 1: Configure a WebLogic Server Domain for Coherence REST
- Task 2: Package the Coherence REST Web Application
- Task 3: Package the Coherence Application
- Task 4: Package the Enterprise Application
- Task 5: Deploy the Enterprise Application
Parent topic: Deploying Coherence REST
Task 1: Configure a WebLogic Server Domain for Coherence REST
Create a managed Coherence server in your WebLogic Server domain that will host Coherence REST. The server should be configured as a storage disabled member of a Coherence cluster. If more than one managed Coherence server is required for a Coherence REST solution, then the servers should be managed as a tier in a WebLogic Server cluster. See Setting Up a Coherence Cluster in Administering Clusters for Oracle WebLogic Server.
Parent topic: Deploying to WebLogic Server
Task 2: Package the Coherence REST Web Application
To package the Coherence REST Web application:
Parent topic: Deploying to WebLogic Server
Task 3: Package the Coherence Application
To package the Coherence application:
Parent topic: Deploying to WebLogic Server
Task 4: Package the Enterprise Application
To package the enterprise application:
Parent topic: Deploying to WebLogic Server
Task 5: Deploy the Enterprise Application
To deploy the Enterprise application:
- Use the WebLogic Server Administration Console or WLST tool to deploy the EAR to the managed Coherence server created in Task 1.
- From a browser, verify the deployment by navigating to the managed Coherence server's listening port and include the cache name as part of the URL. For example:
http://
host
:
port
/rest/
{cacheName}
.
Parent topic: Deploying to WebLogic Server
Deploying to a Java EE Server (Generic)
This section includes the following topics:
Parent topic: Deploying Coherence REST
Packaging Coherence REST for Deployment
To package a Coherence REST application:
Parent topic: Deploying to a Java EE Server (Generic)
Deploying to a Servlet Container
Coherence REST can be deployed to any servlet container by packaging Coherence REST as a WAR file. See Packaging Coherence REST for Deployment. Refer to your vendors documentation for details on deploying WAR files. In addition, See the Jersey user guide for additional servlet container deployment options:
http://jersey.java.net/nonav/documentation/latest/user-guide.html#d4e194
Parent topic: Deploying to a Java EE Server (Generic)
Configuring REST Server Access to POF-Enabled Services
coherence-rest-pof-config.xml
file that is located in the coherence-rest.jar
library and is automatically loaded at runtime.
To configure the REST default user types, edit the pof-config.xml
file to include the coherence-rest-pof-config.xml
POF configuration file. For example:
<pof-config> <user-type-list> <include>coherence-pof-config.xml</include> <include>coherence-rest-pof-config.xml</include> ... </user-type-list> </pof-config>
Parent topic: Deploying Coherence REST