cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Created: Application Management
Date Tue, 16 Aug 2005 13:25:15 GMT
A new document has been created.

Document ID: 668
Branch: main
Language: default
Name: Application Management
Document Type: Document
Created: 8/16/05 1:25:02 PM
Creator (owner): Helma
State: publish


Mime type: text/xml
Size: 3685 bytes

<p>The application management is a very useful feature for building and
maintaining web applications. A developer uses it to configure different
applications and to manage the user data for these applications.</p>

<h2>Configuring an Application</h2>

<p>A "authentication" application is related to one authentication handler, so
an application is part of the authentication handler configuration:</p>

        &lt;handler name="unique"&gt;
             ....redirect-to/authentication configuration
             &lt;applications&gt; &lt;!-- the applications for this handler --&gt;
                 &lt;application name="unique"&gt;
                     &lt;load uri="loadapp"/&gt; &lt;!-- optional --&gt;
                     &lt;save uri="saveapp"/&gt; &lt;!-- optional --&gt;

<p>A configuration for an application consists of a unique name (only
alphabetical characters and digits are allowed for the application name) and
optional load and save resources. The application configuration can contain
application specific configuration values for the various parts of the
application, e.g. information for a portal.</p>

<p>On a successful authentication, the framework invokes the load resource (if
present) for each application of the handler. The content or result of the load
resource is stored in the session context.</p>

<p>The user does not always visit all sites or all applications at once, so it
is not necessary to load all applications in advance. Each application can
specify whether the data is loaded upon successful authentication or the first
time it is needed:</p>

<pre>....&lt;application name="unique" loadondemand="true"/&gt;...</pre>

<p>The load resource gets several parameters: all the values of the subnodes of
the "authentication" node from the authentication context (e.g. ID, role etc.)
and the parameter "application" containing the unique name of the application.
This unique name must not contain one of the characters '_', ':' or '/'.</p>

<p>In addition, the load and save resource get all of the parameters specified
inside the load / save tag of the handler configuration.</p>

<h2>Configuring the resources</h2>

<p>For managing the application the framework needs to know to which application
a resource belongs. So in addition to the handler parameter the auth-protect
action gets the application name as a second parameter:</p>

<pre>&lt;map:match pattern="protectedresource"&gt;
  &lt;map:action type="auth-protect"&gt;
    &lt;map:parameter name="handler" value="unique handler name"/&gt;
    &lt;map:parameter name="application" value="unique application name"/&gt;
    &lt;map:generate src="source/resource.xml"/&gt;

<p>With this mechanism each application resource can easily access its (and only
its own) information. If a resource has no "application" parameter it can not
access information of any application.</p>

<h2>Getting, setting and saving application information</h2>

<p>A resource accesses its application data similar to the way it accesses the
authentication data:</p>

<pre>&lt;session:getxml context="authentication" path="/application/username"/&gt;
&lt;session:setxml context="authentication"  path="/application/shoppingcart"&gt;&lt;item1/&gt;&lt;item2/&gt;&lt;/session:setxml&gt;</pre>

<p>The path must follow the same restrictions and rules as always and it has to
start with "/application/".</p>


The document belongs to the following collections: documentation

View raw message