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 BuilderIn 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:
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 APIWhen 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 SupportThe 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.
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 ResolversGeneral 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
|
