next up previous contents
Next: Writing Network-Management Applications for Up: Writing Web-based Management Programs Previous: SNMP Proxy Agents for

Programming for the WWW

To write programs that use a WWW browser as their user interface, two main possibilities exist:
CGI
(``Common Gateway Interface'') programs can be written in any programming language that is available on the web-server. The CGI program can be called upon specific events by the web-server. Very often, such programs are simple shell or Perl scripts. The CGI provides a common interface between the server and the program by passing arguments inside environment variables. The program in return has to create HTML code as output which will be sent to the web browser of the user who originated the event that caused the CGI program to start.
Since standard HTML code is generated, programs that use the CGI technique can be executed using all kinds of web-browsers. It suffices that the browser is capable of displaying the generated HTML code.
Java
programs are, in contrary to CGI programs, executed inside the Java Virtual Machine (VM) [25] of the users web browser. To make this possible, Java source code is compiled into so called ``class files'' in a special Java byte code format. After beeing transferred to the web browser on the client machine, the Java byte code is verified for security problems and then executed within the Java Virtual Machine. The same byte code format is used on all implementations of the Java VM, therefore an application written in Java is executable on all kinds of platforms for which a Java VM is available. The VM is included in all recent versions of the Netscape Web browser, therefore Java programs can be executed by virtually everybody who uses the World-Wide-Web.

From the users view, Java programs when compared to CGI have the advantage that they can continue running when the web page is already loaded in the browser. With CGI programs this is not possible. The only way to change/modify data that is displayed by a program using CGI is to restart the program. This could be triggered by another user event, or as it is the case in programs like mrtg, by a periodic refresh of the whole page[*](equivalent to the user pressing the ``Reload'' button of the web browser).


  
Figure 4.4: Conceptual Difference between Java and CGI Programs
\begin{figure}
 \begin{center}
 
\epsfig {file=xfigpics/javacgi.xfig.eps}
 \end{center}\end{figure}


next up previous contents
Next: Writing Network-Management Applications for Up: Writing Web-based Management Programs Previous: SNMP Proxy Agents for
root
8/4/1997