Dynamically Open File in Oxygen XML Editor Distributed via JavaWebStartEdit online
Question
How can we dynamically open a file in an Oxygen XML Editor distributed via JWS?
Answer
The JWS packager Ant build file that is included with Oxygen XML Editor signs by
default the JNLP file (this means that a copy of it is included in the main JAR
library) in this
step:
<copy file="${outputDir}/${packageName}/${productName}.jnlp" tofile="${home}/JNLP-INF/APPLICATION.JNLP"/>
Signing the JNLP file is required by newer Java versions and means that it is impossible to
automatically generate a JNLP file containing some dynamic arguments. The solution is to use
the signed JNLP template feature of Java 7, bundle inside the JAR library a
signed APPLICATION_TEMPLATE.JNLP instead of an
APPLICATION.JNLP with a wildcard command line argument:
<application-desc main-class="ro.sync.jws.JwsDeployer"> <argument>*</argument> </application-desc>
Then you can replace the wildcard in the external placed JNLP to the actual, dynamic command line arguments value.
A different, more complicated approach would be to have the JNLP file signed and always
referenced as a URL argument a location like this:
http://path/to/server/redirectEditedURL.phpWhen the URL gets clicked on the client side you would also call a PHP script on the server side that would update the redirect location for
redirectEditedURL.php to point
to the clicked XML resource. Then the opened Oxygen XML Editor would try to connect to
the redirect PHP and be redirected to open the XML.