The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
Skip to content

How an application works

2612

This page describes the mechanism behind a Polarion Application. You do not need to understand all of it to build one, but it explains why the manifest, the SDK and the configuration XML look the way they do.

Architecture of a Polarion Application: the view runs in an iframe inside the Polarion page, talks to the host through the SDK and to the server through fetch

From ZIP to running page

  1. An administrator uploads the ZIP in Global Administration → Applications. Polarion validates the structure, reads manifest.json, computes a SHA-2 hash and shows the identity of the application for confirmation.

  2. Polarion unpacks the files and serves them from

    https://<polarion-host>/polarion/apps/<identifier>/
    

    Each view also gets a stable entry URL that resolves to the document configured for it:

    https://<polarion-host>/polarion/apps/<identifier>/views/<viewId>
    
  3. An administrator places the view in the Polarion UI. Form extensions and navigation topics are referenced from configuration XML with an <applicationView id="<identifier>.<viewId>"/> element. Sidebars need no configuration: they appear in the Show Sidebar menu as soon as the application is uploaded.

  4. When a user opens that place, Polarion creates an iframe pointing at the view URL. Your index.html loads, your JavaScript runs, and the page is shown inside the Polarion layout.

Inside the iframe

Because the view is served from the same origin as Polarion, the browser applies no cross-origin restrictions between your page and the host page. The iframe is a structural boundary, not a security boundary: a same-origin frame could reach into the parent document. Treat an application as code that runs with the user's privileges, install only applications you trust, and communicate with Polarion through the defined protocol rather than by reaching into the parent window.

The host bridge and the SDK

The Polarion page contains a small host bridge that listens for postMessage calls from application iframes. The Polarion Application SDK (polarion-app-sdk) wraps that protocol:

  • fetchContext() sends a get-context request and resolves with a PolarionContext: the application and view identifiers, the project, work item, space and document the view is embedded in, the initial selection, and the URLs and token you need for HTTP calls.
  • events.subscribe(EventTypes.SELECTION_CHANGED, callback) registers for host events. Polarion pushes a new list of selected work item identifiers whenever the selection in a table changes.
  • destroy() tears the bridge down when your view unmounts.

The protocol itself (message types such as polarion-view-bridge) is an implementation detail. Always go through the SDK rather than posting messages yourself.

First version of the SDK

The SDK API of Polarion 2612 is a first version and is subject to change, including the functions above. Changes will be announced with the release that brings them, together with clear migration steps.

HTTP calls

Everything else is ordinary fetch():

TargetURLAuthentication
Polarion REST APIcontext.restBaseUrl + /projects/…Header X-Polarion-REST-Token: <context.restToken>
Your own endpointscontext.appEndpoint + /<urlPath>Required X-Polarion-REST-Token header; no session authentication
Your own static filesrelative URLs inside the view folderPolarion session

The token identifies the user who is logged in to Polarion. Every REST call and every server script runs with that user's permissions. See Security model.

Server scripts

A server script is a JavaScript file in the server-scripts/ folder of the package, mapped to an HTTP method and path in the manifest. Polarion executes it with GraalVM on the server when the endpoint is called. The script receives the request parameters through an arguments object and gets the Polarion Java API through context.scriptContext(). Whatever object the script evaluates to is returned to the caller as JSON, wrapped in a small envelope.

Server scripts are optional. Many applications only need the REST API. Reach for a script when you need to aggregate across many objects in one round trip, walk link structures, or use an API that REST does not expose. See Your own REST endpoints.

Life cycle of a view

  1. Polarion creates the iframe and loads index.html.
  2. Your code calls fetchContext() and renders.
  3. Optionally your code subscribes to events and keeps rendering as they arrive.
  4. When the user navigates away, the iframe is destroyed. Call destroy() from your framework's unmount hook so pending requests and subscriptions are cleaned up; this matters mostly during local development with hot reloading.

Views are stateless from Polarion's point of view. If you need to persist data, use work item fields, custom fields, comments or attachments through the REST API, or an external service of your own.

Session Expiry and Reload Behavior

When a user's session expires and they log back in, the Polarion Application frame reloads automatically. (All unsaved changes within the application view are lost.)