Apache JServ has one configuration file for the whole engine (normally called
jserv.properties
) and one for each servlet zone. Please, refer
to the Apache JServ documentation for more information on this.
First thing to do is to make sure that Cocoon and all the needed components
(as explained in the previous section) are visible. This implies adding
this to the servlet engine classpath by adding a line like this in your
jserv.properties
file for each jar package you have to install
(after substituting [path-to-jar] with the path to the jar file and
[jar-name] with the package file name).
 |  |  |
 | wrapper.classpath=[path-to-jar]/[jar-name].jar |  |
 |  |  |
Here is an example:
 |  |  |
 |
wrapper.classpath=/usr/local/java/lib/cocoon.jar
wrapper.classpath=/usr/local/java/lib/xerces.jar
wrapper.classpath=/usr/local/java/lib/xalan.jar
wrapper.classpath=/usr/local/java/lib/fop.jar
wrapper.classpath=/usr/local/java/lib/regexp.jar
wrapper.classpath=/usr/local/java/lib/jndi.jar
|  |
 |  |  |
 |
from this version of Cocoon the Cocoon.jar
package should be added to the servlet engine classpath as any other
required package (as shown above).
|
At this point, you must set the Cocoon configurations. To do this, you
must choose the servlet zone(s) where you want Cocoon to reside (Note that
Cocoon can safely reside on different servlet zones with different
configuration files). If you don't know what a servlet zone is, you
probably want to open the zone.properties
file that represents
the default servlet zone.
To configure Cocoon, you must pass the cocoon.properties
file location to the servlet by adding the following to the
zone.properties
file (or each servlet zone file you want
Cocoon to reside):
 |  |  |
 | servlet.org.apache.cocoon.Cocoon.initArgs=properties=[path-to-cocoon]/bin/cocoon.properties |  |
 |  |  |
Note that you should not need to change anything from the template
properties file found in the distribution (under /conf/
),
but you must edit it for more complex operation. Please refer directly to
the file that contains breaf indications and comments on the different
configurations, but you don't need to care about that at this point.
Now your cocoon servlet is properly configured, but you should tell Apache
to direct any call to an XML file (or any other file you want Cocoon to
process) to the Cocoon servlet. To do this, you should add the following line
to your mod_jserv.conf
or jserv.conf
file:
 |  |  |
 | Action cocoon /servlet/org.apache.cocoon.Cocoon
AddHandler cocoon xml |  |
 |  |  |
where xml is the file extention you want to map to the servlet
and /servlet/ is the mount point of your servlet zone (and the
above is the standard name for servlet mapping for Apache JServ).
At this point, you should check if your system matches the global
considerations about Cocoon properties. Usually, you might want to give
the installation a try as it is and then read again that section if
something goes wrong. Most installations don't need any changes to
be operational.
Everything should be configured fine. Restart both Apache and Apache JServ
and try accessing the samples contained in the distribution to see
Cocoon in action or the /Cocoon.xml
page for Cocoon internal
status.
Note: you may want Cocoon to handle two different
extentions with different configurations. To do this, you must set the two
different configurations in two different servlet zones, then associate the
extentions like this:
 |  |  |
 | Action cocoon1 /zone1/org.apache.cocoon.Cocoon
Action cocoon1 /zone2/org.apache.cocoon.Cocoon
AddHandler cocoon1 xml1
AddHandler cocoon2 xml2 |  |
 |  |  |
where xml1 is handled by the Cocoon residing on zone1
and xml2 is handled by the Cocoon residing on zone2
which have different configurations and thus different behavior.