Create the Embedded Gateway Object
This procedure describes how to create Gateway objects within your Java program.
Before You Begin
This procedure is part of Checklist: Embed Kaazing WebSocket Gateway in Your Java Application:
- Set Up Your Development Environment
- Create the Embedded Gateway Object
- Use the Embedded Gateway Methods
- Configure Logging for an Embedded Gateway
- Monitor and Manage an Embedded Gateway
- Troubleshoot Your Embedded Gateway
To Create an Embedded Gateway Object
- Import the embedded Gateway class into your Java application:
import com.kaazing.gateway.server.GatewayFactory; import com.kaazing.gateway.server.Gateway;
- Create the embedded Gateway using the following publicly available static method:
GatewayFactory.createGateway();
Example
The following example demonstrates how you can embed the Gateway:
import com.kaazing.gateway.server.GatewayFactory; import com.kaazing.gateway.server.Gateway; public class GatewayTest { private Gateway gw; public GatewayTest() { gw = GatewayFactory.createGateway(); } }