Mapping requests onto Resource-Types/Controllers and Resource Type Configuration Map

Mapping requests onto Resource-Types/Controllers

The requests are mapped onto resource-types/controllers by default by the class org.wyona.yanel.core.ResourceTypeMatcherV1ImplV2, whereas the chain of responsibility is as follows:

  1. One-to-one mapping (.yanel-rc and then deprecated .yanel-rti)
  2. Resource Type Configuration Map (map.rc-map)
  3. File/Node resource type (see org.wyona.yanel.core.ResourceManager#getResource(Environment, Realm, String path))

Resource Type Configuration Map

To configure a bunch of URLs in the same way, one can use a resource type configuration map, which is an XML file called map.rc-map. This file has to be in the repository which is configured as the rti (resource type identifier) repository in a realm (in the file realm.xml).

Inside this file, one can define a wildcard matcher to select a group of URLs which points for every match to one resource type configuration, as in this example:

<matcher pattern="/en/index.html" rcpath="/homepage_yanel-rc.xml"/>
  <matcher pattern="/**.html" rcpath="/generic-xhtml-page_yanel-rc.xml"/>
<matcher pattern="/news/**.html" rcpath="/web-bulletin-entry_yanel-rc.xml"/>

Please note that the attribute rcpath uses absolute pathnames, because each repository is considered a separate volume, and all paths refer to the root of this volume, in this case the directory where the resource type configuration repository is located.


Inside the file map.rc-map one can also define a matcher using a custom class to match a request to a resource type configuration, as in the following example:

<matcher class="org.wyona.yanel.impl.MobileRegistrationMatcher" rcpath="/registration-mobile_yanel-rc.xml"/>

The custom class has to implement org.wyona.yanel.core.MatcherV1#match( realm, String path, javax.servlet.http.HttpServletRequest request)

Your comments are much appreciated

Is the content of this page unclear or you think it could be improved? Please add a comment and we will try to improve it accordingly.