Understand cocoon

xiaoxiao2021-03-06  64

Author: nouse

Source: Downsky

Cocoon is a XML-based web publishing framework that provides a mechanism to truly implement content, logic, and expression of expression.

Cocoon has an efficient configurability and complex caching mechanism.

1.cocoon installation

CoCoon itself is a web application that needs to be run in servers with servlet engine.

Unlocking Cocoon's installation package (now stable version is 2.0.3), there will be a WAR package called Cocoon.war,

This is the unique file installed. Use it to click to Tomcat_Home / WebApps directory, then start Tomcat,

Tomcat will automatically unwield Cocoon.war to tomcat_home / webapps / cocoon directory, Type URL:

Http: // localhost: 8080 / cocoon, if you see Cocoon's Welcome page, it indicates that Cocoon has

Successfully installed, very simple. It should be noted that Tomcat should be closed at this time, and COCOON.WAR will be deleted.

The reason is that we will continue to modify and configure files in Tomcat_Home / WebApps / Cocoon in the later time.

Cocoon.war has been useless.

2. Cocoon is a highly configurable environment, several files are directly related to the configuration.

Tomcat_Home / WebApps / Cocoon / Web-INF / Web.xml

Tomcat_home / WebApps / Cocoon / Web-INF / COCOON.XCONF

Tomcat_home / WebApps / Cocoon / Web-INF / LOGKIT.XCONF

Tomcat_Home / WebApps / Cocoon / SiteMap.xmap

CoCoon itself is a web application, naturally Web.xml

Cocoon.xconf is a Cocoon configuration file, equivalent to the role of web.xml files in JSP in JSP

Logkit.xconf is a log configuration file of Cocoon, which is very flexible.

SiteMap is a core concept of Cocoon, there are many complex configuration items in SiteMap.xmap,

They will be configured, first of all, there is a whole understanding of CoCoon, with more you know Cocoon,

The more you understand the configuration of SiteMap.xmap.

3.Cocoon's basic concept

Pipeline is cocoon2 (Cocoon2 and Cocoon1 are very different, so no need to know anything about

Cocoon1's things) of the basic concept. Pipeline consists of multiple Cocoon components, and the input stream passes through Pipeline.

To the output stream, each component will process the input stream, and then send it to the next component process until the last

Output. The processing components and input streams are configured in the SiteMap mentioned earlier.

There can be multiple PIPLINE in one application, and there are multiple different processing in each Pipeline, each

Processing and input URL

4.Cocoon's basic components

Matcher: Yes Capture the URL address, the flow of one processing and PIPELINE

Generator: Convert the input stream to the SAX program of Java, providing SAX programs for subsequent processing

Transformer: Format conversion to the SAX program generated by Generators

Serializer: The final output stream is generated for the result of the GENERATORS and Transformer conversion.

The output stream can be a file in different formats such as HTML, XML, WML, JPEG, PNG, PDF.

XSP: The full name is Extension Server Page, and some people are called XML Server Page, which is a kind of cocoon.

Server scripting language, similar to JSP or ASP, but completely XML, it can be used as a Generator input stream 5. A simple URL request processing is:

Cocoon looks for Matcher items that match the URL in SiteMap, then correspond to the input stream configured in Generator (usually

XML file or XSP file a, use the associated Generator processing component to process the input stream, then read the Transformer

The input stream B (usually the XSL file), the Transformer component uses B to format the format conversion to A (such as the XML file

Convert to HTML format), there are 0 or continuous transformer processing in a pipe, last Serializer

The component generates the final output according to the type of Serialize (HTML, WML, PDF, JPEG, etc.).

Related SiteMap pieces

转载请注明原文地址:https://www.9cbs.com/read-89615.html

New Post(0)