Difference between revisions of "Using the CTP Application Server"
Line 72: | Line 72: | ||
</resources> | </resources> | ||
− | <application-desc | + | <application-desc main-class="tcia.TCIASender"> |
+ | <argument>"<xsl:value-of select="params/title"/>"</argument> | ||
+ | <argument>"<xsl:value-of select="params/name"/>"</argument> | ||
+ | </application> | ||
</jnlp> | </jnlp> | ||
</xsl:template> | </xsl:template> |
Revision as of 19:25, 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:
In this case, the document 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>