BasicXMLResource

BasicXMLResource is a base class for resources that generate XML. you can extend this class if you want to develop a resource-type which will proceed xml.

It already has implemented a bunch of nice thing which you could like. e.g. XSLT, i18n, XInclude, ConfigurableViewDescriptor and catalog resolving.

At the moment the following resource-types for example are extending BasicXMLResource: xml, user-mgmt (via ExecutableUsecaseResource).

Resource Configuration Properties:

<yanel:property name="i18n-catalogue" value="VALUE"/> see: i18n
<yanel:property name="xslt" value="VALUE"/>
<yanel:property name="mime-type" value="VALUE"/>
<yanel:property name="source-view-mime-type" value="VALUE"/>
<yanel:property name="viewid" value="VALUE"/>

ConfigurableViewDescriptor (Custom Resource Configuration)


Element Name
Child-Element Attribut Explanation
views view Container for all views
view mime-type, xslt, serializer
id, type A single view.
id can be 'default' or 'source' for built in views. Or any other id for a custom view. A view is accessed via id through a request parameter yanel.resource.viewid or by setting the resource configuration property viewid

Type can be xml, jelly, redirect (implementation not finished yet), custom. Default is xml.
mime-type - E.g. text/html, application/xhtml+xml ...
xslt - Path to xslt. absolute data-repo path, rthdocs path, file path. see: Protocol-Schemas used configure xslt via ConfigurableViewDescriptor
serializer omit-xml-declaration, indent, doctype-public, doctype-system key If no serializer is specified for a view, the serializer will be chosen depending on the mime-type, whereas the default serializer is XHTML_STRICT
Possible Serializers (key):
HTML_TRANSITIONAL, XHTML_STRICT, XML, TEXT, HTML5
omit-xml-declaration - Can be 'yes' or 'no'
doctype-public - Public Doctype e.g -//W3C//DTD XHTML 1.0 Transitional//EN
doctype-system - System Doctype e.g. http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
indent - Can be 'yes' or 'no'

Example:

<yanel:custom-config>
<views>
<!-- No parameter needed for getting this view -->
<view id="default">
<mime-type>text/html</mime-type>
<xslt>/xslt/global.xsl</xslt>
<serializer key="HTML_TRANSITIONAL">
</serializer>
</view>

<view id="beautiful">
<mime-type>application/xhtml+xml</mime-type>
<xslt>/xslt/global.xsl</xslt>
<serializer key="XHTML_STRICT">
</serializer>
</view>

<view id="atom">
<mime-type>application/atom+xml</mime-type>
<serializer key="XML">
</serializer>
</view>

<view id="json">
<mime-type>application/json</mime-type>
<serializer key="TEXT">
</serializer>
</view>

<!-- Skips any provided XSLT-->
<view id="source">
<mime-type>application/xhtml+xml</mime-type>
<serializer key="XML">
</serializer>
</view>
</views>
</yanel:custom-config>


XSLT

Built-in XSLT-Parameter:

Property-name Explanation:
yanel.path.name
yanel.path Requested path
yanel.back2context Path prefix for yanel root.
yanel.globalHtdocsPath Path prefix for accessing content from globalHtocsPath.
yanel.resourcesHtdocsPath Path prefix for accessing content of this resources HtdocsPath.
yanel.back2realm Path prefix for realm root.
yarep.back2realm
(Deprecated) Same as: yanel.back2realm. For backwards compatibility only.
os User-agent operating-system
client User-agent (At the moment it just shows msie or firefox)
language Requested Language
content-language language of content
username Username of the loged in user.
yanel.reservedPrefix Reserved Prefix of yanel (ATM hardcoeded (yanel))
yanel.toolbar-status on or off. status of tollbar.

Built-in Protocol-Schemas used by Xinclude:

Protocol Explanation Example Source
http Accessing content proceeded by yanel as configured in the requested path resource config.
http://.../yanel/myrealm/index.html rc-repo/index.html.yanel-rc
yanelresource Accessing content proceeded by yanel as configured in the requested path resource config. Allows to bypass HTTP yanelresource:/index.html rc-repo/ index.html.yanel.rc
yanelrepo Accessing content in data-repo of curent realm.
yanelrepo:/index.html data-repo/index.html
yanelrepo:REALM_ID Accessing content in data-repo of realm test-realm. yanelrepo:test-realm:/index.html data-repo/index.html
yanelrepo:REALM_ID:REPO_ID
Accessing content in repo with id test-repo of realm test-realm. yanelrepo:test-realm:test-repo:/index.html test-repo/index.html
rthtdocs Accessing resource-type specific content in the resource-types htdocs direcotry
rthtdocs:/foo/bar.xml resource-type/htdocs/foo/bar.xml
rtyanelhtdocs Accessing yanel specific content in the resource-types yanel-htdocs direcotry rtyanelhtdocs:/foo/bar.xml resource-type/yanel-htdocs/foo/bar.xml

Protocol-Schemas used configure xslt via ConfigurableViewDescriptor:

Protocol Explanation Example Source
Accessing content in data-repo of curent realm.
/index.html data-repo/index.html
rthtdocs Accessing resource-type specific content in the resource-types htdocs direcotry
rthtdocs:/foo/bar.xml resource-type/htdocs/foo/bar.xml
file Accessing a file within your system.
file:/home/foo/bar.xml /home/foo/bar.xml