Configuring the Netscape Server for "Starbuck" Java Servelets

You can create extensions written in Java for Web Servers. Use the Target templates in "Starbuck" to create a Java application or "servelet". See other "Starbuck" documentation for more details on servelet programming, and refer to the Netscape Enterprise Server Administrator's Guide for more details on Netscape server administration.

Java servelets work by implementing a new Netscape server object type called wjava.

Instead of accessing a CGI program, your form will request a file with the extension wjava. It does not matter what the file contains, but it must exist for the Netscape server to carry out authentication checks.

Create a file with the extension .wjava somewhere in your Server docs tree, for example

	C:/netscape/Server/docs/ext/service.wjava

This file must exist and be readable for permission checks. Whenever this file is accessed, your extension DLL will run.

The "Starbuck" Java Plugin does the following:

  1. provides a Name Translation function to force requests for files with extension .wjava to be serviced as objects of type wjava.
  2. provides a custom Service function for objects of type wjava, which uses the Microsoft Java Virtual Machine to run the Java class that was specified in the URL.
  3. using the WebConnection Java class, your servelet can read HTML form data and transmit HTML or custom results back to the Web browser.

Note that "Starbuck" must be loaded on your Web Server system, so that interface DLLs can be accessed.

"Starbuck" comes with two interface DLLs.
javansapi.dll is the Netscape Plugin that will run your Java servelet.
wwwconnect.dll is a DLL that allows your Java servelet to communicate with the Web Server.

Adding the JavaNSAPI.dll Plugin to the Netscape Server

Update the Netscape configuration file in config/obj.conf. Use caution, this file must be correct or the server will not restart. Follow these steps:

  1. Add this (very long) line after the last Init statement. Do not insert newlines.
    	Init fn="load-modules" shlib="C:/Powersoft/Starbuck/system/javansapi.dll"
    		funcs="wjava-fn,wjava-ntrans"
    
    Note: Netscape 2.x servers require a quoted list of function names, while Netscape 1.x servers did not. Also, Netscape recommends slashes instead of backslashes in filenames. Use the correct pathname to the "Starbuck" System/javansapi.dll file.
  2. Add a NameTrans line to the <Object name="default">; section. Immediately after the <Object name=default> line, add:
    	NameTrans fn=wjava-ntrans
    
  3. Add a new wjava object group. After the </Object> closing the <Object name="default"> section, add a new section with these lines:
    	<Object name=wjava>
    	Service fn=wjava-fn
    	</Object>
    
  4. Shutdown the Netscape Server, using the Netscape Administration interface.

    Note: once Netscape has loaded a DLL, the DLL file cannot be copied over, until you shutdown Netscape again.

  5. Restart the Netscape server. Check the Netscape error logs: if anything goes wrong, you will see a log message in the Server logs
  6. Test your Java servelet by accessing the service.wjava file from a browser. Add your classname to the URL:
    	localhost/service.wjava?class=your_JAVA_class
    

    Note that you must have your class files in the Classpath directory list that the Microsoft Java VM uses to find class files. You can edit your Classpath with the registry. Change the setting of Classpath under

    	HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Java VM
    

Important

If you need to do more work on your code, remember to shutdown and restart the server after you have updated your DLL. Netscape Server loads javansapi.dll at startup, and never unloads it. In turn, javansapi.dll loads (and never unloads) the Microsoft Java VM, which in turn keeps any previously loaded .class files in memory for faster subsequent access.

You can specify a classpath in your URL. If provided, you can use the following syntax: