Calling WeaveLink from a URL
Previously starting Weave from a URL a new browser window would be created, or at best the current window would be reused but the session would be lost, but as of version 2.4 of the Weave interop bundle it's possible to open Weave using a URL and maintain the current user session.
To accomplish this a new launch page has been created which utilises the WeaveLink component, so that your page doesn't have to.
The "launch" page make use of the WeaveLink component to perform the actual work, so WeaveLink.dll and WeaveLinkImpl.exe still need to be installed on the client PC, but now rather than having to write javascript to talk to the WeaveLink COM API instead you can just open a new URL.
The launch page contains the javascript required to interoperate with the WeaveLink component and uses parameters passed in the URL to the launch page to determine what to do with the component.
The base URL of the launch page is /weave/interop/launch.html
and it requires at least three parameters title
, url
and event
.
The title
and url
parameters are the same values that would be used when getting a client reference with the WeaveLink COM API directly. That is, title
should be set to the browser window title of the running Weave client instance, so that the WeaveLink component can locate an all ready running Weave client instance. url
should be set to the URL required to start a new client instance of a running one can not be found using the title
parameter. And, event
should be set to the id of an interop action, for example com.cohga.ZoomSearch
, com.cohga.SetLocation
or com.cohga.SetMarker
. The rest of the parameters in the launch URL will be passed to the event as parameters to the event, so depending on the event being triggered different parameters will be required.
http://wrath.local:8080/weave/interop/launch.html?title=Weave%20Client&url=http://wrath.local:8080/weave/main.html&event=com.cohga.SetLocation&x=145.124&y=-32.412&scale=2000&marker=true
It should be noted that there are already way to launch a Weave client using URL parameters that accomplish the same thing, for example launching a client and performing a search to select an entity of interest, and for one off uses of Weave this can still work.
Where this method has an advantage is when there will be multiple interactions between your application and Weave. Using the above URL as an example if your application shows a list of items to the user and you wish to have a link for each item that the user can use to show a map of the item then you could do it using a standard Weave client link, but each client in your application will open a new browser window, by using the launch URL the current Weave browser window will be used and the existing map will just pan across to the new location and the users current ToC settings, active entity, selections, etc remain.
Obviously opening the launch page will cause a new browser page or tab to be opened, but this window will close as soon as it's either located the existing Weave browser instance or created a new one.
For an existing Weave instance this generally happens before the user even has a chance to register what's happening.
But, if there isn't an instance of the Weave client already running then this page may stay open for a few seconds, to account for this the page display some text describing to the user what's happening.