cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Olivier Rossel <olivier.ros...@anyware-tech.com>
Subject Re: Sitemap question
Date Mon, 04 Mar 2002 15:14:19 GMT
Stefano Bonnin wrote:

>ok
>
>How can I define a very simple pipeline that gets the initial URI and
>present a simple HTML file?
>
you must understand that sitemap.xconf is the only relation between your 
URL and the files on your disk.
There is no direct mapping such as in Apache or usual web servers.
If you want to access a file, there must be a rule somewhere in your 
sitemap that handles it.
Or you will get (guess...) error 404.

>For example:
>
>in the cocoon directory I define the following subdirectory:
>
>        myApplication
>
>and I put into this directory the following html file:
>
>        myfile.html
>
>Now, I want that cocoon display this html file in the browser every time
>that a user access to it.
>This is (I think) the more stupid pipeline supported by cocoon.
>
>Then, if I define the following sitemap.xmap:
>
>....
>....
>....
><map:pipeline>
>        <map:match pattern="">
>            <map:redirect-to uri="myApplication/myfile.html"/>
>        </map:match>
></map:pipeline>
>
The rule tells the browser to change its URL so it is:
http://serverName/contextName/myApplication/myfile.html


The browser then tries to connect to Cocoon with this URL.
You need a sitemap rule that handles it, or it is error404.

For example a rule can be:
<map:match pattern="myApplication/*.html">
 <map:read src="{0}" type="text/html"/>
</map:match>

It matches any URL that corresponds to a html file in the directory 
myApplication.
The map:read provides the data "as is" to the client, with no 
server-side transformation or parsing.
It is useful when you want to send static content, such as html files or 
image files (you can think of it as a direct mapping, as in Apache).
The {0} is replaced by the pattern that has been matched by the rule 
(easy to understand if you have a bit of knowledge with regexp).
And that's all folks.
Use that, and Cocoon will serve static HTML files correctly.


---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <cocoon-users-unsubscribe@xml.apache.org>
For additional commands, e-mail: <cocoon-users-help@xml.apache.org>


Mime
View raw message