Registering and Launching a DWC App
This article covers the process of registering and launching an App in the Dynamic Web Client (DWC). For an overview of the DWC, see Dynamic Web Client (DWC) Overview.
To get started with a simple example, copy the following code into a file named hello.bbj in your development environment:
DWC Hello World Example
|
Registering a DWC App
To run a BBj Application in the DWC client, you must register it as a web app and enable DWC deployment. You can do this with the Enterprise Manager, the Eclipse BDT plugin, the VSCode BBj plugin, or by executing code with the BBj Admin API.
By registering an app, you provide BBj with all the information it needs to launch it in a browser, such as the program file and application name. The name is used to create a unique URL for your app, and the program file specifies the program to run. You can specify many additional configuration options, such as the working directory, configuration file, and context. See EM: Web - App Deployment for information about additional configuration options.
To run an app in the DWC client, you must enable DWC Web App Deployment in the app's registration. This is the default setting for new apps.
Regardless of what method you use to register your app, you can see all of your registered apps by navigating to Enterprise Manager > Web > App Deployment > Applications. When you launch an app as a BUI or DWC app through Eclipse or VSCode, an entry for that app appears in the table on this page, indicating that it has been registered.
Register with EM
To register a new application in the EM, go to Web > App Deployment > Applications. From there, you can create a new app by clicking the Add + button or update an existing app by double-clicking its entry in the Application list.
Fill in the Application Name and Program File fields located at the top of the page, check the DWC Web App Enabled checkbox located at the bottom of the General section, and save the configuration.
For more information about the various configuration options, see EM: Web - App Deployment.
Register with BDT
To register a DWC app in Eclipse with the BDT, open your BBj program in Eclipse and deploy it as a DWC app by clicking the "Run as DWC Program" button:
This button registers the application, enables DWC deployment, and opens the app in a web browser with the default URL configuration.
Register with VSCode
BASIS also offers a BBj VSCode plugin to facilitate BBj development. This plugin provides buttons to run an app in the DWC or BUI. Clicking either of these will register your application, enable DWC or BUI, and launch a web browser with the default URL configuration.
Register with Admin API
To register your app programmatically with the Admin API, you will need to create a BBjApplication from a BBjAppConfig, enable DWC deployment with BBjAppConfig::setDwcEnabled, and publish it to the BBjAppServer.
Launching a DWC App
Once an app is registered and DWC is enabled, anyone with the URL and access to the server can run the app in a browser on a computer or mobile device. To launch your app, simply navigate to the app's URL in a web browser.
If you registered your app with the Enterprise Manager, click the Launch in Browser (DWC) button at the top of the app's configuration page to open a new browser window and launch the app.
If you are using Eclipse or VSCode, the Run as DWC buttons register your app and launch it in a new browser window.
Deployment URLs
The deployment URL for a web app is based on the server, context, and app name, with the following format:
server:port/context/appname
The default context for DWC apps is webapp
, and the default context for BUI apps is apps
. If you deploy an app named MyApp locally with all the default settings, the URL for the DWC deployment will look like this:
localhost:8888/webapp/MyApp
You can change this URL structure for each context under Enterprise Manager > Web > Context Configuration.
You can see the deployment URLs for each of your apps in the EM at Web > App Deployment > Applications. Select an application by clicking it, and the Application Launch Details panel shows the enabled deployments and their respective URLs.
If you have an existing BUI app that you want to try running in the DWC, all you need to do is check the DWC App Enabled checkbox and navigate to the corresponding URL.