
Example Overview:
-----------------

This example shows how to access an EJB in JOnAS from a servlet in Tomcat, and
to use security both in Tomcat to authentificate the user and in JOnAS to authorize
him to access the EJB methods. It is described in details in the
"Use Security in JOnAS with TOMCAT" howto of the JOnAS documentation.

The "bean" directory contains an EJB that mimics $JONAS_ROOT/examples/src/sb
with the addition of security access to the bean methods.

Others directories contain a web application.

Compiling this example creates a .war file that represents the web application that
will be used by Tomcat to run the servlet.

Prerequisites
-------------
First, you must have installed Tomcat. 

If you are using Tomcat 3.3.x you have to set the environment
   variable TOMCAT_HOME to the directory where you installed Tomcat3.3.x.

   You must modify $TOMCAT_HOME/conf/modules.xml in order to propagate security:

   Replace the line    
   <module name="AccessInterceptor" javaClass="org.apache.tomcat.modules.aaa.AccessInterceptor"/>
   by  

   <module name="AccessInterceptor" 
     javaClass="org.objectweb.security.tomcat.interceptor.SecurityCtxInterceptor33"/>

If you are using Tomcat 4.0.x you have to set the environment variables
   CATALINA_HOME and CATALINA_BASE as indicated in the Tomcat 4.0.x documentation.

Compiling and installing this example:
--------------------------------------

On $JONAS_ROOT/example/alarm, run the compile script,
 - compile.sh on Unix or
 - compile.bat on Windows.

If the gnu make is installed on your machine you can also build this example
by using the Makefile as it is defined in the $JONAS_ROOT/example/README:
 make install

If the Ant 1.4 build tool is installed on your machine you can also build this
example by using the build.xml as it is defined in the $JONAS_ROOT/example/README.
 ant install

Running this example:
--------------------
Commands are given for an Unix system. 
(Similar commands can be done on Windows)
In the following <TOMCAT_HOME> refers to $TOMCAT_HOME for tomcat 3.3 or CATALINA_BASE for tomcat4.0

1) websample.war must be installed in <TOMCAT_HOME>/webapps 
   apps-websample.xml must be installed in <TOMCAT_HOME>/conf
   (compile.sh, make or Ant does the job)
	cp $JONAS_ROOT/webapps/websample.war <TOMCAT_HOME>/webapps
        cp $JONAS_ROOT/examples/websample/apps-websample.xml <TOMCAT_HOME>/conf

2) Run an EJB Server:
	cd $JONAS_ROOT/examples/websample
	EJBServer


3) Run your web browser (e.g., netscape):
	netscape http://<hostname>:<port>/websample
	where <hostname> is the name of your machine (localhost by default)
	and <port> the port number (8080 by default)
