Motivation
The suite of XRL technologies provide all the components necessary to construct flexible
and maintainable HTML user interfaces on NetKernel. The benefits are:
- complete separation of external URLs from internal services or static resources behind
them.
- recursive template oriented approach allows maximum reuse of content.
- ability to "rewrite" links and img tags to make interface "relocatable".
- add module/application specific error handling pages.
Structure
A single rewrite rule is used to map all external requests to the XRL mapper. The mapper
uses the default link file resource located at ffcpl:/etc/XRLLinks.xml
. Any
external request that is not mapped will cause invoke the xrl:404
resource
which is mapped to an friendly error page. Both static
and dynamically generated results can be returned without exposing their implementing
technologies on the interface.
Page resources are mapped to the XRL linker which take a standard template and populate it
with data pulled from a data service.
Here is the example module.xml
:
<module>
<!---->
<export>
<uri>
<match>ffcpl:/my_module/.*</match>
</uri>
</export>
<mapping>
<!---->
<rewrite>
<match>(ffcpl:/my_module/.*)</match>
<to>active:mapper+operand@$1</to>
</rewrite>
<!---->
<this>
<match>ffcpl:/etc/XRLLinks.xml</match>
<match>ffcpl:/pub/.*</match>
<match>ffcpl:/page/.*</match>
</this>
<!---->
<import>
<uri>urn:org:ten60:netkernel:ext:xrl</uri>
</import>
<import>
<uri>urn:org:ten60:netkernel:ext:script</uri>
</import>
<super />
</mapping>
</module>
Here is the example XRLLinks.xml
:
<links basepath="ffcpl:/my_module/">
<!---->
<link>
<name>icon</name>
<ext>/icon.png</ext>
<int>ffcpl:/pub/icon.png</int>
</link>
<link>
<name>css</name>
<ext>/style.css</ext>
<int>ffcpl:/pub/style.css</int>
</link>
<!---->
<link>
<ext>/index.html</ext>
<int>active:xrl+template@xrl:my_template+content@xrl:data</int>
<arg>param</arg>
</link>
<link>
<!---->
<name>my_template</name>
<int>ffcpl:/page/template.xml</int>
</link>
<link>
<!---->
<name>data</name>
<int>active:beanshell+operator@ffcpl:/page/data.bsh</int>
<args>param</args>
</link>
</links>
Here is the example template.xml
:
<html xmlns:xrl="http://1060.org/xrl">
<head>
<!---->
<link href="xrl:icon" rel="SHORTCUT ICON" xrl:resolve="href" />
<link href="xrl:css" rel="stylesheet" type="text/css" xrl:resolve="href" />
<!---->
<title>
<xrl:eval fallback="'my_module'" xpath="/html/body//h1/text()" />
</title>
</head>
<body>
<h1>Here is the data</h1>
<!---->
<xrl:include href="xrl:content" />
</body>
</html>