I downloaded Cocoon and want to install it on Apache JServ, what
should I do?
Installation on Apache JServ is simple and straightforward. You have to add the two
packages lotusxsl.jar and openxml.jar in JServ classpath adding the
following lines to your jserv.properties file:
wrapper.classpath=<cocoon>/bin/lotusxsl.jar wrapper.classpath=<cocoon>/bin/openxml.jar
where <cocoon> is the directory where you installed cocoon. Then you should add the Cocoon servlet to your favorite servlet zone, adding the following line to your <zone>.properties file, where <zone> is the name of the servlet zone as you should normally do with JServ:
repositories=<cocoon>/bin/cocoon.jar
Now your servlet engine 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 Apache *.conf files where you placed the other mod_jserv directives (usually httpd.conf)
ApJServAction .xml /servlets/org.apache.cocoon.Cocoon
<?xml-stylesheet href="hello.xsl" type="text/xsl"?>tells Cocoon that the stylesheet hello.xsl should be applied to the current XML file that contains this line as default. If you want to add browser depending styling you add
<?xml-stylesheet href="hello.xsl" type="text/xsl" media="xxx"?>Where xxx is the media type of your browser. Currently, there is no standardized way of recognizing the browsing client but mapping their identifier string. Cocoon is preconfigured to handle these browsers:
- explorer: any Microsoft Internet Explorer, searches for MSIE (before searching for Mozilla, since they include it too!)
- netscape: any Netscape Navigator, searches for Mozilla
- lynx: the text-only Lynx browser
- opera: the Opera browser
- java: any Java code using standard URL classes
- http://www.xml.org - A very nice site for XML information.
- http://www.w3.org/markup/xml/ - The XML offical home page at W3C
- http://www.w3.org/style/xsl - The XSL official home page W3C
- http://www.software.ibm.com/xml/education/tutorial-prog/abstract.html - XML Tutorial from IBM
- http://www.webtechniques.com/features/1999/01/walsh/walsh.shtml - XSL Tutorial
- http://www.oasis-open.org/cover/xml.html - XML Resource Listing
- http://www.oasis-open.org/cover/xsl.html - XSL Resource Listing
servlet.org.apache.cocoon.Cocoon.initArgs=properties=<cocoon>/bin/cocoon.propertiesAfter you specify this, the Cocoon servlet will look for this file at startup instead of using its internal defaults. We suggest you to extract the default file from the jar file or use the /src/org/apache/cocoon/cocoon.properties file from the distribution as a template.
browser.0=explorer=MSIE browser.1=netscape=Mozilla browser.2=lynx=Lynx browser.3=opera=Opera browser.4=java=Javaindicates that Cocoon should look for the string MSIE first, then Mozilla and so on. If you want to recognize different generations of the same browser you should do find the specific string you should look for and indicate the order of searching since more browsers may contain the same string.
Following the XSL model, such logic language should not pose any restriction to your XML format and should not force you to use specific logic tags to incorporate some logic (as ColdFusion, ASP, JSP and many others do), but should be able to allow you to define your own tags in your XML file (for example, <query>, <banner> or <counter>) and to dynamically interpret them using this language placed on a different file. Think of it as a logicsheet, the logic equivalent of a stylesheet.
This approach is what would allow you to place the three different document layers (content, logic and style) on different files, which can be modified, reused and designed indipendely and in a complete parallel way. We aim to work with other open-source XML groups (such as OpenXML) to define such language for both XML batch processing and server side processing.
The Cocoon publishing framework works in this way:
- Converts a document in a DOM structure
- Passes this DOM structure into a DOM processor pipeline
- This pipeline generates the output DOM
- The DOM is printed back to the client
Currently, only a single DOM processor is used (the XSL processor), but you could add your own to convert your own tags, entities or processing instructions. Look at the source code for more details on how to create a DOM processor and watch out since this is not for Java server side beginners.
When you have created your processor, simply add the class reference into the configurations like this:
processor.0 = org.fool.MyDOMProcessor processor.1 = org.apache.cocoon.processor.LotusXSLProcessorand Cocoon will create your processor and add it to the processing pipeline with the order specified by the number.
Copyright (c) 1999 The Java Apache
Project.
$Id: faq.html,v 1.1 1999/03/14 22:18:36 stefano Exp $
All rights reserved.