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.

See: http://wiki.cocoondev.org/Wiki.jsp?page=ApacheModProxy

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 *>
    ServerName www.foo.org

    # eg. get Apache to serve directly out of a Cocoon project
    # Serve foo.org'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
    </Directory>

    # 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>


<VirtualHost *> ServerName www.bar.org

    # eg. a custom log file for bar.org
    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/

</VirtualHost>

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:handle-errors>
<map:select type="exception">
<map:when test="not-found">
<map:generate type="notifying"/>
<map:transform src="stylesheets/system/error2html.xslt">
<map:parameter name="contextPath" value="{request:contextPath}"/>
<map:parameter name="pageTitle" value="Resource not found"/>
</map:transform>
<map:serialize status-code="404"/>
</map:when>
<map:otherwise>
<map:generate type="notifying"/>
<map:transform src="stylesheets/system/error2html.xslt">
<map:parameter name="contextPath" value="{request:contextPath}"/>
</map:transform>
<map:serialize status-code="500"/>
</map:otherwise>
</map:select>
</map:handle-errors>



Hope this helps


regards Jeremy


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to