Previous Next        Current Page: NeXtMidas User's Guide / Third-Party Compatibility / WebStart / Launching WebStart via CGI
back
FAQs   
Release Information   
Getting Help   
Basic Concepts   
Result Parameters   
XML Support   
Files   
System Operation   
Macros   
WebStart Intro   
Graphics   
X-Midas Interoperability   
Third-Party Compatibility   
   - Apache   
   + Web Browsers   
   - Java   
   - WebStart   
      - Building WebStart Applications   
      - Launching WebStart via CGI   
   - Profilers   
   - NetBeans   
   - Eclipse   
   - JBuilder   
   - Intel Fortran Compiler   
   - Portland Group Compiler   
   - SWIG   
   - VNC   
Installation and Customization   
Running NeXtMidas Independently   
Glossary   


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

  1. 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).
  2. 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 '\"').
  3. 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">
    If you omit this step Java WebStart will attempt to start a JNLP file in the codebase.
  4. Modify the Perl script to include any necessary processing for getting the command line arguments.
  5. Edit the line containing
    <argument> APP_NAME </argument>
    line so that it reads
    <argument> APP_NAME arg1 arg2 ... argN </argument>
    where arg1, arg2, ..., argN are the arguments to pass to the application.
  6. Save the Perl script in one of the CGI areas of the server (usually cgi-bin). Give it the name app_name.pl.
  7. Open a web browser and run the script manually to test it:
    http://server_name/cgi-bin/app_name.pl?arg1&arg2&...&argN
  8. 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.

back