Skip to main content
Skip Navigation LinksHome  Extending the Spotfire Platform  Architecture  Web Architecture

©Spotfire 2011

Web Architecture

The Web Player JavaScript API integrates solutions with the Spotfire Web Player. It enables event handling, data data marking and filter manipulation.

Overview

The Web Player JavaScript API enables integration of Web Player solutions into a web environment:

  • Receive events from interaction in an analysis that is open in the Web Player.
  • Interact programmatically with the Web Player in terms of making markings or changing filters.

See also the following pages:

  • The Web Document
    The web document is a node tree on the server. When rendered, it translates the document model into a rendered web document that can be visualized in a web browser.
  • The Client Communication Engine
    The Client Communication Engine enbables the client side web control to send control signals to its server side. If the signal changes any web control, the server responds with one or more change objects. The Client Communication Engine updates the client UI accordingly.
  • Installing and Configuring the JavaScript API
    Before the Web Player JavaScript API can be used to create mashups, the Web Player must be installed and configured to enable the JavaScript API.
  • Mashup Development with Multiple Servers
    JavaScript in mashup calls from the same server as the Web Player does not compromise domain security. If the mashup and the Web Player reside on different servers, attention to domain attributes is essential.

Restrictions

The Java Script API on a Web Player cannot be combined with Forms Authentication. For security reasons there is no way for a user to login using the API.

The API accesses the Web Player on browser (JavaScript) level. Server (C#) side objects cannot be accessed directly.

API Layers

Referring to the graphic below, the Api.js JavaScript file for the public API is referenced through a web handler. It is generated from a template that contains stubs for the public API.
The public API is connected to the server side script nodes via generated JavaScript proxy scripts. The stubs in the public API template are filled with the proxy script implementation by the corresponding server side script node.

Web Player Architecture

The blue layer indicates the implementation created by the API user. The red layer is a proxy for communication between the mashup and the displayed Web Player. It will forward API calls from the mashup, via the Web Player Ajax Service, to the Web Player backend. The green layer, finally, represents the Web Player backend.

Mashup Page

Api.js Script Proxy
The Api.js file is the public JavaScript API. Developers use it to integrate with the Web Player. It is downloaded to the client browser by the GetJavaScriptApi.ashx web handler. This service takes the version number as parameter. Debug information may optionally be included.
Technically, the server generates the file by merging a JavaScript template with proxy script code produced by the script nodes.
The proxy script code glues the public API functions to the server side operations executing the client call. The initial proxy scripts are generated from Api.js and the OpenProxy.aspx page.
When a Web Player Application object is created, an invisible IFRAME holding the OpenProxy.aspx page is also created. It is used to open and display the Web Player when an analysis is loaded via the public API.

Script Nodes

The script node tree is located under DocumentWebControl, the root node of the web document. The difference between the script nodes and existing nodes is that they only generate JavaScript code to interact with the Web Player, and no UI elements.

The server side script node loads the analysis and creates the missing proxy script code. OpenProxy.aspx creates a new IFRAME holding the analysis, ViewAnalysis.aspx, in the <div> element of the Mashup.html page.

The script node classes make up a new branch of the web document tree. They all inherit from the same base class. They will not be created when the web document loads unless the JavaScript API is enabled. It is disabled by default, and must be enabled by setting the javaScriptApi configuration value:

<spotfire.dxp.web>
    <setup>
        <javaScriptApi enabled="true" />
        ...
    </setup>
    ...
</spotfire.dxp.web>