Current Page: NeXtMidas User's Guide Third-Party Compatibility WebStart Launching WebStart via CGI
3. | ### Launching WebStart Applications via a CGI Script This section outlines the steps required to create a CGI Perl script that can be used to launch a WebStart application. This section assumes experience in writing both CGI Perl scripts and WebStart JNLP files. #### Purpose of Using CGI Many NeXtMidas-based applications come with web page front ends that allow users to easily select the data they wish to view. Using that information a customized NeXtMidas session is launched via WebStart. Unfortunately JNLP files are static and can not accept options passed in from a web form. One way to get around this is to write a CGI Perl script that will take those options and serve out a dynamically-generated JNLP file. #### Converting a Static JNLP File into a Dynamic one via CGI Generate the normal JNLP file and NeXtMidas JAR files that would be used to launch a static version of the application (see Building WebStart Applications for details). Take the JNLP file and create a Perl file out of it. This can be done by putting print commands around each line of the JNLP file. Make sure to escape any special characters (e.g. '`"`' becomes '`\"`'). Very Important: Change the Perl script and remove the `href` that refers to the JNLP file. It's usually of the form
       <jnlp spec="1.0+" href="app_name.jnlp">
5. If you omit this step Java WebStart will attempt to start a JNLP file in the `codebase`. Modify the Perl script to include any necessary processing for getting the command line arguments. Edit the line containing
       <argument> APP_NAME </argument>
   line so that it reads
       <argument> APP_NAME arg1 arg2 ... argN </argument>
7. where `arg1`, `arg2`, ..., `argN` are the arguments to pass to the application. Save the Perl script in one of the CGI areas of the server (usually `cgi-bin`). Give it the name `app_name.pl`. Open a web browser and run the script manually to test it:
       http://server_name/cgi-bin/app_name.pl?arg1&arg2&...&argN
If all works well, the web page front-end can now be configured to run the CGI Perl script in order to bring up the WebStart Application.