cziegeler    02/05/07 23:21:38

  Modified:    src/documentation/xdocs/developing authentication.xml
                        session.xml
  Log:
  Pretty printed docs
  Submitted by: Bert Van Kets [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.2       +168 -166  
xml-cocoon2/src/documentation/xdocs/developing/authentication.xml
  
  Index: authentication.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/documentation/xdocs/developing/authentication.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- authentication.xml        23 Apr 2002 10:25:32 -0000      1.1
  +++ authentication.xml        8 May 2002 06:21:38 -0000       1.2
  @@ -83,15 +83,13 @@
             resource can be protected by calling this handler using the 
auth-protect
             action. The "auth-protect" action must be included in the pipeline 
of the
             resource. It gets the handler information as a parameter:</p>
  -        <source>    &lt;map:match pattern="protectedresource"&gt;
  -        &lt;map:act type="auth-protect"&gt;
  -            &lt;map:parameter name="handler" value="unique handler name"/&gt;
  -
  -            &lt;map:generate src="source/resource.xml"/&gt;
  -        &lt;/map:act&gt;
  +        <source>&lt;map:match pattern="protectedresource"&gt;
  +  &lt;map:act type="auth-protect"&gt;
  +    &lt;map:parameter name="handler" value="unique handler name"/&gt;
  +    &lt;map:generate src="source/resource.xml"/&gt;
  +  &lt;/map:act&gt;
           ...
  -    &lt;/map:match&gt;
  -</source>
  +&lt;/map:match&gt;</source>
           <p>If the pipeline does not use the "auth-protect" action or the
             parameter "handler" is missing, the resource is accessible by any 
user.</p>
        </s2>
  @@ -100,13 +98,13 @@
             redirects to a special redirect-to resource. This resource is a 
mandatory
             configuration of the authentication handler:</p>
           <source>&lt;action name="auth-protect" ...&gt;
  -    &lt;handlers&gt;  &lt;!-- Now follows the handlers configuration --&gt;
  -        &lt;handler name="unique"&gt;
  -            &lt;redirect-to uri="cocoon://loginpage"/&gt; &lt;!-- The login 
resource --&gt;
  -        &lt;/handler&gt;
  -    &lt;/handlers&gt;
  -&lt;/action&gt;
  -</source>
  +  &lt;handlers&gt;
  +    &lt;!-- Now follows the handlers configuration --&gt;
  +    &lt;handler name="unique"&gt;
  +      &lt;redirect-to uri="cocoon://loginpage"/&gt; &lt;!-- The login 
resource --&gt;
  +    &lt;/handler&gt;
  +  &lt;/handlers&gt;
  +&lt;/action&gt;</source>
           <p>This redirect-to resource is an unprotected resource in the
             sitemap. For tracking which resource was requested, the 
redirect-to resource
             gets the request parameter "resource" with the value. In addition 
all
  @@ -117,19 +115,18 @@
             described below.</p>
           <p>The authentication process is done by the "auth-login" action.
             The login resource contains this action: </p>
  -        <source>     &lt;map:match pattern="login"&gt;
  -     &lt;map:act type="auth-login"&gt;
  -            &lt;map:parameter name="handler" value="unique"/&gt;
  -              &lt;map:parameter name="parameter_userid" 
value="request:name"/&gt;
  -              &lt;map:parameter name="parameter_password" 
value="request:password"/&gt;
  -
  -       &lt;map:redirect-to uri="authentication-successful"/&gt;
  -        &lt;/map:act&gt;
  -     &lt;!-- authentication failed: --&gt;
  -           &lt;map:generate src="auth_failed.xml"/&gt;
  -        &lt;map:transform src="tohtml.xsl"/&gt;
  -        &lt;map:serialize/&gt;
  -    &lt;/map:match&gt;</source>
  +        <source>&lt;map:match pattern="login"&gt;
  +  &lt;map:act type="auth-login"&gt;
  +    &lt;map:parameter name="handler" value="unique"/&gt;
  +    &lt;map:parameter name="parameter_userid" value="request:name"/&gt;
  +    &lt;map:parameter name="parameter_password" value="request:password"/&gt;
  +    &lt;map:redirect-to uri="authentication-successful"/&gt;
  +  &lt;/map:act&gt;
  +  &lt;!-- authentication failed: --&gt;
  +  &lt;map:generate src="auth_failed.xml"/&gt;
  +  &lt;map:transform src="tohtml.xsl"/&gt;
  +  &lt;map:serialize/&gt;
  +&lt;/map:match&gt;</source>
           <p>The "auth-protect" action uses the handler parameter to call the
             authentication resource of this handler. This authentication 
resource needs to
             know the information provided by the user. For each piece of 
information an own
  @@ -163,12 +160,13 @@
             possible (e.g. database, LDAP). The authentication resource is 
another
             mandatory configuration of the authentication handler:</p>
           <source>&lt;action name="auth-protect" ...&gt;
  -    &lt;handlers&gt;  &lt;!-- Now follows the handlers configuration --&gt;
  -        &lt;handler name="unique"&gt;
  -            &lt;redirect-to uri="cocoon:raw://loginpage"/&gt; &lt;!-- The 
login resource --&gt;
  -            &lt;authentication uri="cocoon:raw://authenticationresource"/&gt;
  -        &lt;/handler&gt;
  -    &lt;/handlers&gt;
  +  &lt;handlers&gt;
  +    &lt;!-- Now follows the handlers configuration --&gt;
  +    &lt;handler name="unique"&gt;
  +      &lt;redirect-to uri="cocoon:raw://loginpage"/&gt;  &lt;!-- The login 
resource --&gt;
  +      &lt;authentication uri="cocoon:raw://authenticationresource"/&gt;
  +    &lt;/handler&gt;
  +  &lt;/handlers&gt;
   &lt;/action&gt;</source>
           <p>If the authentication resource is a sitemap resource or a remote
             resource, this resource is requested by the framework with the 
given parameters from
  @@ -204,7 +202,7 @@
           <p>The logout process is triggered by the "auth-logout"
             action:</p>
           <source>&lt;map:act type="auth-logout"&gt;
  -    &lt;map:parameter name="handler" value="unique"/&gt;
  +  &lt;map:parameter name="handler" value="unique"/&gt;
   &lt;/map:act&gt;</source>
           <p>This action logs the user out of the given handler and removes all
             information about this handler stored in the session.</p>
  @@ -299,15 +297,16 @@
           <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>
  -        <source>    &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;
  +        <source>&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;
               ...
  -        &lt;/map:action&gt;
  -    &lt;/map:match&gt;</source>
  +  &lt;/map:action&gt;
  +&lt;/map:match&gt;
  +</source>
           <p>With this mechanism each application resource can easily access 
its
             and only its information. If a resource has no "application" 
parameter it can
             not access information of any application.</p>
  @@ -334,19 +333,19 @@
        <p>The module configuration is part of the application
           configuration:</p>
        <source>&lt;action name="auth-protect" ...&gt;
  -    &lt;handlers&gt;
  -        &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;configuration name="portal"&gt;
  -                           ...portal configuration
  -                     &lt;/configuration&gt;
  -                 &lt;/application&gt;
  -             &lt;/applications&gt;
  -        &lt;/handler&gt;
  -    &lt;/handlers&gt;
  +  &lt;handlers&gt;
  +    &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;configuration name="portal"&gt;
  +            ...portal configuration
  +          &lt;/configuration&gt;
  +        &lt;/application&gt;
  +      &lt;/applications&gt;
  +    &lt;/handler&gt;
  +  &lt;/handlers&gt;
   &lt;/action&gt;</source>
        <p>So whenever the portal engine is asked to build the portal it can
           easily retrieve its configuration from the current application by 
getting the
  @@ -356,41 +355,41 @@
        <p>Using the framework it is possible to add new roles to the system 
and to
           add new users. For this purpose, there are several optional entries 
for the
           authentication handler which provide the needed functionality:</p>
  -     <source>&lt;action name="auth-protect" ...&gt;
  -    &lt;handlers&gt;
  -        &lt;handler name="unique"&gt;
  +     <source>&lt;action name="auth-protect"&gt;
  +  &lt;handlers&gt;
  +    &lt;handler name="unique"&gt;
                ...redirect-to/authentication configuration...
   
  -             &lt;!-- Optional resource for loading user information --&gt;
  -                         &lt;load-users 
uri="cocoon:raw://financeresource-sunrise-loaduser"/&gt;
  +      &lt;!-- Optional resource for loading user information --&gt;
  +      &lt;load-users uri="cocoon:raw://financeresource-sunrise-loaduser"/&gt;
   
  -             &lt;!-- Optional resource for loading roles information--&gt;
  -                         &lt;load-roles 
uri="cocoon:raw://financeresource-sunrise-roles"/&gt;
  +      &lt;!-- Optional resource for loading roles information--&gt;
  +      &lt;load-roles uri="cocoon:raw://financeresource-sunrise-roles"/&gt;
   
  -             &lt;!-- Optional resource for creating a new user --&gt;
  -                         &lt;new-user 
uri="cocoon:raw://financeresource-sunrise-newuser"/&gt;
  +      &lt;!-- Optional resource for creating a new user --&gt;
  +      &lt;new-user uri="cocoon:raw://financeresource-sunrise-newuser"/&gt;
   
  -             &lt;!-- Optional resource for creating a new role --&gt;
  -                         &lt;new-role 
uri="cocoon:raw://financeresource-sunrise-newrole"/&gt;
  +      &lt;!-- Optional resource for creating a new role --&gt;
  +      &lt;new-role uri="cocoon:raw://financeresource-sunrise-newrole"/&gt;
   
  -             &lt;!-- Optional resource for changing user information --&gt;
  -                         &lt;change-user 
uri="cocoon:raw://financeresource-sunrise-newuser"/&gt;
  +      &lt;!-- Optional resource for changing user information --&gt;
  +      &lt;change-user uri="cocoon:raw://financeresource-sunrise-newuser"/&gt;
   
  -             &lt;!-- Optional resource for deleting a role --&gt;
  -                         &lt;delete-role 
uri="cocoon:raw://financeresource-sunrise-delrole"/&gt;
  +      &lt;!-- Optional resource for deleting a role --&gt;
  +      &lt;delete-role uri="cocoon:raw://financeresource-sunrise-delrole"/&gt;
   
  -             &lt;!-- Optional resource for deleting a user--&gt;
  -                         &lt;delete-user 
uri="cocoon:raw://financeresource-sunrise-deluser"/&gt;
  -        &lt;/handler&gt;
  -    &lt;/handlers&gt;
  +      &lt;!-- Optional resource for deleting a user--&gt;
  +      &lt;delete-user uri="cocoon:raw://financeresource-sunrise-deluser"/&gt;
  +    &lt;/handler&gt;
  +  &lt;/handlers&gt;
   &lt;/action&gt;</source>
        <p>The entries are described in the following subchapters. All tags can
           have additional parameter definitions which are passed to the given 
resource,
           e.g:</p>
        <source>&lt;!-- Optional resource for deleting a user--&gt;
   &lt;delete-user uri="cocoon:raw://financeresource-sunrise-deluser"&gt;
  -      &lt;connection&gt;database&lt;/connection&gt;
  -      &lt;url&gt;db:usertable&lt;/url&gt;
  +  &lt;connection&gt;database&lt;/connection&gt;
  +  &lt;url&gt;db:usertable&lt;/url&gt;
   &lt;/delete-user&gt;</source>
        <s2 title="Getting Roles">
           <p>The <en>load-roles</en> resource is invoked from the framework 
whenever
  @@ -399,9 +398,9 @@
             the root node "roles" and for each role a subelement "role" with a 
text child
             of the rolename:</p>
           <source>&lt;roles&gt;
  -    &lt;role&gt;admin&lt;/role&gt;
  -    &lt;role&gt;guest&lt;/role&gt;
  -    &lt;role&gt;user&lt;/role&gt;
  +  &lt;role&gt;admin&lt;/role&gt;
  +  &lt;role&gt;guest&lt;/role&gt;
  +  &lt;role&gt;user&lt;/role&gt;
   &lt;/roles&gt;</source>
        </s2>
        <s2 title="Getting Users">
  @@ -423,14 +422,16 @@
           <p>The XML format of the resource should look like the
             following:</p>
           <source>&lt;users&gt;
  -    &lt;user&gt;
  -        &lt;ID&gt;authentication ID&lt;/ID&gt;
  -        &lt;role&gt;rolename&lt;/role&gt;
  -        &lt;data&gt; ... application specific data ... &lt;/data&gt;
  -    &lt;/user&gt;
  -    &lt;user&gt;
  -         ...
  -    &lt;/user&gt;
  +  &lt;user&gt;
  +    &lt;ID&gt;authentication ID&lt;/ID&gt;
  +    &lt;role&gt;rolename&lt;/role&gt;
  +    &lt;data&gt;
  +       ... application specific data ...
  +    &lt;/data&gt;
  +  &lt;/user&gt;
  +  &lt;user&gt;
  +    ...
  +  &lt;/user&gt;
       ...
   &lt;/users&gt;</source>
        </s2>
  @@ -464,40 +465,43 @@
     <s1 title="Configuration Summary">
        <p>Here is a brief summary of the authentication handler configuration: 
</p>
   
  -     <source>&lt;action name="auth-protect" ...&gt;
  -    &lt;handlers&gt;
  -        &lt;handler name="unique"&gt;
  -             &lt;redirect-to uri="cocoon:raw://loginpage"/&gt; &lt;!-- The 
redirect-to resource --&gt;
  -
  -             &lt;!-- Authentication resource --&gt;
  -             &lt;authentication uri="cocoon:raw://authenticationresource"&gt;
  -                 &lt;!-- optional parameters --&gt;
  -             &lt;/load&gt;
  -             &lt;!-- optional save resource --&gt;
  -             &lt;save uri="cocoon:raw://authenticationsaveresource"&gt;
  -                 &lt;!-- optional parameters --&gt;
  -             &lt;/save&gt;
  +     <source>&lt;action name="auth-protect"&gt;
  +  &lt;handlers&gt;
  +    &lt;handler name="unique"&gt;
  +      &lt;redirect-to uri="cocoon:raw://loginpage"/&gt; &lt;!-- The 
redirect-to resource --&gt;
  +      &lt;authentication uri="cocoon:raw://authenticationresource"/&gt; 
&lt;!-- Authentication resource --&gt;
  +
  +      &lt;load uri="cocoon:raw://authenticationsaveresource"&gt;
  +        &lt;!-- optional parameters --&gt;
  +      &lt;/load&gt;
  +      &lt;!-- optional save resource --&gt;
  +      &lt;save uri="cocoon:raw://authenticationsaveresource"&gt;
  +        &lt;!-- optional parameters --&gt;
  +      &lt;/save&gt;
  +
  +      &lt;applications&gt;
  +        &lt;!-- the applications for this handler --&gt;
  +        &lt;application name="unique"&gt;
  +
  +          &lt;!-- Loading/Saving --&gt;
  +          &lt;load uri="cocoon:raw://loadapp"&gt;
  +            &lt;!-- optional --&gt;
  +            &lt;!-- optional parameters --&gt;
  +          &lt;/load&gt;
  +          &lt;save uri="cocoon:raw://saveapp"&gt;
  +            &lt;!-- optional --&gt;
  +            &lt;!-- optional parameters --&gt;
  +          &lt;/save&gt;
  +          &lt;!-- module configurations: --&gt;
  +
  +          &lt;configuration name="portal"&gt;
  +            ...portal configuration
  +          &lt;/configuration&gt;
  +        &lt;/application&gt;
  +      &lt;/applications&gt;
   
  -             &lt;applications&gt; &lt;!-- the applications for this handler 
--&gt;
  -                 &lt;application name="unique"&gt;
  -
  -                     &lt;!-- Loading/Saving --&gt;
  -                     &lt;load uri="cocoon:raw://loadapp"&gt; &lt;!-- 
optional --&gt;
  -                        &lt;!-- optional parameters --&gt;
  -                     &lt;/load&gt;
  -                     &lt;save uri="cocoon:raw://saveapp"&gt; &lt;!-- 
optional --&gt;
  -                         &lt;!-- optional parameters --&gt;
  -                     &lt;/save&gt;
  -
  -                                                &lt;!-- module 
configurations: --&gt;
  -                     &lt;configuration name="portal"&gt;
  -                           ...portal configuration
  -                     &lt;/configuration&gt;
  -                 &lt;/application&gt;
  -
  -             &lt;/applications&gt;
  -        &lt;/handler&gt;
  -    &lt;/handlers&gt;
  +    &lt;/handler&gt;
  +  &lt;/handlers&gt;
   &lt;/action&gt;</source>
     </s1>
     <s1 title="Pipeline Patterns">
  @@ -516,13 +520,13 @@
           </ol>
           <p>Example:</p>
           <source>&lt;map:match pattern="protected"&gt;
  -    &lt;map:act type="auth-protect"&gt;  &lt;!-- protect the resource --&gt;
  -        &lt;map:parameter name="handler" value="myhandler"/&gt;
  +  &lt;map:act type="auth-protect"&gt;  &lt;!-- protect the resource --&gt;
  +    &lt;map:parameter name="handler" value="myhandler"/&gt;
   
  -        &lt;map:generate src="resource.xml"/&gt;
  -        &lt;map:transform src="toHTML"/&gt;
  -        &lt;map:serialize/&gt;
  -    &lt;/map:act&gt;
  +    &lt;map:generate src="resource.xml"/&gt;
  +    &lt;map:transform src="toHTML"/&gt;
  +    &lt;map:serialize/&gt;
  +  &lt;/map:act&gt;
   &lt;/map:match&gt;</source>
           <p>It is very important that the auth-protect action wrapps the real
             pipeline, as the pipeline is only invoked if the action grants 
access. The
  @@ -546,23 +550,22 @@
           </ol>
           <p>Example:</p>
           <source>&lt;map:match pattern="protected-*"&gt;
  +  &lt;map:act type="auth-protect"&gt; &lt;!-- protect the resource --&gt;
  +    &lt;map:parameter name="handler" value="myhandler"/&gt;
   
  -    &lt;map:act type="auth-protect"&gt;  &lt;!-- protect the resource --&gt;
  -        &lt;map:parameter name="handler" value="myhandler"/&gt;
  -
  -        &lt;map:match pattern="protected-first"&gt;
  -            &lt;map:generate src="resource1.xml"/&gt;
  -            &lt;map:transform src="toHTML"/&gt;
  -            &lt;map:serialize/&gt;
  -        &lt;/map:match&gt;
  +    &lt;map:match pattern="protected-first"&gt;
  +      &lt;map:generate src="resource1.xml"/&gt;
  +      &lt;map:transform src="toHTML"/&gt;
  +      &lt;map:serialize/&gt;
  +    &lt;/map:match&gt;
           ....
  -        &lt;map:match pattern="protected-second"&gt;
  -            &lt;map:generate src="resource2.xml"/&gt;
  -            &lt;map:transform src="toHTML"/&gt;
  -            &lt;map:serialize/&gt;
  -        &lt;/map:match&gt;
  -
  -    &lt;/map:act&gt;
  +    &lt;map:match pattern="protected-second"&gt;
  +      &lt;map:generate src="resource2.xml"/&gt;
  +      &lt;map:transform src="toHTML"/&gt;
  +      &lt;map:serialize/&gt;
  +    &lt;/map:match&gt;
  +  
  +  &lt;/map:act&gt;
   &lt;/map:match&gt;</source>
           <p>Very important - as explained with the single resource pattern - 
is
             the leading match before the action is performed. The second match 
is required
  @@ -576,15 +579,15 @@
             tag.</p>
           <source>&lt;map:match pattern="startpage"&gt;
   
  -    &lt;map:act type="auth-loggedIn"&gt;  &lt;!-- check authentication --&gt;
  -        &lt;map:parameter name="handler" value="myhandler"/&gt;
  +  &lt;map:act type="auth-loggedIn"&gt;  &lt;!-- check authentication --&gt;
  +    &lt;map:parameter name="handler" value="myhandler"/&gt;
   
  -        &lt;map:redirect-to uri="loggedInStartPage"/&gt;
  -    &lt;/map:act&gt;
  +    &lt;map:redirect-to uri="loggedInStartPage"/&gt;
  +  &lt;/map:act&gt;
   
  -    &lt;map:generate src="startpage.xml"/&gt;
  -    &lt;map:transform src="toHTML"/&gt;
  -    &lt;map:serialize/&gt;
  +  &lt;map:generate src="startpage.xml"/&gt;
  +  &lt;map:transform src="toHTML"/&gt;
  +  &lt;map:serialize/&gt;
   &lt;/map:match&gt;</source>
           <p>In the example above, if the user is already logged he is
             redirected to the <en>loggedInStartPage</en> resource. If he is 
not logged in
  @@ -594,34 +597,33 @@
             given handler - all values from the context to the sitemap, e.g. 
ID, role etc.
             These values can be used within the other components:</p>
           <source>&lt;map:match pattern"protected"&gt;
  -    &lt;map:act type="auth-protect"&gt;  &lt;!-- protect the resource --&gt;
  -        &lt;map:parameter name="handler" value="myhandler"/&gt;
  -
  -        &lt;!-- Append the ID of the user to the file name --&gt;
  -        &lt;map:generate src="resource_{ID}.xml"/&gt;
  -        &lt;map:transform src="toHTML"/&gt;
  -        &lt;map:serialize/&gt;
  +  &lt;map:act type="auth-protect"&gt;  &lt;!-- protect the resource --&gt;
  +    &lt;map:parameter name="handler" value="myhandler"/&gt;
   
  -    &lt;/map:act&gt;
  +    &lt;!-- Append the ID of the user to the file name --&gt;
  +    &lt;map:generate src="resource_{ID}.xml"/&gt;
  +    &lt;map:transform src="toHTML"/&gt;
  +    &lt;map:serialize/&gt;
   
  +  &lt;/map:act&gt;
   &lt;/map:match&gt;</source>
           <p>But the auth-loggedIn action does not give the included pipeline
             access to the authentication context belonging to the handler. If 
you want this, you
             have to nest the auth-protect action inside!</p>
           <source>&lt;map:match pattern"start"&gt;
   
  -    &lt;map:act type="auth-loggedIn"&gt;  &lt;!-- check authentication --&gt;
  -        &lt;map:parameter name="handler" value="myhandler"/&gt;
  +  &lt;map:act type="auth-loggedIn"&gt;  &lt;!-- check authentication --&gt;
  +    &lt;map:parameter name="handler" value="myhandler"/&gt;
   
  -        &lt;map:act type="auth-protect"&gt;  &lt;!-- give access to the 
context --&gt;
  -            &lt;map:parameter name="handler" value="myhandler"/&gt;
  +    &lt;map:act type="auth-protect"&gt;  &lt;!-- give access to the context 
--&gt;
  +      &lt;map:parameter name="handler" value="myhandler"/&gt;
   
  -            &lt;map:generate src="getinfofromcontext.xml"/&gt;
  -            &lt;map:transform src="session"/&gt;
  -            &lt;map:transform src="toHTML"/&gt;
  -            &lt;map:serialize/&gt;
  -        &lt;/map:act&gt;
  +      &lt;map:generate src="getinfofromcontext.xml"/&gt;
  +      &lt;map:transform src="session"/&gt;
  +      &lt;map:transform src="toHTML"/&gt;
  +      &lt;map:serialize/&gt;
       &lt;/map:act&gt;
  +  &lt;/map:act&gt;
   
   &lt;/map:match&gt;</source>
        </s2>
  
  
  
  1.2       +140 -145  
xml-cocoon2/src/documentation/xdocs/developing/session.xml
  
  Index: session.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/documentation/xdocs/developing/session.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- session.xml       23 Apr 2002 10:25:32 -0000      1.1
  +++ session.xml       8 May 2002 06:21:38 -0000       1.2
  @@ -101,33 +101,31 @@
             <p>The following example shows the use of several commands and in
                particular how the <em>mergexml</em> command can be used to 
manipulate context
                data.</p>
  -          <source>
  -&lt;resource xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
  -            &lt;session:createcontext name="trackdemo"/&gt;
  -   &lt;!-- build context data --&gt;
  -   &lt;session:setxml context="trackdemo" path="/"&gt;
  -     &lt;context&gt;
  -                            &lt;users&gt;
  -                                    &lt;user id="1"&gt;
  -                                            &lt;name&gt;Carsten&lt;/name&gt;
  -                                    &lt;/user&gt;
  -                            &lt;/users&gt;
  -     &lt;/context&gt;
  -   &lt;/session:setxml&gt;
  -        &lt;session:mergexml context="trackdemo" path="/context"&gt;
  -                    &lt;users&gt;
  -                            &lt;user id="1"&gt;
  -                                    &lt;name&gt;Ziegeler&lt;/name&gt;
  -                                    &lt;developer&gt;true&lt;/developer&gt;
  -                            &lt;/user&gt;
  -                            &lt;user id="2"&gt;
  -                                    &lt;name&gt;Walter&lt;/name&gt;
  -                            &lt;/user&gt;
  -                    &lt;/users&gt;
  -            &lt;/session:mergexml&gt;
  -    &lt;session:getxml context="trackdemo" path="/"/&gt;
  -&lt;/resource&gt;
  -</source>
  +          <source>&lt;resource 
xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
  +  &lt;session:createcontext name="trackdemo"/&gt;
  +  &lt;!-- build context data --&gt;
  +  &lt;session:setxml context="trackdemo" path="/"&gt;
  +    &lt;context&gt;
  +      &lt;users&gt;
  +        &lt;user id="1"&gt;
  +          &lt;name&gt;Carsten&lt;/name&gt;
  +        &lt;/user&gt;
  +      &lt;/users&gt;
  +    &lt;/context&gt;
  +  &lt;/session:setxml&gt;
  +  &lt;session:mergexml context="trackdemo" path="/context"&gt;
  +    &lt;users&gt;
  +      &lt;user id="1"&gt;
  +        &lt;name&gt;Ziegeler&lt;/name&gt;
  +        &lt;developer&gt;true&lt;/developer&gt;
  +      &lt;/user&gt;
  +      &lt;user id="2"&gt;
  +        &lt;name&gt;Walter&lt;/name&gt;
  +      &lt;/user&gt;
  +    &lt;/users&gt;
  +  &lt;/session:mergexml&gt;
  +  &lt;session:getxml context="trackdemo" path="/"/&gt;
  +&lt;/resource&gt;</source>
             <p>In the above example, a context for storing data is added. Using
                the <em>setxml</em> command data is then stored into the 
context. The following
                <em>mergexml</em> command then changes the name of user-1 and 
adds a further
  @@ -204,78 +202,79 @@
             "?param=aaa&amp;...".</p>
           <p>The complete context you can access via these commands has the
             following XML format:</p>
  -        <source>
  -       &lt;parameter&gt; &lt;-- All parameters: parameter names build the 
elements with the values as text node childs --&gt;
  -         &lt;firstparameter&gt;value of parameter&lt;/firstparameter&gt;
  -         &lt;secondparameter&gt;value of parameter&lt;/secondparameter&gt;
  -          &lt;/parameter&gt;
  -
  -    &lt;querystring&gt;the querystring with a leading '?' or 
empty&lt;querystring&gt;
  -                 (The querystring contains only parameters send by the GET 
method)
  -
  -       &lt;parametervalues&gt; &lt;-- All parameters. The tags are all 
inside the session namespace.
  -                                The generated xml can be used without 
modification for the
  -                                                              
session:connection command. --&gt;
  -
  -                          &lt;session:params&gt;
  -                              &lt;session:param&gt;
  -                                  &lt;session:name&gt;1st parameter 
name&lt;/session:name&gt;
  -                                  &lt;session:value&gt;1st parameter 
value&lt;/session:value&gt;
  -                              &lt;/session:param&gt;
  -                              ...
  -                              &lt;session:param&gt;
  -                                  &lt;session:name&gt;2nd parameter 
name&lt;/session:name&gt;
  -                                  &lt;session:value&gt;2nd parameter 
value&lt;/session:value&gt;
  -                              &lt;/session:param&gt;
  -                          &lt;/session:params&gt;
  -
  -                          &lt;!-- If a parameter has more than one value, 
for each value a
  -                          &lt;session:param&gt; block is generated. --&gt;
  -        &lt;/parametervalues&gt;
  -
  -          &lt;attributes&gt; &lt;!-- lists all attributes, attribute names 
build the elements
  -                      with the values as text node childs --&gt;
  -        &lt;/attributes&gt;
  -
  -        &lt;headers&gt; &lt;!-- lists all headers, header names build the 
elements
  -                   with the values as text node childs --&gt;
  -          &lt;/headers&gt;
  -
  -          &lt;cookies&gt; &lt;!-- lists all cookies --&gt;
  -               &lt;cookie name="..."&gt;
  -                      &lt;value&gt;the cookie value&lt;/value&gt;
  -                    &lt;name&gt;the name of the cookie&lt;/name&gt;
  -                      &lt;comment&gt;value&lt;/comment&gt;
  -                    &lt;domain&gt;value&lt;/domain&gt;
  -                      &lt;path&gt;value&lt;/path&gt;
  -                    &lt;maxAge&gt;value&lt;/maxAge&gt;
  -                      &lt;secure&gt;value&lt;/secure&gt;
  -                    &lt;version&gt;value&lt;/version&gt;
  -                  &lt;/cookie&gt;
  -    &lt;/cookies&gt;
  -
  -       &lt;characterEncoding&gt;value&lt;/characterEncoding&gt;
  -       &lt;contentLength&gt;value&lt;/contentLength&gt;
  -       &lt;contentType&gt;value&lt;/contentType&gt;
  -       &lt;protocol&gt;value&lt;/protocol&gt;
  -       &lt;remoteAddress&gt;value&lt;/remoteAddress&gt;
  -       &lt;remoteHost&gt;value&lt;/remoteHost&gt;
  -       &lt;scheme&gt;value&lt;/scheme&gt;
  -       &lt;serverName&gt;value&lt;/serverName&gt;
  -       &lt;serverPort&gt;value&lt;/serverPort&gt;
  -       &lt;authType&gt;value&lt;/authType&gt;
  -      &lt;method&gt;value&lt;/method&gt;
  -       &lt;contextPath&gt;value&lt;/contextPath&gt;
  -       &lt;pathInfo&gt;value&lt;/pathInfo&gt;
  -       &lt;pathTranslated&gt;value&lt;/pathTranslated&gt;
  -       &lt;remoteUser&gt;value&lt;/remoteUser&gt;
  -       &lt;requestedSessionId&gt;value&lt;/requestedSessionId&gt;
  -       &lt;requestURI&gt;value&lt;/requestURI&gt;
  -       &lt;servletPath&gt;value&lt;/servletPath&gt;
  -       
&lt;isRequestedSessionIdFromCookie&gt;value&lt;/isRequestedSessionIdFromCookie&gt;
  -       
&lt;isRequestedSessionIdFromCookie&gt;value&lt;/isRequestedSessionIdFromCookie&gt;
  -       
&lt;isRequestedSessionIdValid&gt;value&lt;/isRequestedSessionIdValid&gt;
  -  </source>
  +        <source>&lt;parameter&gt;
  +  &lt;!-- All parameters: parameter names build the elements with the values 
as text node childs --&gt;
  +  &lt;firstparameter&gt;value of parameter&lt;/firstparameter&gt;
  +  &lt;secondparameter&gt;value of parameter&lt;/secondparameter&gt;
  +&lt;/parameter&gt;
  +
  +&lt;querystring&gt;the querystring with a leading '?' or 
empty&lt;querystring&gt;
  +  (The querystring contains only parameters send by the GET method)
  +
  +&lt;parametervalues&gt;
  +  &lt;!-- All parameters. The tags are all inside the session namespace.
  +    The generated xml can be used without modification for the
  +    session:connection command. --&gt;
  +  &lt;session:params&gt;
  +    &lt;session:param&gt;
  +      &lt;session:name&gt;1st parameter name&lt;/session:name&gt;
  +      &lt;session:value&gt;1st parameter value&lt;/session:value&gt;
  +    &lt;/session:param&gt;
  +             ...
  +    &lt;session:param&gt;
  +      &lt;session:name&gt;2nd parameter name&lt;/session:name&gt;
  +      &lt;session:value&gt;2nd parameter value&lt;/session:value&gt;
  +    &lt;/session:param&gt;
  +  &lt;/session:params&gt;
  +  &lt;!-- If a parameter has more than one value, for each value a
  +      &lt;session:param&gt; block is generated. --&gt;
  +&lt;/parametervalues&gt;
  +
  +&lt;attributes&gt;
  +  &lt;!-- lists all attributes, attribute names build the elements
  +        with the values as text node childs --&gt;
  +&lt;/attributes&gt;
  +
  +&lt;headers&gt;
  +  &lt;!-- lists all headers, header names build the elements
  +       with the values as text node childs --&gt;
  +&lt;/headers&gt;
  +
  +&lt;cookies&gt;
  +  &lt;!-- lists all cookies --&gt;
  +  &lt;cookie name="..."&gt;
  +    &lt;value&gt;the cookie value&lt;/value&gt;
  +    &lt;name&gt;the name of the cookie&lt;/name&gt;
  +    &lt;comment&gt;value&lt;/comment&gt;
  +    &lt;domain&gt;value&lt;/domain&gt;
  +    &lt;path&gt;value&lt;/path&gt;
  +    &lt;maxAge&gt;value&lt;/maxAge&gt;
  +    &lt;secure&gt;value&lt;/secure&gt;
  +    &lt;version&gt;value&lt;/version&gt;
  +  &lt;/cookie&gt;
  +&lt;/cookies&gt;
  +
  +&lt;characterEncoding&gt;value&lt;/characterEncoding&gt;
  +&lt;contentLength&gt;value&lt;/contentLength&gt;
  +&lt;contentType&gt;value&lt;/contentType&gt;
  +&lt;protocol&gt;value&lt;/protocol&gt;
  +&lt;remoteAddress&gt;value&lt;/remoteAddress&gt;
  +&lt;remoteHost&gt;value&lt;/remoteHost&gt;
  +&lt;scheme&gt;value&lt;/scheme&gt;
  +&lt;serverName&gt;value&lt;/serverName&gt;
  +&lt;serverPort&gt;value&lt;/serverPort&gt;
  +&lt;authType&gt;value&lt;/authType&gt;
  +&lt;method&gt;value&lt;/method&gt;
  +&lt;contextPath&gt;value&lt;/contextPath&gt;
  +&lt;pathInfo&gt;value&lt;/pathInfo&gt;
  +&lt;pathTranslated&gt;value&lt;/pathTranslated&gt;
  +&lt;remoteUser&gt;value&lt;/remoteUser&gt;
  +&lt;requestedSessionId&gt;value&lt;/requestedSessionId&gt;
  +&lt;requestURI&gt;value&lt;/requestURI&gt;
  +&lt;servletPath&gt;value&lt;/servletPath&gt;
  
+&lt;isRequestedSessionIdFromCookie&gt;value&lt;/isRequestedSessionIdFromCookie&gt;
  
+&lt;isRequestedSessionIdFromCookie&gt;value&lt;/isRequestedSessionIdFromCookie&gt;
  
+&lt;isRequestedSessionIdValid&gt;value&lt;/isRequestedSessionIdValid&gt;</source>
        </s2>
        <s2 title="The Response Context - Accessing the Environment, Part Two">
           <p>The response context is an XML description of the current
  @@ -301,19 +300,17 @@
             <p>Cookies can be added either by setxml or by appendxml. There is
                no difference between these commands.</p>
             <source>&lt;session:setxml context="response" path="/cookie"&gt;
  -       &lt;!-- Now follows the cookie definition --&gt;
  -       &lt;name&gt;The cookie name&lt;/name&gt;
  -       &lt;value&gt;The value of the cookie&lt;/value&gt;
  -
  -       &lt;!-- The following are optional --&gt;
  -       &lt;path&gt;value&lt;/path&gt;
  -       &lt;domain&gt;value&lt;/domain&gt;
  -       &lt;secure&gt;true or false&lt;/secure&gt;
  -       &lt;comment&gt;value&lt;/comment&gt;
  -       &lt;maxAge&gt;value&lt;/maxAge&gt;
  -       &lt;version&gt;value&lt;/version&gt;
  -&lt;/session:setxml&gt;
  -       </source>
  +  &lt;!-- Now follows the cookie definition --&gt;
  +  &lt;name&gt;The cookie name&lt;/name&gt;
  +  &lt;value&gt;The value of the cookie&lt;/value&gt;
  +  &lt;!-- The following are optional --&gt;
  +  &lt;path&gt;value&lt;/path&gt;
  +  &lt;domain&gt;value&lt;/domain&gt;
  +  &lt;secure&gt;true or false&lt;/secure&gt;
  +  &lt;comment&gt;value&lt;/comment&gt;
  +  &lt;maxAge&gt;value&lt;/maxAge&gt;
  +  &lt;version&gt;value&lt;/version&gt;
  +&lt;/session:setxml&gt;</source>
           </s3>
        </s2>
        <s2 title="The Temporary Context">
  @@ -345,11 +342,11 @@
             of the user, you could generate a base xml file with the 
information about this
             form:</p>
           <source>&lt;page&gt;
  -      &lt;form&gt;
  -          &lt;action&gt;form-handling-page&lt;/action&gt;
  -          &lt;input name="forename" type="text"/&gt;
  -          &lt;input name="surname" type="text"/&gt;
  -      &lt;/form&gt;
  +  &lt;form&gt;
  +    &lt;action&gt;form-handling-page&lt;/action&gt;
  +    &lt;input name="forename" type="text"/&gt;
  +    &lt;input name="surname" type="text"/&gt;
  +  &lt;/form&gt;
   &lt;/page&gt;</source>
           <p>A stylesheet can transform this into valid html. The action tag
             indicates that the "form-handling-page" should be invoked by 
submitting the
  @@ -358,12 +355,12 @@
             sitemap and uses the session transformer. It could also read the 
following
             xml:</p>
           <source>&lt;page 
xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
  -    &lt;forename&gt;
  -        &lt;session:getxml context="request" path="/parameter/forename"/&gt;
  -    &lt;/forename&gt;
  -    &lt;surname&gt;
  -        &lt;session:getxml context="request" path="/parameter/surname"/&gt;
  -    &lt;/surname&gt;
  +  &lt;forename&gt;
  +    &lt;session:getxml context="request" path="/parameter/forename"/&gt;
  +  &lt;/forename&gt;
  +  &lt;surname&gt;
  +    &lt;session:getxml context="request" path="/parameter/surname"/&gt;
  +  &lt;/surname&gt;
   &lt;/page&gt;</source>
           <p>As the form values are appended to the request, <em>getxml</em>
             with specifying the path (which is the parameter name used for the 
input field)
  @@ -373,18 +370,18 @@
           <source>&lt;page 
xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
     &lt;session:setxml context="userdata" path="/user"&gt;
       &lt;forename&gt;
  -        &lt;session:getxml context="request" path="/parameter/forename"/&gt;
  +      &lt;session:getxml context="request" path="/parameter/forename"/&gt;
       &lt;/forename&gt;
       &lt;surname&gt;
  -        &lt;session:getxml context="request" path="/parameter/surname"/&gt;
  +      &lt;session:getxml context="request" path="/parameter/surname"/&gt;
       &lt;/surname&gt;
     &lt;/session:setxml&gt;
   &lt;/page&gt;</source>
           <p>The user data is now stored inside the session context "userdata",
             so the context has the following content:</p>
           <source>&lt;user&gt;
  -    &lt;forename&gt;Walter&lt;/forename&gt;
  -    &lt;surname&gt;Walterson&lt;/surname&gt;
  +  &lt;forename&gt;Walter&lt;/forename&gt;
  +  &lt;surname&gt;Walterson&lt;/surname&gt;
   &lt;/user&gt;</source>
        </s2>
        <s2 title="The Session Framework approach">
  @@ -397,15 +394,13 @@
             stored inside the session.</p>
           <p>The example from the previous chapter could look like this:</p>
           <source>&lt;page 
xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
  -      &lt;session:form name="myform"&gt;
  -          &lt;session:action&gt;the-next-page&lt;/session:action&gt;
  -          &lt;session:content&gt;
  -              &lt;session:inputxml name="forename" type="text"
  -                             context="userdata" path="/user/forename"/&gt;
  -              &lt;session:inputxml name="surname" type="text"
  -                             context="userdata" path="/user/surname"/&gt;
  -          &lt;/session:content&gt;
  -      &lt;/session:form&gt;
  +  &lt;session:form name="myform"&gt;
  +    &lt;session:action&gt;the-next-page&lt;/session:action&gt;
  +    &lt;session:content&gt;
  +      &lt;session:inputxml name="forename" type="text" context="userdata" 
path="/user/forename"/&gt;
  +      &lt;session:inputxml name="surname" type="text" context="userdata" 
path="/user/surname"/&gt;
  +    &lt;/session:content&gt;
  +  &lt;/session:form&gt;
   &lt;/page&gt;</source>
           <p>The form tag starts the form definition. The name attribute is
             required to distinct between different forms on the same page. The 
action tag
  @@ -416,10 +411,10 @@
             given path. The session transformer transforms by removing the 
namespace and
             the context attribute:</p>
           <source>&lt;page 
xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
  -      &lt;form action="the-next-page"&gt;
  -          &lt;inputxml name="forename" type="text"/&gt;
  -          &lt;inputxml name="surname" type="text"/&gt;
  -      &lt;/form&gt;
  +  &lt;form action="the-next-page"&gt;
  +    &lt;inputxml name="forename" type="text"/&gt;
  +    &lt;inputxml name="surname" type="text"/&gt;
  +  &lt;/form&gt;
   &lt;/page&gt;</source>
           <p>A stylesheet can now generate the appropriate html (or any other
             format). The main difference is, that the resource invoked by 
submitting the
  @@ -432,16 +427,16 @@
             about the user - <em>inputxml</em> inserts the current value 
inside the tag. So
             the xml streamed would after a second run would look like this:</p>
           <source>&lt;page 
xmlns:session="http://cocoon.apache.org/session/1.0"&gt;
  -      &lt;form action="the-next-page"&gt;
  -          &lt;inputxml name="forename" type="text"&gt;Walter&lt;/inputxml&gt;
  -          &lt;inputxml name="surname" 
type="text"&gt;Walterson&lt;/inputxml&gt;
  -      &lt;/form&gt;
  +  &lt;form action="the-next-page"&gt;
  +    &lt;inputxml name="forename" type="text"&gt;Walter&lt;/inputxml&gt;
  +    &lt;inputxml name="surname" type="text"&gt;Walterson&lt;/inputxml&gt;
  +  &lt;/form&gt;
   &lt;/page&gt;</source>
           <p>Like <em>getxml</em> it is also possible to provide default values
             for the input field, if the context does not contain any 
information:</p>
           <source>&lt;session:inputxml name="forename" context="userdata" 
path="/user/forename"&gt;
        Defaultname
  -&lt;/session:xml&gt;</source>
  +&lt;/session:inputxml&gt;</source>
        </s2>
     </s1>
   </body>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to