|
Caucho Servlet Engine on Netscape Unix
|

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:
- Compile caucho_nsapi.so
- Configure Netscape
- Configure resin.conf
- 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.2, 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 id="a"host='host1' port='6802'/> <srun id="b" host='host2' port='6802'/> <srun-backup id="c" host='backup port='6802'/> ... </http-server> </caucho.com>
|
By default, Resin will look in resin1.2/doc for JSP files and
resin1.2/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>
|
Installing Resin with Netscape modifies Netscape's obj.conf file. For most
users, the default installation will be fine. More sophisticated users
will need to modify the obj.conf file.
Init fn=load-types mime-types=mime.types # load resin shared library Init fn="load-modules" shlib="/home/resin/libexec/caucho_nsapi.so" \ funcs="caucho_service,caucho_filter,caucho_status"
<Object name=default> # you can change the conf value NameTrans fn="caucho_filter" conf="/home/resin/conf/resin.conf" name="resin" # comment out the following in production sites NameTrans fn="assign-name" from="/caucho-status" name="caucho-status" NameTrans fn=pfx2dir from=/ns-icons dir="/usr/local/src/nes/ns-icons" name="es-internal" NameTrans fn=pfx2dir from=/mc-icons dir="/usr/local/src/nes/ns-icons" name="es-internal"
... </Object>
...
<Object name="resin"> Service fn="caucho_service" </Object>
<Object name="caucho-status"> Service fn="caucho_status" </Object>
|
| Testing the servlet engine
|
Now you need to start the servlet engine.
Now browse http://localhost/test.jsp. You should get a 'file not
found' message.
Create a test file '/usr/local/netscape/htdocs/test.jsp'
Browse http://localhost/test.jsp again. You should now get
| 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> resin2.0/bin/httpd.sh start
|
To stop it, use
unix> resin2.0/bin/httpd.sh stop
|
On Windows, the setup program should configure the obj.conf. Except that
you don't need to compile the plugin on windows, the configuration is
identical.
Copyright © 1998-2001 Caucho Technology. All rights reserved.
Copyright © 1998-2001 Caucho Technology, Inc. All rights reserved.
Resin® is a registered trademark,
and HardCoretm and Quercustm are trademarks of Caucho Technology, Inc.
|
 |
|