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, BDT Studio, the VS Code 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. Specify a working directory when the application loads supporting files using relative paths, such as resource files, images, or configuration files. See EM: Web - Applications for information about additional configuration options.
To run an app in the DWC client, select DWC-WebCUI App Enabled in the app’s registration. This option is selected by default 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 VS Code, 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-WebCUI 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 Studio
To register a DWC app with the BDT Studio, open the BBj program and click the "Run as DWC Program" toolbar button:![]()
For BBj 26.00 and higher, accessing the BDT plug-ins in the BDT Studio, a standalone application, supersedes using the Eclipse IDE.
This button registers the application, enables DWC deployment, and opens the app in a web browser with the default URL configuration.
Register with VS Code
BASIS also offers a BBj VS Code extension to facilitate BBj development. This extension 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 DWC-WebCUI button at the top of the app's configuration page to open a new browser window and launch the app.
If you are using BDT Studio or VS Code, 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.
After changing a BUI or DWC context mapping, save the change and restart the affected web context for the updated launch URL to take effect.
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-WebCUI App Enabled checkbox and navigate to the corresponding URL.
DWC Embedded Deployment
In BBj 21.13+, a published DWC app can be deployed by embedding it in a custom web page saved to basis/htdocs/:
|
The <script> line tells the /embeddwc/ servlet to start the DWC app named hello, adding it to the bbj-dwc div. This html file should be saved to the htdocs directory under the basis home directory; it can be accessed with a URL in the format http://localhost:8888/files/myhtml.html.
Note: DWC apps, like BUI apps, expect to be the only BASIS web app on a given web page. This deployment option can be used to add custom metadata to the <head> section of the web page, but it can't be used to run multiple DWC apps on a single web page. To run multiple DWC apps on a single web page, they should be loaded from <iframe> elements that link to the standard DWC app URL.
See Also
Dynamic Web Client (DWC) Overview
EM: App Deployment > Applications
Enterprise Manager: Context Configuration