Solprovider Lenya Kongregate Registration for Free Flash Games and Chat with solprovider

Usecase Sitemaps

"Usecases" are special Sitemaps used for modular XMAP functionality. Most functions of any websites should be handled with Usecases. They are easy to maintain, since the pipelines are mostly contained in their own files, which makes them easy to copy to other publications. They are called by adding "lenya.usecase={usecaseName}" to the parameters of any URL.

Background


The Lenya process truly starts with:
- build\lenya\webapp\sitemap.xmap. It checks for the login and logout usecases (making any override a server-wide change), then passes control to:
- build\lenya\webapp\global-sitemap.xmap. It checks for internal pipelines like navigation. It also checks for a usecase. If one is found, control is passed to:
- build\lenya\webapp\lenya\usecase.xmap. It decides if there is a publication or global usecase. Publication usecases are passed to:
- {pub}\usecase-{usecaseName}.xmap.

The importance is this is a method to easily interrupt the normal processing.

Also, the original URL is intact. Login can return to the page failing access. The Contact Us page can include which page incited the comment. The Website Map knows what page called it for "You are here".

Instructions


Create a file named:
{pub}\usecase-myUsecase.xmap

A very simple file is used by the Website Map:
<?xml version="1.0" encoding="UTF-8"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<map:pipelines>
<map:pipeline>
<map:match pattern="**">
<!-- REMOVE THE LINE BREAKS FROM THIS TAG -->
<map:generate src="cocoon://{page-envelope:publication-id}/
lenyabody-view/{page-envelope:publication-id}/
{page-envelope:area}/map{page-envelope:document-id}_
{page-envelope:document-language}.html"/>
<map:transform src="../../xslt/util/strip_namespaces.xsl"/>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>


Every XMAP file should have the sitemap\pipelines\pipeline\match XML structure. This example has only one match. It calls a pipeline in publication-sitemap.xmap, but sets the doctype to "map" so a different XSLT (page2xhtml-map.xsl) is used.

Usecase MATCHes


Lenya provides easy matching on certain URL parameters. If a parameter name starts with "lenya." (with period), then it is available as a match Type. Example: index.html?lenya.usecase=xsl&lenya.xsl=mystyle
Usecase and XSL can be matched using:
<map:match type="usecase" pattern="xsl">
<map:match type="xsl" pattern="mystyle">


Type="usecase" is useless in Usecase XMAPs because all pages requested must match in a sitemap. It is mostly useless in the publication-sitemap.xmap because the process would be routed to the Usecase XMAP if the setting exists. That match is only useful in XMAPs mounted from another XMAP.

It is also dangerous to use in Usecase XMAPs because every pipe will match it:
<map:match type="usecase" pattern="xsl">
<map:call function="main"/>
</map:match>
<map:match pattern="flow-pipe-from-javascript">

<map:generate src="flow/template.xml"/>
<map:transform src="resources/forms-samples-styling.xsl"/>
<map:serialize type="html" />
</map:match>
The first match passes control to JavaScript. The JavaScript tries to call the second match, but is caught by the first match which calls the JavaScript again: INFINITE LOOP! OUT OF MEMORY ERROR!
It is better to use:
<map:match pattern="**.html">
because it will only match the entry URL.


<< BreakpointsLenya Process >>

Contact Solprovider
Paul Ercolino