cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Created: Applications
Date Sat, 13 Jan 2007 21:16:24 GMT
A new document has been created.

Document ID: 1316
Branch: main
Language: default
Name: Applications
Document Type: Cocoon Document
Created: 1/13/07 9:16:21 PM
Creator (owner): Carsten Ziegeler
State: publish


Mime type: text/xml
Size: 3929 bytes

<p>Cocoon is a great framework for writing web applications. Unfortunately there
is no existing way to manage application configuration: a configuration that is
global to your application. Of course there are several ways to do this, e.g. by
defining parameters in the <em>web.xml</em> or by adding the configuration to
some Spring or Avalon component or by providing your own configuration

<p>But in many cases, although you only have one web application from the
servlet specification point of view, you might have several applications running
in one single Cocoon instance at the same time. And of course each of these
applications need their own configuration. For example, a portal needs some
configuration about where the user profiles are stored, what layout to use etc.
And inside the portal you have several Cocoon powered web applications
(portlets) running.</p>

<p>Cocoon Auth offers the notion of an application with its own configuration.
It's possible to configure several applications with different configurations.
In addition an application is associated with authentication and authorization.
It's possible to define if a user is required to login to use the application
and to control the rights for a particular user (or depending on his role etc.).

<h2>Configuring the application</h2>

<p>Before you can use an application, you have to tell Cocoon Auth about it.
Technically, an application is a singleton component, so the configuration of an
application takes place in a Spring configuration file.</p>

<p>Let's have a look at a simple application configuration:</p>

<pre>&lt;bean name="org.apache.cocoon.auth.Application/WebShop"
  &lt;property name="securityHandler" ref="org.apache.cocoon.auth.SecurityHandler/shop-handler"/&gt;
    ... Configuration for the application - if required

<p>In the example above we define one application called <em>WebShop</em>.
application must have a unique name that is later on used as a reference to this
application. This name is defined in the name attribute and has to be prefixed
with "org.apache.cocoon.auth.Application/". In addition an application is
"secured" by a security handler which means, only users that are logged in using
this handler are allowed to use this application. The configuration of an
application takes the name of the security handler as a required property.
Please see <a href="securityhandlers.html">here for more information on security

<p>Inside the application you can use custom properties for configuring your

<p>If you don't need a special security handler in your application, configure
the anonymous security handler.</p>

<h2>Implementing your Application</h2>

<p>Depending on your requirements, you can either use a predefined
implementation for an application, or you can implement your own application
object. Whatever you choose, the Java class must conform to the
<em>org.apache.cocoon.auth.Application</em> interface.</p>

<p>Cocoon Auth comes with a standard implementation -
<em>org.apache.cocoon.auth.StandardApplication</em> - this implementation should
suffice most use cases, have a look at the documentation of this class for more

<p>If you want to use Cocoon Auth in combination with the Cocoon portal, you
should use an application implementation that provides some functionality
required by the portal. Cocoon Auth already comes with an implementation:
<em>org.apache.cocoon.auth.portal.StandardPortalApplication</em> that you can
use in combination with the group based profile manager of the Cocoon portal.

<p>If you want to implement your own application, the best way is to choose an
existing application (StandardApplication or StandardPortalApplication) and to
extend it by subclassing.</p>


The document belongs to the following collections: cdocs-auth

View raw message