Resource Type Configurations

Yanel looks up the configuration for a requested URL to determine what resource-type to use. The resource-type configurations are located in the repository which is configured (in the file realm.xml ) as the rti (resource type identifier, see the XML tag <rti> in realm.xml) repository of the realm. This repository is used to configure Yanel's responses to requests, based on the request URLs, and normally contains 3 types of entries:

  • The "map.rc-map" file
  • "*_yanel-rc.xml" files
  • "*.yanel-rc files" (e.g. *.html.yanel-rc, *.xml.yanel-rc, etc.)

The "map.rc-map" file

This is an XML file used to configure responses based on URLs using wildcards, enabling you to configure collections of URLs in the same way. For details, see rc-map.

The "*_yanel-rc.xml" files

These files contain configurations for the patterns matched based on the rc-map.

The "*.yanel-rc" files

These are used to configure single URLs. The URL matched is the same as the file name, without the .yanel-rc extension. For example, the request URL {realm-URL}/discoveries.html will be matched to the file discoveries.html.yanel-rc.

Note 1: You can use a configuration file for a certain URL, while at the same time using an rc-map for a pattern of URLs.

Note 2: These file names are a convention only. To better understand the matching mechanism, also see the page "How a request is processed".

Example 1: An XML Resource

This type of resource returns an XML snippet/document, which is usually further processed using XSLTs:

<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
  <yanel:rti name="xml" namespace="http://www.wyona.org/yanel/resource/1.0"/>
  <yanel:property name="mime-type" value="text/html"/>
  <yanel:property name="xslt" value="/app/xslt/global.xsl"/>
</yanel:resource-config>

Example 2: A resource creator

As a more complex example, consider this configuration for a resource creator that creates new XHTML pages:

<yanel:resource-config xmlns:yanel="http://www.wyona.org/yanel/rti/1.0">
  <yanel:rti name="resource-creator" namespace="http://www.wyona.org/yanel/resource/1.0"/>
  <yanel:property name="lookin" value="/path/to/resource/creation/dir/"/>
  <yanel:custom-config>
    <rc:resource-types xmlns:rc="http://www.wyona.org/yanel/resource/resource-creator/1.0">
      <rc:resource-type name="xml" namespace="http://www.wyona.org/yanel/resource/1.0">
        <rc:display-name>New XHTML Page</rc:display-name>
        <rc:property name="mime-type" value="text/html"/>
        <rc:property name="source-mime-type" value="application/xhtml+xml"/>
        <rc:property name="template" value="yanelrepo:/templates/my-template.html"/>
      </rc:resource-type>
    </rc:resource-types>
  </yanel:custom-config>
</yanel:resource-config>

 



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.