GlassFish Server Open Source Edition 3.1 - App Client Container One Pager - JNLP Customization
App Client Container 1.2. Name(s) and e-mail address of Document Author(s)/Supplier:Tim Quinn (tim.quinn@oracle.com) 1.3. Date of This Document:03/11/2010 2. Project Summary |
![]() |
The developer should not specify every JAR on which the client depends. GlassFish will automatically handle JARs that the Java EE spec requires to be available to the app client. This includes JARs listed in the app client JAR's manifest Class-Path and JARs in the EAR's library directory (if any) and their transitive closures. The developer's custom JNLP document should specify only those JARs which the client needs that GlassFish would not otherwise include. |
The developer packages these JARs - as with any JAR required by an app client - in the EAR. The developer uses relative URIs in his or her <jar href="..."> and <nativelib href="..."> elements to point to the JARs. The codebase which GlassFish will assign for the final client JNLP document corresponds to the top-level of the EAR, so relative hrefs correspond directly to the relative path to the JARs within the EAR.
Note that neither the Java EE spec nor GlassFish supports packaging JARs inside the app client JAR itself. The developer is free to do so, but GlassFish does no special processing of such JARs. They will not appear in the runtime class path and they cannot be referenced from the developer's custom JNLP document.
The developer's JNLP can also refer to other developer-written JNLP documents using <extension href="..."/> elements. To be consistent with relative hrefs to JARs, the developer's relative hrefs to JNLPs are resolved within the EAR. The developer can place these JNLPs directly in the EAR or inside JARs which the EAR contains. The developer can use the same format for these hrefs as for the <jnlp-doc> element:
path-to-JAR-in-EAR ! path-in-JAR-to-JNLP
path-in-EAR-to-JNLP
Location of JNLP | Referenced JNLP location | href from developer's JNLP |
---|---|---|
in the EAR | stuff/extra.jnlp | stuff/extra.jnlp |
in a JAR | other/a.jar contains stuff/extra.jnlp | other/a.jar!stuff/extra.jnlp |
where the JNLP-inside-JAR URI format follows the standard entry-within-a-JAR URI syntax and semantics. Support for this syntax comes from the GlassFish Grizzly adapter which serves requests from the automated Java Web Start support. This is not a feature of Java Web Start or the JNLP standard.
Because GlassFish will always set the codebase of all JNLP documents to correspond to the EAR, the developer will need to remember this in writing multiply-nested JNLPs and the hrefs within them, realizing that all relative hrefs will be resolved with respect to the EAR.
If the developer provides his or her own JNLP file, GlassFish combines that content in a predictable way with its own generated JNLP to come up with the final JNLP used to launch the app client.
GlassFish creates the various portions of the final JNLP in one of three ways:
This means that the developer can (but does not have to) compose a complete JNLP document and package it with the application. GlassFish will know how to combine the right parts from it with the GlassFish-generated JNLP. This is not what we recommend but it will work. Rather, we expect developers will provide small bits of content which will specify only what they want to add to what GlassFish generates. Keep in mind that the developer-provided content must still conform to the general structure of the JNLP format so that GlassFish can tell where in the final JNLP document the custom content belongs. For example, if the developer simply wants to specify a single native library to be included only for Windows systems, the new element he or she wants to add might be
<nativelib href="windows/myLib.jar"/>
But the developer needs to let GlassFish know where in the overall document this element belongs. The actual custom JNLP would need to look something like this:
<jnlp> <resources os="Windows"> <nativelib href="windows/myLib.jar"/> </resources> </jnlp>
in order to "place" the <nativelib> element in the right part of the final JNLP document.
Generally, developers can:
In particular, this flexibility allows developers to add JARs to the application (including platform-specific native libraries) and set properties to control the behavior of their clients.
The following tables give more detail about what parts of the JNLP the developer can add and modify.
Owned
JNLP fragment | Notes |
---|---|
<jnlp codebase="xxx"...> | GlassFish controls this in the app client-centric case; the host and port are inserted dynamically with each request and the path is GlassFish-private, indicating that the request is for Java Web Start support and identifying which app and client are being addressed; the developer controls this for the web app-centric model. |
<jnlp href="xxx"...> | URL to the JNLP itself - GlassFish controls the actual URL where the JNLP is reachable in the app client-centric model so it must control this attribute value; the developer owns this value in the web app-centric model. |
<jnlp> <security> |
GlassFish must control the permissions requested for each JNLP document - all permissions are needed for the main document (which launches the ACC) and the permissions requested for other JNLP documents depend on whether the JARs referenced in those documents are signed or not |
<jnlp> <application-desc> <argument>... |
GlassFish sets the main-class and the arguments to be passed to the client |
Defaulted
JNLP fragment | Notes |
---|---|
<jnlp spec="xxx"...> | JNLP spec version |
<jnlp> <information (no-attrs)> |
This element contains app title, vendor, homepage, various description text values, icon images, and whether offline execution should be allowed. |
<jnlp> <resources (no-attrs)> <java version="xxx" java-vm-args="yyy" ...> |
The Java SE version and/or selected VM parameter settings. |
Merged
JNLP fragment | Notes |
---|---|
<jnlp> <information (attrs)> |
Developer specifies one or more of os=, arch=, platform=, locale= on the <information> element and provides all children; GlassFish provides no default children. |
<jnlp> <resources (no-attrs)> <jar ...> |
Developer adds JAR files to be included in the app to the GlassFish-provided ones |
<jnlp> <resources (no-attrs)> <nativelib ...> |
Developer refers to a native library |
<jnlp> <resources (no-attrs)> <property ...> |
Developer adds system property settings to the GlassFish-provided ones |
<jnlp> <resources (no-attrs)> <extension ...> |
Developer refers to another developer-provided JNLP document |
<jnlp> <resources (attrs)> ... |
Developer specifies one or more of os=, arch=, locale= on the <resources> element and provides all children; GlassFish provides no default children. |
<jnlp> <component-desc...> |
Developer "includes" additional JNLP documents from the app |
Again, the developer will write the custom JNLP knowing that GlassFish will assign the final JNLP document's codebase so relative {{href}}s will resolve correctly within the EAR. (The codebase value is "owned" by GlassFish.) For example, if the developer wants to refer to a native library at windows/myLib.jar then he or she can include
<nativelib href="windows/myLib.jar" .../>
in the developer-provided JNLP document. (Each entry in a JAR listed in a nativelib element must be a native library for the correct platform. The full syntax of the nativelib element lets the developer specify the platform for that native library.)
Note that GlassFish provides default <information> and <resources> elements, without specifying attributes such as os, arch, platform, or locale attributes (shown as no-attrs in the table). GlassFish merges its own content within those elements with developer-provided content under those elements. Further, the developer can provide his or her own <information> and <resources> elements (and fragments within them) that do specify at least one of the attributes.
These topics do not need to be documented; they are not part of the published, supported interface of this feature.
Which portions of the JNLP are handled in which way is governed by a properties file client-jnlp-config.properties. GlassFish installs this file into ${installDir}/config. If at deployment time GlassFish finds a copy at ${domainDir}/config then it will use that one instead of the one at ${installDir}/config. We do not expect users to routinely make domain-specific copies of the config file or to edit the copy at ${installDir}. The location and contents of the config file are not part of the published and documented interface to GlassFish.
The contents of the properties file assign XPath expressions to properties to indicate what parts of the JNLP document are owned, which are merged, and which are defaulted. The JNLP generation code uses these XPath expressions to extract the relevant parts of the developer's JNLP and the GlassFish-generated JNLP and then combine them properly to get the resulting client JNLP.)
The Java Web Start support in GlassFish has always enforced "positive file service," meaning that GlassFish serves (via the Java Web Start support URLs) only those files that it recognizes as part of the application needed by the app client. This prevents malicious users from using the Java Web Start-related URLs to try to fetch content that should not be exposed over HTTP. For each application, GlassFish recognizes the app client JAR file and any library JARs in the application's library directory as well as JARs referenced from manifest Class-Path entries of referenced JARs.
To preserve this protection with developer-provided JNLP content - which can itself add JARs to the client - GlassFish scans the developer-provided JNLP (and any other JNLP documents it in turn refers to) for references to JARs within the application's code base. GlassFish adds each such JAR to the approved list of files that can be served via the Java Web Start URLs. GlassFish does the same for extension JNLP documents to which the developer's JNLP content refers: any extension JNLP documents that lie within the application's codebase are added to the known content so it can be served.
Combination of developer-provided and GlassFish-generated JNLP content, according to well-defined rules for which parts of the resulting JNLP are owned by GlassFish, merged from both sources, and defaulted by GlassFish in the absence of developer-provided content.
Support for references from JNLP in one application to another application. Developers might code such references in an unsupported way by using some of the existing undocumented, unpublished placeholders GlassFish already uses in the generated JNLP documents. We will not support such cross-referencing.
<java-web-start-access> <vendor>
value to specially-formatted strings to point to icon images. This feature is continued but we urge developers instead to specify their icon settings (which they can do with more precision) using their own JNLP document which contains icon image URIs.
Disclose interfaces this project imports.
Application Development Guide
[ Application Deployment Guide |ApplicationDeplyomentGuide], Appendix B, Enterprise Server Deployment Descriptor Files
No admin impact
No HA impact
No impact.
No impact.
No impact other than that described earlier, requiring GlassFish to scan user-provided JNLPs and add any referenced JARs to the legal content to serve.
No incompatibilities.
The new XML element is optional and so does not invalidate existing glassfish-application-client.xml descriptors.
No upgrade or migration requirements imposed.
No dependencies on other projects or modules.
See earlier list of issues.
With GlassFish 3.1.