Difference between revisions of "Using the CTP Application Server"

From MircWiki
Jump to navigation Jump to search
Line 84: Line 84:
 
Notes:
 
Notes:
 
*If the <tt><b>&lt;all-permissions/&gt;</b></tt> element is included, all the jars listed in the <tt><b>&lt;resources/&gt;</b></tt> element must be signed.
 
*If the <tt><b>&lt;all-permissions/&gt;</b></tt> element is included, all the jars listed in the <tt><b>&lt;resources/&gt;</b></tt> element must be signed.
*This method of launching the application does not support its being launched by the Java Application Manager off-line because there is no JNLP file available on the disk.
+
*This method of launching the application does not support its being launched by the Java Application Manager off-line because there is no JNLP file available on the disk. Thus the <tt><b>href</b></tt> attribute of the <tt><b>&lt;jnlp/&gt;</b></tt> element must not be generated by the
 +
XSL. Doing so will cause the Application Manager to be unable to launch the application.

Revision as of 19:38, 16 August 2012

This article describes how to use the CTP Application Server to download and launch Java applications using the Java Web Start protocol (JNLP).

The CTP Application Server is a servlet that is included in all CTP versions starting with 2012/08/15. The servlet is accessed through the URL /webstart/{name}, where {name} is the name of the application program to be launched.

To deploy a Java program for downloading by the Application Server servlet, the program and all the resources it uses (jar libraries, etc.) must be placed in a first-generation child directory of CTP/ROOT. An XSL file with the name {name}.xsl must also appear in the same directory. The XSL file is used by the servlet to process a dynamically generated XML document and produce the JNLP XML structure required to trigger the download and launch of the application.

The structure of the dynamically generated document is:

<jnlp>
    <environment>
        <protocol>http[s]</protocol>
        <host>{ip:port}</host>
        <application>{appname}</application>
    </environment>
    <params>
        <{param1name}><![CDATA[{param1value}]]></{param1name}>
         etc.
    </params>
</jnlp>

The values of the elements in the document are constructed by the servlet from the HTTP connection. For example, to launch the TCIASender application, the URL might be:

http://nbia.somewhere.edu/webstart/TCIASender?title=My%20Institution&name=My%20Name

In this case, the document generated by the servlet will be:

<jnlp>
    <environment>
        <protocol>http</protocol>
        <host>nbia.somewhere.edu:80</host>
        <application>TCIASender</application>
    </environment>
    <params>
        <title><![CDATA[My Institution]]></title>
        <name><![CDATA[My Name]]></name>
    </params>
</jnlp>

The XSL program to launch the application would be:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="utf-8" omit-xml-declaration="yes" />

<xsl:template match="/jnlp">
	<jnlp
		codebase="{environment/protocol}://{environment/host}/{environment/application}" >
		<!-- href="{environment/application}.jnlp" > -->

		<information>
			<title>TCIA Transport Utility</title>
			<vendor>RSNA</vendor>
			<homepage href="http://mircwiki.rsna.org//index.php?title=CTP-The_RSNA_Clinical_Trial_Processor"/>
			<description>TCIA Transport Utility</description>
			<description kind="short">Java Web Start program for transmitting images to TCIA for clinical trials.</description>
			<!-- <offline-allowed/> -->
		</information>

		<security>
			<all-permissions/>
		</security>

		<resources>
			<j2se version="1.5+"/>
			<jar href="TCIASender.jar"/>
			<jar href="CTP.jar"/>
			<jar href="dcm4che.jar"/>
			<jar href="log4j.jar"/>
			<jar href="util.jar"/>
		</resources>

		<application-desc main-class="tcia.TCIASender">
			<argument>"<xsl:value-of select="params/title"/>"</argument>
			<argument>"<xsl:value-of select="params/name"/>"</argument>
		</application>
	</jnlp>
</xsl:template>

</xsl:stylesheet>

Notes:

  • If the <all-permissions/> element is included, all the jars listed in the <resources/> element must be signed.
  • This method of launching the application does not support its being launched by the Java Application Manager off-line because there is no JNLP file available on the disk. Thus the href attribute of the <jnlp/> element must not be generated by the

XSL. Doing so will cause the Application Manager to be unable to launch the application.