General Interface is an open source project hosted by the Dojo Foundation

URI Resolution

This section describes how URIs are resolved in General Interface. A Uniform Resource Identifier (URI) identifies or names a resource required by the application.

The URI functionality of General Interface has been updated to provide additional functionality and to simplify development. Project resources are now referenced by the project configuration file (config.xml) relative to the base directory of the project. Referencing resources in the configuration file allows you to rename and move project directories more easily.

Any relative URI that isn't of a legacy 3.1 format (beginning with JSX/ or JSXAPPS/) is resolved relative to a base URI that depends on the context of the URI. General Interface 3.1 applications perform as expected in version 3.2 and higher. However, it is strongly recommended that you update your applications to take advantage of the relative URI functionality.

Using URIs in General Interface Builder

In General Interface, version 3.1, URIs that referenced resources contained in a project directory were of the following form:

JSXAPPS/appname/subfolders/filename.xml

The version 3.1 format is still valid in version 3.2 and higher, because URIs beginning with JSXAPPS/ are handled in a special manner. As of version 3.2, these URIs can be written relative to the base directory of the project. The previous example can now be written as follows to take advantage of relative paths:

subfolders/filename.xml

In General Interface Builder, version 3.2 and higher, any property editable in the Properties Editor palette can accept a relative URI, which is resolved relative to the project directory. For example, these properties accept relative URIs: the Image property for ToolbarButton and the XML URL property for List. URIs that appear in free form properties, such as Text/HTML for Block, are never resolved. URIs set as values of attributes in the Attributes Editor are also not resolved.

In summary, the URI requirements in General Interface Builder, version 3.2 and higher, include the following:

  1. All properties editable in the Properties Editor palette that expect a path (XML URL, Image URL, and so on) can take an absolute path or a path relative to the project directory.
  2. All other inputs (HTML attributes, free-form HTML) have to be pre- resolved statically or using the URIResolver API. See URI Resolvers.

Using dynamic properties is one way of externalizing these paths. Be certain that values stored in the dynamic property agree with the requirements described above, depending on how they are used.

To reference a resource that is located outside of the project directory, use a relative URI starting with one or more "../" tokens or one of the supported absolute URI formats. See URI Format Support.

Using URIs with the General Interface API

When using URIs in JavaScript with the General Interface APIs, it's important to understand how each API resolves any URIs sent to it. For example, the jsx3.app.Model.load() method resolves URIs relative to the project directory of the application that the Model instance is owned by. For more information, see General Interface API Reference.

URI Format Support

The following URI formats are considered to be absolute in General Interface. They always resolve to the same location regardless of what they are resolved against.

For more information on the script element, query parameters, and deployment parameters, see Deployment Parameters.

URI Format Description
JSX/... Legacy format for General Interface 3.1. Resolves relative to the parent of the JSX directory as determined by the location of the JSX30.js script. If multiple script elements are used in one HTML page, the URL for the JSX30.js script file must be the same.
JSXAPPS/... Legacy format for General Interface 3.1. Resolves relative to the parent of the JSXAPPS directory, as determined by the jsxapppath query parameter of the src attribute of the script element referencing the JSX30.js script. If multiple script elements are used in one HTML page, the applications must be located in the same JSXAPPS directory.
GI_Builder/... Legacy format for General Interface 3.1. Resolves as JSX/... when General Interface Builder is running. Applications should not reference any URIs of this format, because the GI_Builder directory can't be deployed under the standard licensing terms.
jsx:///... Format for General Interface 3.2 and higher. Resolves relative to the JSX directory as determined by the location of the JSX30.js script.
jsxaddin://addin/... Format for General Interface 3.2 and higher. Resolves relative to the base directory of the add-in specified by the host portion (addin) of the URI. The host portion of the URI follows the double forward slashes (//). The host of the URI should be the add-in key (AddIn.getKey()) with any colon characters (:) replaced with an exclamation point (!). The add-in must be loaded for the URI to resolve correctly.
jsxuser:///... Format for General Interface 3.2 and higher. Resolves relative to the parent of the JSXAPPS directory (workspace). When General Interface Builder is running, this URI resolves relative to the workspace directory.
jsxapp://app/... General Interface 3.2 and higher format. If the Server instance corresponding to the host portion of the URI is loaded into memory, the URI is resolved relative to the application base directory (jsxappbase). The host portion (app) of the URI is the relative path from the JSXAPPS directory to the application base directory containing the config.xml file with any forward slashes (\/) replaced with exclamation points (!). If the Server instance isn't loaded into memory, the URI resolves relative to the directory containing the config.xml of the application. Note: You can override the application base directory (jsxappbase). See Overriding the Application Base Directory.

Additionally, any URIs specifying a scheme or an absolute path (beginning with a forward slash) are also considered absolute and will not be modified.

Any other URI is considered relative and will be resolved by a URI resolver depending on the context in which it is encountered.

URI Resolvers

General Interface, version 3.2, introduces a new interface, jsx3.net.URIResolver. An object that uses relative URIs must implement methods in the URIResolver interface to define a context against which those URIs are resolved. Two classes, jsx3.app.Server and jsx3.app.AddIn, implement this interface. The Server class uses the jsxapp: URI scheme and the AddIn class uses the jsxaddin: URI scheme described previously. Additionally, static resolvers are provided for the jsx: and jsxuser: schemes. For more information, see General Interface API Reference.

Contents

Searching General Interface Docs

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.