vgritsenko    02/05/30 05:58:13

  Modified:    src/documentation/xdocs/developing Tag: cocoon_2_0_3_branch
                        sunshine-contexts.xml
  Log:
  fit into screen
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.2   +183 -154  
xml-cocoon2/src/documentation/xdocs/developing/Attic/sunshine-contexts.xml
  
  Index: sunshine-contexts.xml
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/documentation/xdocs/developing/Attic/sunshine-contexts.xml,v
  retrieving revision 1.2.2.1
  retrieving revision 1.2.2.2
  diff -u -r1.2.2.1 -r1.2.2.2
  --- sunshine-contexts.xml     24 May 2002 14:06:28 -0000      1.2.2.1
  +++ sunshine-contexts.xml     30 May 2002 12:58:13 -0000      1.2.2.2
  @@ -9,12 +9,12 @@
       </header>
       <body>
     <s1 title="Introduction">
  -    <p>IMPORTANT: sunShine is part of the scratchpad area of Cocoon. This means it
  +    <note><strong>IMPORTANT:</strong> sunShine is part of the scratchpad area of 
Cocoon. This means it
          is not officially released yet. The API and functionality might change
           before it is moved into the official release. Using this is at your own 
risk!
           If you want to catch the latest status of these components check out Cocoon 
           from CVS!
  -    </p>
  +    </note>
        <p>A session is a data storage which resides on the server and records
           information about one single user. sunShine creates a session on demand and
           from that point of time the user is tracked and information can be stored
  @@ -109,31 +109,34 @@
                data.</p>
             <source>
   &lt;resource xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
  -            &lt;sunshine:createcontext name="trackdemo"/&gt;
  -   &lt;!-- build context data --&gt;
  -   &lt;sunshine: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;/sunshine:setxml&gt;
  -        &lt;sunshine: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;/sunshine:mergexml&gt;
  -    &lt;sunshine:getxml context="trackdemo" path="/"/&gt;
  -&lt;/resource&gt;
  -</source>
  +  &lt;sunshine:createcontext name="trackdemo"/&gt;
  +
  +  &lt;!-- build context data --&gt;
  +  &lt;sunshine: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;/sunshine:setxml&gt;
  +
  +  &lt;sunshine: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;/sunshine:mergexml&gt;
  +
  +  &lt;sunshine: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
  @@ -211,76 +214,81 @@
           <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 
sunshine namespace.
  -                                The generated xml can be used without modification 
for the
  -                                                              sunshine:connection 
command. --&gt;
  -
  -                          &lt;sunshine:params&gt;
  -                              &lt;sunshine:param&gt;
  -                                  &lt;sunshine:name&gt;1st parameter 
name&lt;/sunshine:name&gt;
  -                                  &lt;sunshine:value&gt;1st parameter 
value&lt;/sunshine:value&gt;
  -                              &lt;/sunshine:param&gt;
  -                              ...
  -                              &lt;sunshine:param&gt;
  -                                  &lt;sunshine:name&gt;2nd parameter 
name&lt;/sunshine:name&gt;
  -                                  &lt;sunshine:value&gt;2nd parameter 
value&lt;/sunshine:value&gt;
  -                              &lt;/sunshine:param&gt;
  -                          &lt;/sunshine:params&gt;
  -
  -                          &lt;!-- If a parameter has more than one value, for each 
value a
  -                          &lt;sunshine: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;
  +&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;-- The querystring contains only parameters send by the GET method --&gt;
  +&lt;querystring&gt;the querystring with a leading '?' or empty&lt;querystring&gt;
  +
  +&lt;-- All parameters. The tags are all inside the sunshine namespace.
  +     The generated xml can be used without modification for the
  +     sunshine:connection command. --&gt;
  +&lt;parametervalues&gt;
  +  &lt;sunshine:params&gt;
  +    &lt;sunshine:param&gt;
  +      &lt;sunshine:name&gt;1st parameter name&lt;/sunshine:name&gt;
  +      &lt;sunshine:value&gt;1st parameter value&lt;/sunshine:value&gt;
  +    &lt;/sunshine:param&gt;
  +    ...
  +    &lt;sunshine:param&gt;
  +      &lt;sunshine:name&gt;2nd parameter name&lt;/sunshine:name&gt;
  +      &lt;sunshine:value&gt;2nd parameter value&lt;/sunshine:value&gt;
  +    &lt;/sunshine:param&gt;
  +  &lt;/sunshine:params&gt;
  +
  +  &lt;!-- If a parameter has more than one value, for each value a
  +       &lt;sunshine:param&gt; block is generated. --&gt;
  +&lt;/parametervalues&gt;
  +
  +&lt;!-- lists all attributes, attribute names build the elements
  +     with the values as text node childs --&gt;
  +&lt;attributes&gt;
  +&lt;/attributes&gt;
  +
  +&lt;!-- lists all headers, header names build the elements
  +     with the values as text node childs --&gt;
  +&lt;headers&gt;
  +&lt;/headers&gt;
  +
  +&lt;!-- lists all cookies --&gt;
  +&lt;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">
  @@ -297,29 +305,33 @@
                <em>appendxml</em>. If <em>setxml</em> is used, the header with the 
name gets
                the given value, regardless if the header had any value beforehand or 
not. If
                <em>appendxml</em> is used the value will be added.</p>
  -          <source>&lt;sunshine:setxml context="response" 
