caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Resin Web Server
Unix Apache
Windows Apache
Unix Netscape
IIS
Other Servlets
 Caucho Servlet Engine on Netscape Unix

  1. Compiling caucho_nsapi.so
  2. Configuring Netscape by hand
    1. Load Balancing
  3. Configuring resin.conf
  4. Testing the servlet engine
  5. Servlet Engine Production
Resin provides a fast servlet runner for Netscape, allowing Netscape to run servlets, JSP and XTP files.

To configure Resin with Netscape, you must follow the following steps:

  1. Compile caucho_nsapi.so
  2. Configure Netscape
  3. Configure resin.conf
  4. Restart Netscape and start srun

Compiling caucho_nsapi.so

To compile and install caucho_nsapi on Unix, you'll need to run configure and then make.

The argument to --with-netscape is the directory containing the netscape start and stop scripts, i.e. the parent of the config directory.

unix> ./configure --with-netscape=/usr/local/netscape/https-your-hostname
unix> make

If you need finer control over the Netscape configuration, you can use the following arguments to ./configure. Resin needs netscape-include and netscape-conf.

--with-netscape=dir The Netscape root directory.
--with-netscape-include=dir The Netscape include directory.
--with-netscape-conf=conf The Netscape obj.conf file

Configuring Netscape by hand

Making caucho_nsapi will automatically change your obj.conf file. For reference, here are the changes:

obj.conf
Init fn="load-modules" shlib="<build-dir>/caucho_nsapi.so" \
   funcs="caucho_service,caucho_filter,caucho_status"

<Object name=default>
NameTrans fn="caucho_filter" conf="<resin-home>/resin.conf" name="resin"
NameTrans fn="assign-name" from="/caucho-status" name="caucho-status"
...
</Object>

<Object name="resin">
Service fn="caucho_service"
</Object>
<Object name="caucho-status">
Service fn="caucho_status"
</Object>


Note: The caucho-status is optional and probably should be avoided in a production site. It lets you ask plugin module about the Caucho status, valuable for debugging.

Restart Netscape. Now browse http://localhost/caucho-status. It should return a table indicating that the servlet runner is stopped.

Browse http://localhost/test.jsp. It should return a message like:

Cannot connect to Servlet Runner.

Load Balancing

In Resin 1.1, you can distribute requests to multiple machines. All requests in a session will go to the same host. In addition, if one host goes down, Resin will send the request to the next available machine.

In addition, you can specify backup machines. The backup only will serve requests if all primaries are down.

See the http config section for more details.

resin.conf
<caucho.com>
<http-server>
  <srun host='host1' port='6802'/>
  <srun host='host2' port='6802'/>
  <srun-backup host='backup port='6802'/>
  ...
</http-server>
</caucho.com>

Configuring resin.conf

By default, Resin will look in resin1.1/doc for JSP files and resin1.1/doc/WEB-INF/classes for servlets and beans. To tell Resin to use Netscapex's document area, you configure the app-dir. Change app-dir from 'doc' to something like '/usr/local/netscape/doc'.

resin.conf
<caucho.com>
  <http-server
      app-dir='/usr/local/netscape/docs'>
    <servlet-mapping url-pattern='/servlets/*'
              servlet-name='invoker'/>

    <servlet-mapping url-pattern='*.xtp'
                        servlet-name='com.caucho.jsp.XtpServlet'/>
    <servlet-mapping url-pattern='*.jsp'
                        servlet-name='com.caucho.jsp.JspServlet'/>
  </http-server>
</caucho.com>

Testing the servlet engine

Now you need to start the servlet engine.

> resin1.1/bin/srun.sh

Now browse http://localhost/test.jsp. You should get a 'file not found' message.

Create a test file '/usr/local/netscape/htdocs/test.jsp'

<%@ page language=javascript %>
2 + 2 = <%= 2 + 2 %>

Browse http://localhost/test.jsp again. You should now get

2 + 2 = 4

Servlet Engine Production

A better way to run the servlet engine in a production environment is to use the start and stop scripts. These scripts add extra reliability to the server. If Resin should ever exit, it will automatically be restarted.

To start the servlet runner, use

unix> resin1.1/bin/srun.sh start

To stop it, use

unix> resin1.1/bin/srun.sh stop

Windows Apache   IIS
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 03 Mar 2000 18:25:20 -0800 (PST)