CssColumnSite

Articles

More

Links

Problems

I experienced following problems

The first problem is fixed by using the Paginator transformer, available in the scratch pad area of Cocoon since version 2.1.

The second problem is fixed by introducing a semantic linking schema.

Paginator Transformer

As the single wml files are too large, they must get split up, but I don't want to split up the xml documents, nor splitting up the html pages, too. Thus I add the Paginator transformer in the sitemap for the wml pages, only. Well, for easy debugging, and startup problems I add the Paginator transformer for the html pages, too.

The Paginator description is very helpful, and the paginator samples in the scratch pad area, finally have helped me to update the site2wml.xsl for displaying the links for page scrolling.

Beside enhancing the stylesheet, the sitemap needs some enhancements, too. The Paginator transformers uses a link encoding schema by appending (N) to the original URI; N stands for the page number. Thus the second page of index.wml becomes index(2).wml.

Finally for the Paginator transformer configuration the new directory pagesheets holds the paginator configuration files.

In short the paginator configuration specifies

The paginator links introduces some problems when I generated the static wml files. As the paginator adds the sevlet path I had to fix some bugs in the Cocoon Ant invocation, and enhancing the Constants.LINK_OBJECT link mapping.

Semantic linking

Before implementing the WAP channel I used links in the xml document like <link href="index.html">. The simple semantic linking for this site I changed the links to links like <link href="page:index">.

Page Schema

Introducing the page schema, there has to be some information about what's the physical link, and who will do this link rewriting.

The requested URI itself holds the information I needed. Thus the extension of the requested URI determines the physical link. You remove the page schema, and append the extension of the requested URI, and that's the physical URI.

Cocoon has some nice - a bit hidden feature - of link rewriting. The LinkTransformer is automagically invoked, if an entry Constants.LINK_OBJECT exists in the objectModel. This entry may specify a simple HashMap having key entries for the original link, and an associated value for the rewritten link value.

Finally I ended up by writing a LinkTranslatorMapAction. Creating a special hash map overriding the get() for handling the page schema.

Cocoon Ant Rewriting

As noted above beside the page schema mapping, I add rewriting of servlet-path relative links. Links of the form userhomes/~columnsite/faq(2).wml were working fine in the servlet environment of Cocoon, but in the Cocoon Ant environment these links were resolved to userhomes/~columnsite/userhomes/~columnsite/faq(2).wml.

Thus I enhanced the LinkTranslatorMapAction. It removes the ServletPath prefix of any link it should lookup.


[Back]   [Next]

PDF
wapchannel-tutorial

Hints

» Use Search to search all documents.
» Use Recreate Index to create the inital index. This may be neccessary once at startup.

» Search and Recreate Index are available at HTML Cocoon online deployment, only.
» Search and Recreate Index are not available on WML online, WML offline, and HTML offline deployments.