Tip: How to map a view to the / path (site root)

5 views
Skip to first unread message

Adi

unread,
Dec 2, 2009, 10:03:51 PM12/2/09
to Induction Framework
While preparing to deploy a client site I was wondering how I could
map / (the root of website) to a view using Induction's view mapping
rules.

I knew Induction did not have explicit support for this, so I expected
that I would just add a Rewrite rule to the Apache server that front-
ends the client site. I also thought that later I would add a feature
in Induction to support this.

But it turned out that there is a way to do it using the recently
added find/replace feature. This techniques can be applied in general
to map an arbitrary URL to a specific view. Ofcourse you should be
using the pattern based rules for 99% of your URLs.

The home page of my client site is view named something like
com.companyname.page.home.SiteHomePage, following is the mapping I
used in the <view-mapping> section:

<url-to-class-map>
<url-pattern>^(/)$</url-pattern>
<class-packages>com.companyname.page.home</class-packages>
<class-pattern>com\.companyname\.page\.home\.(SiteHome)Page</
class-pattern>
<class-replace>
<find>SiteHome</find>
<replace>/</replace>
</class-replace>
</url-to-class-map>

Regards,
Adi
Reply all
Reply to author
Forward
0 new messages