The Rhapsody Java API allows API clients to create and manipulate embedded WebViews displayed as Rhapsody tabbed views.
A WebView can be created using:
long handle = application.createEmbeddedWebViewWindow(
url,
"TabbedView",
"");
The returned handle can then be used with the existing APIs:
application.isValidWebView(handle);
application.getWebViewURL(handle);
application.setWebViewURL(handle, url);
However, there is currently no documented and supported API for closing or destroying the specific WebView identified by this handle. According to IBM Support, the view can currently be closed only manually through the Rhapsody graphical interface.
Requested enhancement
Provide a supported Java API for closing the embedded WebView associated with the handle returned by "createEmbeddedWebViewWindow()".
For example:
boolean closeEmbeddedWebViewWindow(long handle);
or:
boolean closeWebView(long handle);
Expected behavior
- Close only the embedded WebView identified by the supplied handle.
- Do not affect other Rhapsody tabs or WebViews.
- Return a documented success or failure result.
- Handle invalid or already-closed identifiers safely.
- After successful closure, "isValidWebView(handle)" should return "false".
- Release the resources associated with the closed WebView.
- Work with WebViews created using the supported container types, including "TabbedView".
- Be safe to invoke through the Rhapsody Java API without requiring native Windows operations.
- Document the threading and lifecycle requirements of the operation.
- Provide a minimal Java usage example.
Example usage
long handle = application.createEmbeddedWebViewWindow(
url,
"TabbedView",
"");
if (application.isValidWebView(handle)) {
boolean closed = application.closeEmbeddedWebViewWindow(handle);
if (!closed) {
// Handle the documented failure condition.
}
}
Business impact
Applications integrated with Rhapsody may need to manage the complete lifecycle of the embedded WebViews they create. The existing API supports creation, validation and navigation, but not closure.
Without a supported close operation:
- obsolete or duplicate views can remain open;
- users must manually close views created programmatically;
- an integration cannot guarantee that only the relevant view remains active;
- application state and the Rhapsody user interface can become inconsistent;
- resources associated with unused WebViews cannot be released explicitly;
- integrations may be tempted to rely on unsupported native-window manipulation, which is unsafe and version-dependent.
A supported close API would enable reliable lifecycle management, improve the user experience and avoid unsupported operating-system-level workarounds.
Current workaround
The application must display a prominent instruction asking the user to close the Rhapsody tab manually. This workaround is error-prone and cannot guarantee that the view is actually closed.
Support case conclusion
IBM Support confirmed that Rhapsody 10.0.2 currently provides only the GUI option for closing a WebView created through the API and recommended submitting an enhancement request.