URI Broker - 1000TurquoisePogs/zlux GitHub Wiki
The URI Broker is an object in the App web framework which facilitates calls to the App server by constructing URIs utilizing the context from the calling App.
Accessing the URI Broker
This object is accessible independent of other frameworks involved such as Angular, and is even accessible via iframe. This is because it is hung off of a global when within the Virtual Desktop. Access the URI Broker via one of two locations:
Natively
window.ZoweZLUX.uriBroker
In an iframe
window.parent.ZoweZLUX.uriBroker
Functions
The URI Broker builds different categories of URIs depending upon what the App wishes to call. Each category is listed below.
Accessing App's Dataservices
Dataservices can be either based on HTTP (REST) or Websocket.
HTTP Dataservice URI
pluginRESTUri(plugin:ZLUX.Plugin, serviceName: string, relativePath:string): string
Returns: A URI for making an HTTP service request
Websocket Dataservice URI
pluginWSUri(plugin: ZLUX.Plugin, serviceName:string, relativePath:string): string
Returns: A URI for making a Websocket connection to the service
Accessing App's Configuration Resources
Defaults and user storage may exist for an App such that they can be retrieved via the Configuration Dataservice. There are different scopes and actions to take with this service, and therefore there are a few URIs that can be built:
Standard Configuration Access
pluginConfigUri(pluginDefinition: ZLUX.Plugin, resourcePath:string, resourceName?:string): string
Returns: A URI for accessing the requested resource under the user's storage.
Scoped Configuration Access
pluginConfigForScopeUri(pluginDefinition: ZLUX.Plugin, scope: string, resourcePath:string, resourceName?:string): string
Returns: A URI for accessing a specific scope for a given resource.
Accessing Static Content
Content under an App's web directory is static content accessible by a browser. This can be accessed via:
pluginResourceUri(pluginDefinition: ZLUX.Plugin, relativePath: string): string
Returns: A URI for getting static content
Accessing the App's Root
Static content and services are accessed off of the root URI of an App. If there are other points that you need to access on that App, you can get the root:
pluginRootUri(pluginDefinition: ZLUX.Plugin): string
Returns: A URI to the root of the App.
Server Queries
A client can find different information about a server's configuration or the configuration as seen by the current user by accessing specific APIs.
Accessing List of Plugins
pluginListUri(pluginType: ZLUX.PluginType): string
Returns: A URI which when accessed will return the list of existing Plugins on the server by the type specified, such as "Application" or "all".