path="/header/headername"&gt;The value&lt;/sunshine:setxml&gt;
  +          <source>
  +&lt;sunshine:setxml context="response"
  +                 path="/header/headername"&gt;The value&lt;/sunshine:setxml&gt;
   
      or
   
  -&lt;sunshine:appendxml context="response" path="/header/headername"&gt;The 
value&lt;/sunshine:appendxml&gt;</source>
  +&lt;sunshine:appendxml context="response"
  +                    path="/header/headername"&gt;The 
value&lt;/sunshine:appendxml&gt;</source>
           </s3>
           <s3 title="Adding cookies">
             <p>Cookies can be added either by setxml or by appendxml. There is
                no difference between these commands.</p>
  -          <source>&lt;sunshine: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;/sunshine:setxml&gt;
  -       </source>
  +          <source>
  +&lt;sunshine: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;/sunshine:setxml&gt;</source>
  +
           </s3>
        </s2>
        <s2 title="The Temporary Context">
  @@ -350,48 +362,56 @@
           <p>If you want to create a form with two values - forename and surname
             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;
  +        <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;/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
             values.</p>
           <p>The "form-handling-page" is a pipeline which is declared in the
             sitemap and uses the sunShine transformer. It could also read the 
following
             xml:</p>
  -        <source>&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
  -    &lt;forename&gt;
  -        &lt;sunshine:getxml context="request" path="/parameter/forename"/&gt;
  -    &lt;/forename&gt;
  -    &lt;surname&gt;
  -        &lt;sunshine:getxml context="request" path="/parameter/surname"/&gt;
  -    &lt;/surname&gt;
  +        <source>
  +&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
  +  &lt;forename&gt;
  +    &lt;sunshine:getxml context="request" path="/parameter/forename"/&gt;
  +  &lt;/forename&gt;
  +  &lt;surname&gt;
  +    &lt;sunshine: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)
             inserts the value submitted by the user into the xml stream.</p>
           <p>If you want to write the information in a session context, you must
             wrap the whole xml inside a setxml:</p>
  -        <source>&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
  +        <source>
  +&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
     &lt;sunshine:setxml context="userdata" path="/user"&gt;
       &lt;forename&gt;
  -        &lt;sunshine:getxml context="request" path="/parameter/forename"/&gt;
  +      &lt;sunshine:getxml context="request" path="/parameter/forename"/&gt;
       &lt;/forename&gt;
       &lt;surname&gt;
  -        &lt;sunshine:getxml context="request" path="/parameter/surname"/&gt;
  +      &lt;sunshine:getxml context="request" path="/parameter/surname"/&gt;
       &lt;/surname&gt;
     &lt;/sunshine: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;
  +        <source>
  +&lt;user&gt;
  +  &lt;forename&gt;Walter&lt;/forename&gt;
  +  &lt;surname&gt;Walterson&lt;/surname&gt;
   &lt;/user&gt;</source>
  +
        </s2>
        <s2 title="The sunShine approach">
           <p>The previous chapter showed the common approach for handling form
  @@ -402,17 +422,19 @@
             and in addition the information about where the submitted values should be
             stored inside the session.</p>
           <p>The example from the previous chapter could look like this:</p>
  -        <source>&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
  -      &lt;sunshine:form name="myform"&gt;
  -          &lt;sunshine:action&gt;the-next-page&lt;/sunshine:action&gt;
  -          &lt;sunshine:content&gt;
  -              &lt;sunshine:inputxml name="forename" type="text"
  -                             context="userdata" path="/user/forename"/&gt;
  -              &lt;sunshine:inputxml name="surname" type="text"
  -                             context="userdata" path="/user/surname"/&gt;
  -          &lt;/sunshine:content&gt;
  -      &lt;/sunshine:form&gt;
  +        <source>
  +&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/1.0"&gt;
  +  &lt;sunshine:form name="myform"&gt;
  +    &lt;sunshine:action&gt;the-next-page&lt;/sunshine:action&gt;
  +    &lt;sunshine:content&gt;
  +      &lt;sunshine:inputxml name="forename" type="text"
  +                         context="userdata" path="/user/forename"/&gt;
  +      &lt;sunshine:inputxml name="surname" type="text"
  +                         context="userdata" path="/user/surname"/&gt;
  +    &lt;/sunshine:content&gt;
  +  &lt;/sunshine: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
             defines the url invoked by the form and the content tag describes the 
content
  @@ -421,12 +443,14 @@
             contains form values which should be stored in the specified context 
under the
             given path. The sunShine transformer transforms by removing the namespace 
and
             the context attribute:</p>
  -        <source>&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/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;
  +        <source>
  +&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/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;/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
             values has not to care about the form as sunShine maintains the form 
handling.
  @@ -437,17 +461,22 @@
           <p>For editing values - if the context already contains information
             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:sunshine="http://cocoon.apache.org/sunshine/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;
  +        <source>
  +&lt;page xmlns:sunshine="http://cocoon.apache.org/sunshine/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;/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;sunshine:inputxml name="forename" context="userdata" 
path="/user/forename"&gt;
  -     Defaultname
  +        <source>
  +&lt;sunshine:inputxml name="forename" context="userdata"
  +                   path="/user/forename"&gt;
  +  Defaultname
   &lt;/sunshine:xml&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