cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Quinn <>
Subject Re: Basic Usage / Hosting Questions
Date Sun, 01 Jun 2003 11:08:43 GMT

On Friday, May 30, 2003, at 03:39 PM, JD Daniels wrote:

> So question one: Am I better off from a server resource standpoint, to 
> have
> ONE installation of Cocoon, and point the appBase to a subdirectory of 
> it?

A popular way of running several cocoon-based projects as separate 
virtual hosts, is to use one instance of Cocoon, serving each project 
via a sub-sitemap, using virtualhost and mod_proxy in Apache HTTPD to 
point to each one.


The downside of this may be when your Clients all want different 
component declarations, like their own datasources, input-modules, 
lucene indexes, etc.

Here is an example from one of my Apache httpd configs:

     # If mod_proxy cannot connect to the servlet container, we want
     # to display a nice static page saying the reason. This is a
     # SHTML page (using the Server-Side-Includes filter)

     ErrorDocument 502 /errors/service-unavailable.shtml
     ErrorDocument 500 /errors/server-error.shtml
     ErrorDocument 404 /errors/document-unavailable.shtml

     ProxyPreserveHost On
     ProxyErrorOverride On

     NameVirtualHost *

<VirtualHost *>

     # eg. get Apache to serve directly out of a Cocoon project
     # Serve's CSS
     Alias /style/ "/Library/TomCat/webapps/cocoon/foo/parts/css/"
     <Directory "/Library/TomCat/webapps/cocoon/foo/parts/css">
       Options Indexes MultiViews
       AllowOverride None
       Order allow,deny
       Allow from all

     # don't proxy any request beginning with the following keywords:
     ProxyPass        /errors/ !
     ProxyPass        /style/ !

     # send everything else to the foo sub-sitemap
     ProxyPass        / http://localhost:8080/cocoon/foo/
     ProxyPassReverse / http://localhost:8080/cocoon/foo/


<VirtualHost *>

     # eg. a custom log file for
     CustomLog "logs/bar_log" common

     # don't proxy any request beginning with the following keywords:
     ProxyPass        /errors/ !

     # eg. serve the Cocoon distribution
     ProxyPass        /cocoon/ http://localhost:8080/cocoon/
     ProxyPassReverse /cocoon/ http://localhost:8080/cocoon/

     # send everything else to the bar sub-sitemap
     ProxyPass        / http://localhost:8080/cocoon/bar/
     ProxyPassReverse / http://localhost:8080/cocoon/bar/


In order for Apache to be able to over-ride Cocoon's error pages, you 
need to modify Cocoon's error handling like below, to send out the 
appropriate HTTP Response code.

   <map:select type="exception">
     <map:when test="not-found">
       <map:generate type="notifying"/>
       <map:transform src="stylesheets/system/error2html.xslt">
         <map:parameter name="contextPath" 
         <map:parameter name="pageTitle" value="Resource not found"/>
       <map:serialize status-code="404"/>
       <map:generate type="notifying"/>
       <map:transform src="stylesheets/system/error2html.xslt">
         <map:parameter name="contextPath" 
       <map:serialize status-code="500"/>

Hope this helps

regards Jeremy

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message