Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Docs Webapp XMLXSL Routes

Frank Kleine edited this page Apr 7, 2012 · 1 revision

Table of Contents

XML/XSL route configuration

For each route in your application there must be a configuration and a style sheet. This article covers the route configuration. For informations about the style sheet see XML/XSL xsl style sheets.

Location of page configuration files

Page configuration files should be created in the conf subdirectory of the pages directory. Please make sure that the contents of this path can be read by the webserver user.

One .ini file in the conf directory denotes one route. The name of the file without the .ini extension denote the name of the route that has to be the value of the route argument within the URL in order to see this specific page.

Configuration

A route is configured and instantiated with a route reader instance. It is possible to create your own route reader and to use a complete other way of configuring the page, e.g. from a database. For this example we will stick with the ini configuration.

[properties]
skin="default"

[processables]
Test="org::stubbles::examples::processables::TestXMLProcessable"
uncached="org::stubbles::examples::processables::CurrentTimeXMLProcessable"
counter="org::stubbles::examples::processables::TestProcessableWithInjectedResource"

You can see several different sections of the configuration file.

Route properties

A route may have properties. These are key-value pairs of data that may influence how the page is handled. Currently two properties are directly supported.

Property name Usage
locale The general locale can be configured via the config.ini file with the net.stubbles.locale property. However sometimes it may be necessary to mark a certain route as being in a different locale. With this property set one can overwrite the general locale setting.
skin The skin property can be used to determine which skin should be used to render the route. If this property is not set the skin named default will be used. (Hence the configuration in this example has the same effect as if the property would not be configured.) More information about the skin can be found on XML/XSL page style sheets.
forceSSL This property will force a redirect to the same route, but with https instead of http if the current request was not in SSL mode.

If necessary, processables can get the route injected and read properties from it.

Processables

The other configurations are processables. Processables are the connector between the controlling and the model part of the MVC component in Stubbles. They access the business logic, and perform operations on it influenced by values from the request and the session. This can be used to refer your own processables, which should implement the net::stubbles::webapp::xml::route::stubProcessable interface.

Result

The result of the processing of this route configuration is a XML document which looks something like this:

#xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<document page="index">
  <session>
    <id>91497fb3ce6cca2656d73b3103733e2d</id>
    <name>PHPSESSID</name>
    <isNew>false</isnew>
    <token>
      <current>0e5d5519315508fd393a3ca8a7a17a1d</current>
      <next>943bd92c169b545e52fd27c70cf72650</next>
    </token>
  </session>
  <Test>
    <foo>Hello World!</foo>
  </test>
  <uncached>
    <currentTime>2007-10-01 20:42:27</currenttime>
  </uncached>
  <counter/>
  <forms>
    <Test/>
    <cached/>
    <uncached/>
    <counter/>
    <passThru/>
  </forms>
  <request/>
</document>
Clone this wiki locally