cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject cvs commit: cocoon-2.1/src/webapp/samples/xsp/xsp-js hello.xsp request.xsp response.xsp session.xsp simple.xsp
Date Sun, 07 Sep 2003 06:09:10 GMT
vgritsenko    2003/09/06 23:09:10

  Modified:    src/webapp/samples/xsp samples.xml sitemap.xmap
  Added:       src/webapp/samples/xsp/java cacheable.xsp cookie.xsp
                        hello.xsp logicsheet.xsp request.xsp resolver.xsp
                        response.xsp session.xsp sessionpage.xsp simple.xsp
                        upload.xsp
               src/webapp/samples/xsp/javascript hello.xsp request.xsp
                        response.xsp session.xsp simple.xsp
               src/webapp/samples/xsp/python hello.xsp
  Removed:     src/webapp/samples/xsp/xsp cacheable.xsp cookie.xsp
                        hello.xsp logicsheet.xsp request.xsp resolver.xsp
                        response.xsp session.xsp sessionpage.xsp simple.xsp
                        upload.xsp
               src/webapp/samples/xsp/xsp-js hello.xsp request.xsp
                        response.xsp session.xsp simple.xsp
  Log:
  Reinstate javascript and python samples.
  
  Revision  Changes    Path
  1.4       +11 -7     cocoon-2.1/src/webapp/samples/xsp/samples.xml
  
  Index: samples.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/xsp/samples.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- samples.xml	7 May 2003 04:57:15 -0000	1.3
  +++ samples.xml	7 Sep 2003 06:09:10 -0000	1.4
  @@ -49,10 +49,6 @@
      </sample>
     </group>
   
  -<!-- 
  -
  -  Excluded until fixed. 
  -  
     <group name="eXtensible Server Pages in Javascript">
      <sample name="Hello" href="js/hello">
       Hello in Javascript
  @@ -71,6 +67,14 @@
      </sample>
     </group>
   
  --->
  -  
  +  <group name="eXtensible Server Pages in Python">
  +   <note>
  +    This example requires python block, and jython.jar from www.jython.org.
  +    Tested with versions 2.1 and 2.0
  +   </note>
  +   <sample name="Hello" href="python/hello">
  +    Hello in Python
  +   </sample>
  +  </group>
  +
   </samples>
  
  
  
  1.4       +66 -50    cocoon-2.1/src/webapp/samples/xsp/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/webapp/samples/xsp/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	31 Jul 2003 04:25:48 -0000	1.3
  +++ sitemap.xmap	7 Sep 2003 06:09:10 -0000	1.4
  @@ -4,58 +4,74 @@
   
   <!-- =========================== Views =================================== -->
   
  - <map:views>
  -  <map:view name="content" from-label="content">
  -   <map:serialize type="xml"/>
  -  </map:view>
  -
  -  <map:view from-label="content" name="pretty-content">
  -    <map:transform src="context://stylesheets/system/xml2html.xslt"/>
  -    <map:serialize type="html"/>
  -  </map:view>
  -
  -  <map:view name="links" from-position="last">
  -   <map:serialize type="links"/>
  -  </map:view>
  - </map:views>
  +  <map:views>
  +    <map:view name="content" from-label="content">
  +      <map:serialize type="xml"/>
  +    </map:view>
  +
  +    <map:view from-label="content" name="pretty-content">
  +      <map:transform src="context://stylesheets/system/xml2html.xslt"/>
  +      <map:serialize type="html"/>
  +    </map:view>
  +
  +    <map:view name="links" from-position="last">
  +      <map:serialize type="links"/>
  +    </map:view>
  +  </map:views>
   
   <!-- =========================== Pipelines ================================= -->
   
  - <map:pipelines>
  -  <map:pipeline>
  +  <map:pipelines>
  +    <map:pipeline>
   
  -   <map:match pattern="">
  -     <map:generate src="samples.xml"/>
  -     <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  -       <map:parameter name="contextPath" value="{request:contextPath}"/>
  -     </map:transform>
  -     <map:serialize/>
  -   </map:match>
  -
  -   <map:match pattern="java/*">
  -    <map:generate src="xsp/{1}.xsp" type="serverpages"/>
  -    <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  -        <map:parameter name="servletPath" value="{request:servletPath}"/>
  -        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  -        <map:parameter name="contextPath" value="{request:contextPath}"/>
  -        <map:parameter name="file" value="xsp/{1}.xsp"/>
  -        <map:parameter name="remove" value="{0}"/>
  -    </map:transform>
  -    <map:serialize/>
  -   </map:match>
  -
  -   <map:match pattern="js/*">
  -    <map:generate src="xsp-js/{1}.xsp" type="serverpages"/>
  -    <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  -        <map:parameter name="servletPath" value="{request:servletPath}"/>
  -        <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  -        <map:parameter name="contextPath" value="{request:contextPath}"/>
  -        <map:parameter name="file" value="xsp-js/{1}.xsp"/>
  -        <map:parameter name="remove" value="{0}"/>
  -    </map:transform>
  -    <map:serialize/>
  -   </map:match>
  -   
  -  </map:pipeline>
  - </map:pipelines>
  +      <map:match pattern="">
  +        <map:generate src="samples.xml"/>
  +        <map:transform src="context://samples/common/style/xsl/html/simple-samples2html.xsl">
  +          <map:parameter name="contextPath" value="{request:contextPath}"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +      <map:match pattern="java/*">
  +        <map:generate src="java/{1}.xsp" type="serverpages"/>
  +        <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +          <map:parameter name="servletPath" value="{request:servletPath}"/>
  +          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +          <map:parameter name="contextPath" value="{request:contextPath}"/>
  +          <map:parameter name="file" value="xsp/{1}.xsp"/>
  +          <map:parameter name="remove" value="{0}"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +      <map:match pattern="js/*">
  +        <map:generate src="javascript/{1}.xsp" type="serverpages">
  +          <map:parameter name="programming-language" value="js"/>
  +        </map:generate>
  +        <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +          <map:parameter name="servletPath" value="{request:servletPath}"/>
  +          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +          <map:parameter name="contextPath" value="{request:contextPath}"/>
  +          <map:parameter name="file" value="xsp-js/{1}.xsp"/>
  +          <map:parameter name="remove" value="{0}"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +      <map:match pattern="python/*">
  +        <map:generate src="python/{1}.xsp" type="serverpages">
  +          <map:parameter name="programming-language" value="python"/>
  +        </map:generate>
  +        <map:transform src="context://samples/stylesheets/dynamic-page2html.xsl">
  +          <map:parameter name="servletPath" value="{request:servletPath}"/>
  +          <map:parameter name="sitemapURI" value="{request:sitemapURI}"/>
  +          <map:parameter name="contextPath" value="{request:contextPath}"/>
  +          <map:parameter name="file" value="xsp-js/{1}.xsp"/>
  +          <map:parameter name="remove" value="{0}"/>
  +        </map:transform>
  +        <map:serialize/>
  +      </map:match>
  +
  +    </map:pipeline>
  +  </map:pipelines>
   </map:sitemap>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/cacheable.xsp
  
  Index: cacheable.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!--
      XSP caching sample.
  
      WARNING - another sample depends on this!
      The output of this is used by the FOP cache test - if you modify this page, please make sure that
      the caching samples found at http://localhost:8888/samples/fop/welcome (or equivalent)
      still work .
  
      $Id: cacheable.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $
   -->
  
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
  <xsp:structure>
      <xsp:include>org.apache.excalibur.source.SourceValidity</xsp:include>
      <xsp:include>org.apache.cocoon.caching.CacheValidityToSourceValidity</xsp:include>
      <xsp:include>org.apache.cocoon.caching.DeltaTimeCacheValidity</xsp:include>
      <xsp:include>java.io.Serializable</xsp:include>
  </xsp:structure>
  
  <xsp:logic>
  
      // artificial slowdown to make the effects of the cache visible
      final int DELAY_SECS = 2;
  
      private int getValidityFromRequest() {
          int result = 15;
          try {
              result = Integer.valueOf(request.getParameter("validity")).intValue();
          } catch(Exception e) {
              // keep default value
          }
          return result;
      }
  
      /**
      * Generate the unique key for the cache.
      *
      * This key must be unique inside the space of this XSP page, it is used
      * to find the page contents in the cache (if getValidity says that the
      * contents are still valid).
      *
      * This method will be invoked before the getValidity() method.
      *
      * @return The generated key or null if the component
      *         is currently not cacheable.
      */
      public Serializable getKey()
      {
         // for our test, pages having the same value of "pageKey" will share
         // the same cache location
         return "" + request.getParameter("pageKey");
      }
  
      /**
      * Generate the validity object, tells the cache how long to
      * keep contents having this key around.
      *
      * Before this method can be invoked the getKey() method
      * will be invoked.
      *
      * @return The generated validity object or null if the
      *         component is currently not cacheable.
      */
      public SourceValidity getValidity() {
         // keep in cache for our validity time
         return CacheValidityToSourceValidity.createValidity(
             new DeltaTimeCacheValidity(0, getValidityFromRequest()));
      }
   </xsp:logic>
  
  
    <page>
      <title>A Cacheable XSP Page</title>
      <content>
          <para>
              Hi there! I'm a simple dynamic page generated by XSP (eXtensible Server Pages).
          </para>
  
          <para>
              I need <xsp:expr>DELAY_SECS</xsp:expr> seconds to be generated, so you can tell
              if I'm being served from the cache or not.
              <br/>
              What you see here has been generated on <b><xsp:expr>new java.util.Date()</xsp:expr></b>.
          </para>
  
          <para>
              I'm cached for every different value of request parameter 'pageKey'.
              <br/>
              Here the value is:
              <b><xsp-request:get-parameter name="pageKey"/></b>.
              <br/>
              If this is not the same as the 'pageKey' parameter in the page URL, we have a problem.
          </para>
  
          <para>
            All other request parameters do not influence cache status, but
              my validity will expire after <xsp:expr>getValidityFromRequest()</xsp:expr> seconds
              (set by 'validity' URL parameter when page is generated).
          </para>
  
          <para>
              Value of parameter 'other' is: <b><xsp:expr>String.valueOf(request.getParameter("other"))</xsp:expr></b>.
              <br/>
              This might be different than the URL parameter 'other', in case the version of the page you're
              seeing was cached from a request having the same 'pageKey' but a different value of 'other'.
  
          </para>
  
          <xsp:logic>
            // slowdown page generation.
              try {
                Thread.sleep(DELAY_SECS * 1000L);
              } catch (InterruptedException ie) {
                // Not much that can be done...
              }
          </xsp:logic>
  
          <para>Test links:
              <ul>
                  <li><a target="_new" href="cacheable?pageKey=one">pageKey=one</a></li>
                  <li><a target="_new" href="cacheable?pageKey=two">pageKey=two</a></li>
                  <li><a target="_new" href="cacheable?pageKey=three&amp;other=abc">pageKey=three, other=abc</a></li>
                  <li><a target="_new" href="cacheable?pageKey=three&amp;other=xyz">pageKey=three, other=xyz</a></li>
                  <li><a target="_new" href="cacheable?pageKey=three&amp;other=wow&amp;validity=5">pageKey=three, other=wow and 5 seconds of cache validity</a></li>
              </ul>
          </para>
      </content>
    </page>
  </xsp:page>
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/cookie.xsp
  
  Index: cookie.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: cookie.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
          xmlns:xsp="http://apache.org/xsp"
          xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0"
          xmlns:xsp-request="http://apache.org/xsp/request/2.0">
    
    <xsp:structure>
      <xsp:include>org.apache.cocoon.environment.Cookie</xsp:include>    
    </xsp:structure>
    
    <page>
      <title>COOKIE LOGIC SHEET TEST1</title>
      
      <br>Trying to generate a cookie with name=testname, value=testvalue, maxage=10 years </br>
      <xsp:logic>
        String testname = "testname";
        String testvalue = "testvalue";      
      </xsp:logic>
  
      <!-- Create cookie using constant name -->    
      <xsp-cookie:cookie>
        <xsp-cookie:name>testname1</xsp-cookie:name>
        <xsp-cookie:value>testvalue1</xsp-cookie:value>
        <xsp-cookie:setMaxAge><xsp:expr>10*365*24*60*60</xsp:expr></xsp-cookie:setMaxAge>
      </xsp-cookie:cookie>
  
      <!-- Create cookie using Java variable name -->    
      <xsp-cookie:cookie>
        <xsp-cookie:name><xsp:expr>testname</xsp:expr></xsp-cookie:name>
        <xsp-cookie:value><xsp:expr>testvalue</xsp:expr></xsp-cookie:value>
        <xsp-cookie:setMaxAge><xsp:expr>10*365*24*60*60</xsp:expr></xsp-cookie:setMaxAge>
      </xsp-cookie:cookie>            
      
      <br>Cookie Generated</br>
      
      <br>***********</br>
      <br> Cookies as XML </br>
        <xsp-cookie:getCookies as="xml"/>
      <br>***********</br>
      
      <br> Single cookie as XML (using "name" attribute) </br>      
        <xsp-cookie:getCookie as="xml" name="testname"/>
      <br>***********</br>
      
      <br> Single cookie as XML (using "index" attribute) </br>      
        <textarea cols="60" rows="8"><xsp-cookie:getCookie as="xml" index="0"/></textarea>
      <br>***********</br>
      
      <br> Name of cookie by using index </br>
        <xsp:logic>
          String name = <xsp-cookie:getName index="0"/>;
        </xsp:logic>
        <cookiename><xsp:expr>name</xsp:expr></cookiename>
      <br>***********</br>
      
      <br> Comment of cookie by using name </br>
        <xsp:logic>
          String commentbyname = <xsp-cookie:getComment name="testname"/>;
        </xsp:logic>
        <cookiecommentname><xsp:expr>commentbyname</xsp:expr></cookiecommentname>
      <br>***********</br>
      
      <br> Comment of cookie by using index </br>
        <xsp:logic>
          String commentbyindex = <xsp-cookie:getComment index="0"/>;
        </xsp:logic>
        <cookiecommentindex><xsp:expr>commentbyindex</xsp:expr></cookiecommentindex>
      <br>***********</br>
      
      <br> Domain of cookie by using name </br>
        <xsp:logic>
          String domainbyname = <xsp-cookie:getDomain name="testname"/>;
        </xsp:logic>
        <cookiedomainname><xsp:expr>domainbyname</xsp:expr></cookiedomainname>
      <br>***********</br>
  
      <br> Domain of cookie by using index </br>
        <xsp:logic>
          String domainbyindex = <xsp-cookie:getDomain index="0"/>;
        </xsp:logic>
        <cookiedomainindex><xsp:expr>domainbyindex</xsp:expr></cookiedomainindex>
      <br>***********</br>
      
      <br> MaxAge of cookie by using name </br>
        <xsp:logic>
          String maxagebyname = <xsp-cookie:getMaxAge name="testname"/>;
        </xsp:logic>
        <cookiemaxagename><xsp:expr>maxagebyname</xsp:expr></cookiemaxagename>
      <br>***********</br>
  
      <br> MaxAge of cookie by using index </br>
        <xsp:logic>
          String maxagebyindex = <xsp-cookie:getMaxAge index="0"/>;
        </xsp:logic>
        <cookiemaxageindex><xsp:expr>maxagebyindex</xsp:expr></cookiemaxageindex>
      <br>***********</br>
      
      <br> Path of cookie by using name </br>
        <xsp:logic>
          String pathbyname = <xsp-cookie:getPath name="testname"/>;
        </xsp:logic>
        <cookiepathname><xsp:expr>pathbyname</xsp:expr></cookiepathname>
      <br>***********</br>
  
      <br> Path of cookie by using index </br>
        <xsp:logic>
          String pathbyindex = <xsp-cookie:getPath index="0"/>;
        </xsp:logic>
        <cookiepathindex><xsp:expr>pathbyindex</xsp:expr></cookiepathindex>
      <br>***********</br>
      
      <br> Secure of cookie by using name </br>
        <xsp:logic>
          String securebyname = <xsp-cookie:getSecure name="testname"/>;
        </xsp:logic>
        <cookiesecurename><xsp:expr>securebyname</xsp:expr></cookiesecurename>
      <br>***********</br>
  
      <br> Secure of cookie by using index </br>
        <xsp:logic>
          String securebyindex = <xsp-cookie:getSecure index="0"/>;
        </xsp:logic>
        <cookiesecureindex><xsp:expr>securebyindex</xsp:expr></cookiesecureindex>
      <br>***********</br>
  
      <br> Value of cookie by using name </br>
        <xsp:logic>
          String valuebyname = <xsp-cookie:getValue name="testname"/>;
        </xsp:logic>
        <cookievaluename><xsp:expr>valuebyname</xsp:expr></cookievaluename>
      <br>***********</br>
  
      <br> Value of cookie by using index </br>
        <xsp:logic>
          String valuebyindex = <xsp-cookie:getValue index="0"/>;
        </xsp:logic>
        <cookievalueindex><xsp:expr>valuebyindex</xsp:expr></cookievalueindex>
      <br>***********</br>
      
      <br> Version of cookie by using name </br>
        <xsp:logic>
          String versionbyname = <xsp-cookie:getVersion name="testname"/>;
        </xsp:logic>
        <cookievaluename><xsp:expr>versionbyname</xsp:expr></cookievaluename>
      <br>***********</br>
  
      <br> Value of cookie by using index </br>
        <xsp:logic>
          String versionbyindex = <xsp-cookie:getVersion index="0"/>;
        </xsp:logic>
        <cookievalueindex><xsp:expr>versionbyindex</xsp:expr></cookievalueindex>
      <br>***********</br>
  
      <xsp:logic>
        Cookie cookie = <xsp-cookie:getCookie name="testname1"/>;
      </xsp:logic>
  
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/hello.xsp
  
  Index: hello.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: hello.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp">
  
    <page>
      <title>Hello</title>
      <content>
        <para>This is my first Cocoon page!</para>
  
        <xsp:element name="para">
          With the help of XSP and 
          <xsp:expr>Constants.COMPLETE_NAME</xsp:expr>
        </xsp:element>
      </content>
    </page>
  
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/logicsheet.xsp
  
  Index: logicsheet.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: logicsheet.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <!-- XSP can be assotiated with the logicsheet using processing
       instruction xml-logicsheet or the xsp:logicsheet element.
       Do not use both methods!
  
  <?xml-logicsheet href="logicsheets/hello.xsl"?>
  
  -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0"
            xmlns:xsp-hello="http://apache.org/xsp/hello/1.0">
  
    <xsp:logicsheet location="logicsheets/hello.xsl"/>
  
    <!-- Context URL also can be used:
  
    <xsp:logicsheet location="context://samples/xsp/logicsheets/hello.xsl"/>
  
       URL relative to the current sitemap CAN NOT be used, as 
       logicsheet is the global object, shared between all sitemaps.
    -->
  
    <page>
      <title>Greetings Page</title>
      <content>
        <xsp:logic>
          String name = <xsp-request:get-parameter name="name"/>;
          if (name == null) {
            <para>
              <!-- Print default greeting -->
              <xsp-hello:greeting name="Unknown"/>
              <form action="logicsheet">
                Please enter your name: <input name="name"/> <input type="submit"/>
              </form>
            </para>
          } else {
            <para>
              <!-- Override default greeting -->
              <xsp-hello:greeting value="Welcome to this small logicsheet sample">
                <!-- Alternate way of specifying name attribute -->
                <xsp-hello:name><xsp:expr>name</xsp:expr></xsp-hello:name>
              </xsp-hello:greeting>
            </para>
  
            <para>
              This greeting above was created using simple logicsheet.
            </para>
          }
        </xsp:logic>
      </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/request.xsp
  
  Index: request.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: request.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"  
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
  <page>
  
  <!-- Test set attribute using Java variable -->
  <xsp:logic>
    String attribute= "Test Attribute Value!";
  </xsp:logic>
  <xsp-request:set-attribute name="attr"><xsp:expr>attribute</xsp:expr></xsp-request:set-attribute>
  
  <!-- Test set attribute using constant -->
  <xsp-request:set-attribute name="attr">Test Attribute Value!!!</xsp-request:set-attribute>
  
  
  <h1>xsp-request logicsheet output</h1>
  <table border="1">
  <tr>
    <th>Logicsheet tag</th><th>Output</th><th>Java method</th><th>Output</th></tr>
  <tr>
    <td>get-uri</td><td><xsp-request:get-uri/></td>
    <td>getRequestURI</td><td><xsp:expr>request.getRequestURI()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-sitemap-uri</td><td><xsp-request:get-sitemap-uri/></td>
      </tr>
  <tr>
    <td>get-scheme</td><td><xsp-request:get-scheme/></td>
    <td>getScheme</td><td><xsp:expr>request.getScheme()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-character-encoding</td><td><xsp-request:get-character-encoding/></td>
    <td>getCharacterEncoding</td><td><xsp:expr>request.getCharacterEncoding()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-content-length</td><td><xsp-request:get-content-length/></td>
    <td>getContentLength</td><td><xsp:expr>request.getContentLength()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-content-type</td><td><xsp-request:get-content-type/></td>
    <td>getContentType</td><td><xsp:expr>request.getContentType()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-locale</td><td><xsp-request:get-locale/></td>
    <td>getLocale</td><td><xsp:expr>request.getLocale()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-locales</td><td><xsp:expr>String.valueOf(<xsp-request:get-locales as="array"/>)</xsp:expr></td>
    <td>getLocales</td><td><xsp:expr>String.valueOf(request.getLocales())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-parameter</td><td><xsp-request:get-parameter name="param"/></td>
    <td>getParameter</td><td><xsp:expr>request.getParameter("param")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-parameter with default </td><td><xsp-request:get-parameter name="param" default="default"/></td>
      </tr>
  <tr>
    <td>get-parameter-values (as array)</td><td><xsp:expr>String.valueOf(<xsp-request:get-parameter-values name="param" as="array"/>)</xsp:expr></td>
    <td>getParameterValues</td><td><xsp:expr>String.valueOf(request.getParameterValues("param"))</xsp:expr></td>
      </tr>
  <tr>
    <td>get-parameter-names (as array)</td><td><xsp:expr>String.valueOf(<xsp-request:get-parameter-names as="array"/>)</xsp:expr></td>
    <td>getParameterNames</td><td><xsp:expr>String.valueOf(request.getParameterNames())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-header accept</td><td><xsp-request:get-header name="accept"/></td>
    <td>getHeader</td><td><xsp:expr>request.getHeader("accept")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-header user-agent</td><td><xsp-request:get-header name="user-agent"/></td>
    <td>getHeader</td><td><xsp:expr>request.getHeader("user-agent")</xsp:expr></td>
      </tr>
  <!--
  get-int-header
  get-date-header
  -->
  <tr>
    <td>get-headers accept-language (as array)</td><td><xsp:expr>String.valueOf(<xsp-request:get-headers name="accept-language" as="array"/>)</xsp:expr></td>
    <td>getHeaders</td><td><xsp:expr>request.getHeaders("accept-language")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-header-names (as array)</td><td><xsp:expr>String.valueOf(<xsp-request:get-header-names as="array"/>)</xsp:expr></td>
    <td>getHeaderNames</td><td><xsp:expr>String.valueOf(request.getHeaderNames())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-attribute attr</td><td><xsp-request:get-attribute name="attr"/></td>
    <td>getAttribute</td><td><xsp:expr>request.getAttribute("attr")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-attribute-names (as array)</td><td><xsp:expr>String.valueOf(<xsp-request:get-attribute-names as="array"/>)</xsp:expr></td>
    <td>getAttributeNames</td><td><xsp:expr>String.valueOf(request.getAttributeNames())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-requested-url</td><td><xsp-request:get-requested-url/></td>
      </tr>
  <tr>
    <td>get-remote-address</td><td><xsp-request:get-remote-address/></td>
    <td>getRemoteAddr</td><td><xsp:expr>request.getRemoteAddr()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-remote-user</td><td><xsp-request:get-remote-user/></td>
    <td>getRemoteUser</td><td><xsp:expr>request.getRemoteUser()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-context-path</td><td><xsp-request:get-context-path/></td>
    <td>getContextPath</td><td><xsp:expr>request.getContextPath()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-path-info</td><td><xsp-request:get-path-info/></td>
    <td>getPathInfo</td><td><xsp:expr>request.getPathInfo()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-server-name</td><td><xsp-request:get-server-name/></td>
    <td>getServerName</td><td><xsp:expr>request.getServerName()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-server-port</td><td><xsp-request:get-server-port/></td>
    <td>getServerPort</td><td><xsp:expr>request.getServerPort()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-method</td><td><xsp-request:get-method/></td>
    <td>getMethod</td><td><xsp:expr>request.getMethod()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-query-string</td><td><xsp-request:get-query-string/></td>
    <td>getQueryString</td><td><xsp:expr>request.getQueryString()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-protocol</td><td><xsp-request:get-protocol/></td>
    <td>getProtocol</td><td><xsp:expr>request.getProtocol()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-remote-host</td><td><xsp-request:get-remote-host/></td>
    <td>getRemoteHost</td><td><xsp:expr>request.getRemoteHost()</xsp:expr></td>
      </tr>
  <tr>
    <td>is-secure</td><td><xsp-request:is-secure/></td>
    <td>isSecure</td><td><xsp:expr>request.isSecure()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-servlet-path</td><td><xsp-request:get-servlet-path/></td>
    <td>getServletPath</td><td><xsp:expr>request.getServletPath()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-user-principal</td><td><xsp-request:get-user-principal/></td>
    <td>getUserPrincipal</td><td><xsp:expr>request.getUserPrincipal()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-auth-type</td><td><xsp-request:get-auth-type/></td>
    <td>getAuthType</td><td><xsp:expr>request.getAuthType()</xsp:expr></td>
      </tr>
  <tr>
    <td>is-user-in-role</td><td><xsp-request:is-user-in-role role="admin"/></td>
    <td>isUserInRole</td><td><xsp:expr>request.isUserInRole("admin")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-requested-session-id</td><td><xsp-request:get-requested-session-id/></td>
    <td>getRequestedSessionId</td><td><xsp:expr>request.getRequestedSessionId()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-session-id</td><td><xsp-request:get-session-id/></td>
    <td>getSession.getId</td><td><xsp:expr>request.getSession().getId()</xsp:expr></td>
      </tr>
  </table>
  
  	<h1>xsp-request logicsheet output (as xml)</h1>
  <textarea cols="100" rows="30">
  get-uri                     <xsp-request:get-uri as="xml"/>
  get-sitemap-uri             <xsp-request:get-sitemap-uri as="xml"/>
  get-scheme                  <xsp-request:get-scheme as="xml"/>
  get-character-encoding      <xsp-request:get-character-encoding as="xml"/>
  get-content-length          <xsp-request:get-content-length as="xml"/>
  get-content-type            <xsp-request:get-content-type as="xml"/>
  get-locale                  <xsp-request:get-locale as="xml"/>
  get-locales                 <xsp-request:get-locales as="xml"/>
  get-parameter               <xsp-request:get-parameter name="param" as="xml"/>
  get-parameter with default  <xsp-request:get-parameter name="param" default="default" as="xml"/>
  get-parameter-values        <xsp-request:get-parameter-values name="param" as="xml"/>
  get-parameter-names         <xsp-request:get-parameter-names as="xml"/>
  get-header accept           <xsp-request:get-header name="accept" as="xml"/>
  get-header user-agent       <xsp-request:get-header name="user-agent" as="xml"/>
  get-header-names            <xsp-request:get-header-names as="xml"/>
  get-int-header - no sample
  get-date-header - no sample
  get-headers                 <xsp-request:get-headers name="accept-language" as="xml"/>
  get-attribute attr          <xsp-request:get-attribute name="attr" as="xml"/>
  get-attribute-names         <xsp-request:get-attribute-names as="xml"/>
  get-requested-url           <xsp-request:get-requested-url as="xml"/>
  get-remote-address          <xsp-request:get-remote-address as="xml"/>
  get-remote-user             <xsp-request:get-remote-user as="xml"/>
  get-context-path            <xsp-request:get-context-path as="xml"/>
  get-path-info               <xsp-request:get-path-info as="xml"/>
  get-server-name             <xsp-request:get-server-name as="xml"/>
  get-server-port             <xsp-request:get-server-port as="xml"/>
  get-method                  <xsp-request:get-method as="xml"/>
  get-query-string            <xsp-request:get-query-string as="xml"/>
  get-protocol                <xsp-request:get-protocol as="xml"/>
  get-remote-host             <xsp-request:get-remote-host as="xml"/>
  is-secure                   <xsp-request:is-secure as="xml"/>
  get-path-translated         <xsp-request:get-path-translated as="xml"/>
  get-servlet-path            <xsp-request:get-servlet-path as="xml"/>
  get-user-principal          <xsp-request:get-user-principal as="xml"/>
  get-auth-type               <xsp-request:get-auth-type as="xml"/>
  is-user-in-role             <xsp-request:is-user-in-role role="admin" as="xml"/>
  get-requested-session-id    <xsp-request:get-requested-session-id as="xml"/>
  get-session-id              <xsp-request:get-session-id as="xml"/>
  </textarea>
  
  <xsp-request:remove-attribute name="attr"/>
  
  <h2>Links</h2>
  <a href="request?param=value&amp;a=b&amp;x=y">Get</a>
  <br/>
  <form method="post" action="request">
  <input name="param"/>
  <input type="submit" value="Post"/>
  </form>
  
  
  </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/resolver.xsp
  
  Index: resolver.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <xsp:page language="java"
    xmlns:xsp="http://apache.org/xsp"
    xmlns:util="http://apache.org/xsp/util/2.0"
    xmlns:xsp-request="http://apache.org/xsp/request/2.0"
  >
    
    <page>
     <title>An XSP Page using a source</title>
     <content>
  <!-- obtain an InputStream -->
  	  <p>
  		this is the colorized source code of this page, included as text:
  	  </p>
  	  <table align="center" width="90%" bgcolor="#d0FFFF" border="1">
  		<tr>
  		  <td>
  			  <pre>
  			  <util:get-source>
  			    <util:param name="uri">cocoon://samples/view-source?filename=/samples/docs/samples/<xsp-request:get-sitemap-uri/>.xsp</util:param>
  			  </util:get-source>
  			  </pre>		  
  		  </td>
  		</tr>
  	  </table>
  
  <!-- obtain an InputSource instead of an InputStream -->
  	  <p>
  		this is the colorized source code of this page, included as XML:
  	  </p>
  	  <table align="center" width="90%" bgcolor="#d0FFFF" border="1">
  		<tr>
  		  <td>
  			  <util:include-source><util:param name="uri">cocoon://samples/view-source?filename=/samples/docs/samples/<xsp-request:get-sitemap-uri/>.xsp&amp;cocoon-view=content</util:param></util:include-source>
  		  </td>
  		</tr>
  	  </table>
  
        
     </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/response.xsp
  
  Index: response.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: response.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"  
            xmlns:xsp-response="http://apache.org/xsp/response/2.0">
  
  <page>
  
  <h1>xsp-response logicsheet output</h1>
  <table border="1">
  <tr>
    <th>Logicsheet tag</th><th>Output</th><th>Java method</th><th>Output</th></tr>
  <tr>
    <td>get-character-encoding</td><td><xsp-response:get-character-encoding/></td>
    <td>getCharacterEncoding</td><td><xsp:expr>response.getCharacterEncoding()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-locale</td><td><xsp-response:get-locale/></td>
    <td>getLocale</td><td><xsp:expr>response.getLocale()</xsp:expr></td>
      </tr>
  <tr>
    <td>set-locale to GERMANY</td><td>
      <xsp-response:set-locale><xsp:expr>java.util.Locale.GERMANY</xsp:expr></xsp-response:set-locale>
        </td>
      </tr>
  <tr>
    <td>get-locale</td><td><xsp-response:get-locale/></td>
    <td>getLocale</td><td><xsp:expr>response.getLocale()</xsp:expr></td>
      </tr>
  
  <xsp-response:set-locale><xsp:expr>java.util.Locale.getDefault()</xsp:expr></xsp-response:set-locale>
  
  <tr>
    <td>add-date-header</td><td>
      <xsp-response:add-date-header name="X-Cocoon-Date">
        <xsp-response:date><xsp:expr>new Date()</xsp:expr></xsp-response:date>
          </xsp-response:add-date-header></td>
    <td>addDateHeader</td><td><xsp:logic>response.addDateHeader("X-Java-Date", System.currentTimeMillis());</xsp:logic></td>
      </tr>
  
  <tr>
    <td>add-header</td><td>
      <xsp-response:add-header name="X-Cocoon-Header" value="Value!"/>
        </td>
    <td>addHeader</td><td><xsp:logic>response.addHeader("X-Java-Header", "Value!");</xsp:logic></td>
      </tr>
  
  <tr>
    <td>add-int-header</td><td>
      <xsp-response:add-int-header name="X-Cocoon-Int">
        <xsp-response:value><xsp:expr>5</xsp:expr></xsp-response:value>
          </xsp-response:add-int-header></td>
    <td>addIntHeader</td><td><xsp:logic>response.addIntHeader("X-Java-Int", 5);</xsp:logic></td>
      </tr>
  
  <tr>
    <td>contains-header</td><td>
      <xsp-response:contains-header name="X-Cocoon-Header"/>
        </td>
    <td>containsHeader</td><td><xsp:expr>response.containsHeader("X-Java-Header")</xsp:expr></td>
      </tr>
  
  <tr>
    <td>encode-url</td><td>
      <xsp-response:encode-url url="http://localhost:8080/cocoon/welcome"/>
        </td>
    <td>encodeURL</td><td><xsp:expr>response.encodeURL("http://localhost:8080/cocoon/welcome")</xsp:expr></td>
      </tr>
  <!--
  xsp-response:add-cookie
  xsp-response:set-date-header
  xsp-response:set-header
  xsp-response:set-int-header
  -->
  </table>
  
  	<h1>xsp-response logicsheet output (as xml)</h1>
  <textarea cols="100" rows="12">
  get-character-encoding      <xsp-response:get-character-encoding as="xml"/>
  get-locale                  <xsp-response:get-locale as="xml"/>
  contains-header             <xsp-response:contains-header name="X-Cocoon-Header" as="xml"/>
  encode-url                  <xsp-response:encode-url url="http://localhost:8080/cocoon/welcome" as="xml"/>
  </textarea>
  
  </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/session.xsp
  
  Index: session.xsp
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  
  <!-- CVS $Id: session.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-session="http://apache.org/xsp/session/2.0"
            create-session="yes">
    
  <page>
  
  <p>Adding attribute attr1='Test Value!'.</p>
  <xsp-session:set-attribute name="attr1">Test value!</xsp-session:set-attribute>
  <p>Set max inactive interval to 500</p>
  <xsp-session:set-max-inactive-interval interval="500"/>
  
  <h1>xsp-session logicsheet output</h1>
  
  <table border="1">
  <tr>
    <th>Logicsheet tag</th><th>Output</th></tr>
  <tr>
    <td>get-session-id</td><td><xsp-session:get-session-id/></td></tr>
  <tr>
    <td>get-attribute</td><td><xsp-session:get-attribute name="attr1"/></td></tr>
  <tr>
    <td>get-attribute-names</td><td><xsp:expr><xsp-session:get-attribute-names as="array"/></xsp:expr></td></tr>
  <tr>
    <td>get-creation-time</td><td><xsp-session:get-creation-time/></td></tr>
  <tr>
    <td>get-creation-time (string)</td><td><xsp-session:get-creation-time as="string"/></td></tr>
  <tr>
    <td>get-id</td><td><xsp-session:get-id/></td></tr>
  <tr>
    <td>get-last-accessed-time</td><td><xsp-session:get-last-accessed-time/></td></tr>
  <tr>
    <td>get-last-accessed-time (string)</td><td><xsp-session:get-last-accessed-time as="string"/></td></tr>
  <tr>
    <td>get-max-inactive-interval</td><td><xsp-session:get-max-inactive-interval/></td></tr>
  <tr>
    <td>is-new</td><td><xsp-session:is-new/></td></tr>
  </table>
  
  <h1>xsp-session logicsheet output (as xml)</h1>
  
  <textarea cols="100" rows="20">
  get-session-id              <xsp-session:get-session-id as="xml"/>
  get-attribute               <xsp-session:get-attribute name="attr1" as="xml"/>
  get-attribute-names         <xsp-session:get-attribute-names as="xml"/>
  get-creation-time           <xsp-session:get-creation-time as="xml"/>
  get-id                      <xsp-session:get-id as="xml"/>
  get-last-accessed-time      <xsp-session:get-last-accessed-time as="xml"/>
  get-max-inactive-interval   <xsp-session:get-max-inactive-interval as="xml"/>
  is-new                      <xsp-session:is-new as="xml"/>
  encode-url                  <xsp-session:encode-url href="../"/>
  form-encode-url             <xsp-session:form-encode-url href="../"/>
  </textarea>
  
  
  <p>Removing attribute attr1</p>
  <xsp-session:remove-attribute name="attr1"/>
  <p>Invalidating session</p>
  <xsp-session:invalidate/>
  
  </page>
  
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/sessionpage.xsp
  
  Index: sessionpage.xsp
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  
  <!-- CVS $Id: sessionpage.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-session="http://apache.org/xsp/session/2.0"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0"
            create-session="yes">
    
    <!-- a simple session page by Jörg Prante <joerg@7val.com> -->
    
    <page>
      <title>A Simple URI-based Session Example</title>
      <content>
        <para> <xsp-request:get-uri as="xml"/> </para>
        <para> Session ID = <xsp-session:get-id as="xml"/> </para>
        <para>
  	Encode URL Test =
  	<xsp-session:encode-url href="sessionpage">Follow me!</xsp-session:encode-url>
        </para>
             
        <para>Session parameter "my-param" is <xsp-session:get-attribute name="my-param" default="not set"/></para>
        
        <!-- set my-param for future visits to page -->
        <xsp-session:set-attribute name="my-param">set</xsp-session:set-attribute>
      </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/simple.xsp
  
  Index: simple.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: simple.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0"
            xmlns:log="http://apache.org/xsp/log/2.0"
            xmlns:capture="http://apache.org/cocoon/capture/1.0">
  
    <page>
    <log:logger name="xsp-sample" filename="xsp-sample.log"/>
    <log:debug>Processing the beginning of the page</log:debug>
  
     <title>A Simple XSP Page</title>
  
     <content>
  
     <capture:fragment-variable name="page_part">
       <para>These 2 paragraphs were generated at the start of the XSP, and captured for insertion at the end.</para>
  
       <para>Brought to you by Cocoon at <xsp:expr>new Date()</xsp:expr>.</para>
     </capture:fragment-variable>
  
     <para>Hi there! I'm a simple dynamic page generated by XSP (eXtensible Server Pages).</para>
  
     <para>I was requested as the URI: <b><xsp-request:get-uri as="xml"/></b></para>
  
     <para>The following list was dynamically generated:</para>
  
     <ul>
       <xsp:logic>
         <![CDATA[
         for (int i=0; i<3; i++) {
         ]]>
           <li>
             Item <xsp:expr>i</xsp:expr>
           </li>
         <![CDATA[
         } 
         ]]>
       </xsp:logic>
     </ul>
  
     <xsp:element>
       <xsp:param name="name"><xsp:expr>"P".toLowerCase()</xsp:expr></xsp:param>
       <xsp:attribute name="align">left</xsp:attribute>
       <i>
         This paragraph was dynamically generated by logic embedded in the page
       </i>
     </xsp:element>
  
     <para>
       Request parameter "name" as XML:
       <xsp-request:get-parameter name="name" default="Not provided" as="xml"/>
     </para>
  
     <para>
       Request parameter "name" as String:
       <xsp-request:get-parameter name="name" default="Not provided"/>
     </para>
  
     <para>
       Request parameter "name" as iso-8859-2 encoded String (with servlet
       container encoding iso-8859-1):
       <xsp-request:get-parameter name="name" default="Not provided"
         form-encoding="iso-8859-2" container-encoding="iso-8859-1"/>
     </para>
  
     <xsp-request:get-parameter-values name="name"/>
  
     <xsp-request:get-parameter-names/>
  
     <para>
       Header "user-agent" as XML:
       <xsp-request:get-header name="user-agent" as="xml"/>
     </para>
  
     <para>
       Header "user-agent" as String:
       <xsp-request:get-header name="user-agent"/>
     </para>
  
     <xsp-request:get-header-names/>
  
     <xsp:expr>page_part</xsp:expr>
     </content>
     <log:debug>Processing the end of the page</log:debug>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/java/upload.xsp
  
  Index: upload.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: upload.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="java"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-request="http://apache.org/xsp/request/2.0"
            xmlns:xsp-response="http://apache.org/xsp/response/2.0"
            xmlns:log="http://apache.org/xsp/log/2.0">
  
    <xsp:structure>
     <xsp:include>org.apache.cocoon.components.language.markup.xsp.XSPUtil</xsp:include>
     <xsp:include>org.apache.avalon.framework.context.ContextException</xsp:include>
    </xsp:structure>
  
    <xsp:logic>
    File uploadDir = null;
    /** Contextualize this class */
    public void contextualize(Context context) throws ContextException {
      uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR);
    }
    </xsp:logic>
  
    <page>
     <title>This form allows you upload files</title>
     <content>
     	 <para>Uploads in cocoon are handled automatically, as configured in web.xml.  
     	 The relevant init-params controlling upload behavior are: enable-uploads, 
     	 upload-directory, autosave-uploads, overwrite-uploads, upload-max-size.
     	 </para>
  	 <para>All files are cleaned out of the upload directory at the end of the 
  	 request.  The assumption is that other application logic will have acted on 
  	 the files during the request.</para>
       <para>
         <form method="post" enctype="multipart/form-data" action="upload">
           File:  <input type="file" name="uploaded_file" size="50" />
           <p>
             <input type="submit" value="Upload File" />
           </p>
         </form>
       </para>
       <para>
         <xsp:logic>
           if (<xsp-request:get-parameter name="uploaded_file"/> != null) {
             <xsp:content>
               Parameter uploaded_file:
               <strong>
                 <xsp-request:get-parameter name="uploaded_file"/>
               </strong>
               <br/>
  
               Parameter uploaded_file is instance of:
               <!-- note usage of get() instead of getParameter() -->
               <strong>
                 <xsp:expr>
                   request.get("uploaded_file").getClass()
                 </xsp:expr>
               </strong>
               <br/>
             </xsp:content>
           } else if (request.getContentType()!=null &amp;&amp; request.getContentType().indexOf("multipart/form-data") != -1) {
           	<para><strong>Either uploads are turned off, or you submitted a blank form.</strong></para>
           	<para>To enable uploads, ensure that the value for the init-param "enable-uploads" in web.xml is set to true.</para>
           }
         </xsp:logic>
  
         Upload directory content:
         <ul>
           <xsp:logic>
            getLogger().debug("Dir=" + uploadDir);
             String[] filelist = uploadDir.list();
             <![CDATA[
             getLogger().debug("List=" + filelist.length);
             for (int i = 0; i < filelist.length; i++) {
                getLogger().debug("File [" + i + "]=" + filelist[i]);
             ]]>
               <li>
                 <xsp:expr>filelist[i]</xsp:expr>
               </li>
             <![CDATA[
             }
             ]]>
           </xsp:logic>
         </ul>
       </para>
       <para>Brought to you by Cocoon at <xsp:expr>new Date()</xsp:expr>.</para>
     </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/javascript/hello.xsp
  
  Index: hello.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: hello.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
    <page>
      <title>Hello</title>
      <content>
        <para>This is my first Cocoon page!</para>
  
        <xsp:element name="para">
          With the help of XSP and Javascript!
        </xsp:element>
  
        <para>
          <p align="center">
            <xsp:logic>
              msg = "Executed at: ";
              <xsp:content>
                <xsp:expr>msg + new Date()</xsp:expr>
              </xsp:content>
            </xsp:logic>
          </p>
        </para>
      </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/javascript/request.xsp
  
  Index: request.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: request.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="javascript"
            xmlns:xsp="http://apache.org/xsp"  
            xmlns:xsp-request="http://apache.org/xsp/request/2.0">
  
  <page>
  
  <xsp-request:set-attribute name="attr">Test Attribute Value</xsp-request:set-attribute>
  
  <h1>xsp-request logicsheet output</h1>
  <table border="1">
  <tr>
    <th>Logicsheet tag</th><th>Output</th><th>Java method</th><th>Output</th></tr>
  <tr>
    <td>get-uri</td><td><xsp-request:get-uri/></td>
    <td>getRequestURI</td><td><xsp:expr>request.getRequestURI()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-sitemap-uri</td><td><xsp-request:get-sitemap-uri/></td>
      </tr>
  <tr>
    <td>get-scheme</td><td><xsp-request:get-scheme/></td>
    <td>getScheme</td><td><xsp:expr>request.getScheme()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-character-encoding</td><td><xsp-request:get-character-encoding/></td>
    <td>getCharacterEncoding</td><td><xsp:expr>request.getCharacterEncoding()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-content-length</td><td><xsp-request:get-content-length/></td>
    <td>getContentLength</td><td><xsp:expr>request.getContentLength()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-content-type</td><td><xsp-request:get-content-type/></td>
    <td>getContentType</td><td><xsp:expr>request.getContentType()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-locale</td><td><xsp-request:get-locale/></td>
    <td>getLocale</td><td><xsp:expr>request.getLocale()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-locales</td><td><xsp:expr>String(<xsp-request:get-locales as="array"/>)</xsp:expr></td>
    <td>getLocales</td><td><xsp:expr>String(request.getLocales())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-parameter</td><td><xsp-request:get-parameter name="param"/></td>
    <td>getParameter</td><td><xsp:expr>request.getParameter("param")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-parameter with default </td><td><xsp-request:get-parameter name="param" default="default"/></td>
      </tr>
  <tr>
    <td>get-parameter-values (as array)</td><td><xsp:expr>String(<xsp-request:get-parameter-values name="param" as="array"/>)</xsp:expr></td>
    <td>getParameterValues</td><td><xsp:expr>String(request.getParameterValues("param"))</xsp:expr></td>
      </tr>
  <tr>
    <td>get-parameter-names (as array)</td><td><xsp:expr>String(<xsp-request:get-parameter-names as="array"/>)</xsp:expr></td>
    <td>getParameterNames</td><td><xsp:expr>String(request.getParameterNames())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-header accept</td><td><xsp-request:get-header name="accept"/></td>
    <td>getHeader</td><td><xsp:expr>request.getHeader("accept")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-header user-agent</td><td><xsp-request:get-header name="user-agent"/></td>
    <td>getHeader</td><td><xsp:expr>request.getHeader("user-agent")</xsp:expr></td>
      </tr>
  <!--
  get-int-header
  get-date-header
  -->
  <tr>
    <td>get-headers accept-language (as array)</td><td><xsp:expr>String(<xsp-request:get-headers name="accept-language" as="array"/>)</xsp:expr></td>
    <td>getHeaders</td><td><xsp:expr>request.getHeaders("accept-language")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-header-names (as array)</td><td><xsp:expr>String(<xsp-request:get-header-names as="array"/>)</xsp:expr></td>
    <td>getHeaderNames</td><td><xsp:expr>String(request.getHeaderNames())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-attribute attr</td><td><xsp-request:get-attribute name="attr"/></td>
    <td>getAttribute</td><td><xsp:expr>request.getAttribute("attr")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-attribute-names (as array)</td><td><xsp:expr>String(<xsp-request:get-attribute-names as="array"/>)</xsp:expr></td>
    <td>getAttributeNames</td><td><xsp:expr>String(request.getAttributeNames())</xsp:expr></td>
      </tr>
  <tr>
    <td>get-requested-url</td><td><xsp-request:get-requested-url/></td>
      </tr>
  <tr>
    <td>get-remote-address</td><td><xsp-request:get-remote-address/></td>
    <td>getRemoteAddr</td><td><xsp:expr>request.getRemoteAddr()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-remote-user</td><td><xsp-request:get-remote-user/></td>
    <td>getRemoteUser</td><td><xsp:expr>request.getRemoteUser()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-context-path</td><td><xsp-request:get-context-path/></td>
    <td>getContextPath</td><td><xsp:expr>request.getContextPath()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-path-info</td><td><xsp-request:get-path-info/></td>
    <td>getPathInfo</td><td><xsp:expr>request.getPathInfo()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-server-name</td><td><xsp-request:get-server-name/></td>
    <td>getServerName</td><td><xsp:expr>request.getServerName()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-server-port</td><td><xsp-request:get-server-port/></td>
    <td>getServerPort</td><td><xsp:expr>request.getServerPort()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-method</td><td><xsp-request:get-method/></td>
    <td>getMethod</td><td><xsp:expr>request.getMethod()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-query-string</td><td><xsp-request:get-query-string/></td>
    <td>getQueryString</td><td><xsp:expr>request.getQueryString()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-protocol</td><td><xsp-request:get-protocol/></td>
    <td>getProtocol</td><td><xsp:expr>request.getProtocol()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-remote-host</td><td><xsp-request:get-remote-host/></td>
    <td>getRemoteHost</td><td><xsp:expr>request.getRemoteHost()</xsp:expr></td>
      </tr>
  <tr>
    <td>is-secure</td><td><xsp-request:is-secure/></td>
    <td>isSecure</td><td><xsp:expr>request.isSecure()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-servlet-path</td><td><xsp-request:get-servlet-path/></td>
    <td>getServletPath</td><td><xsp:expr>request.getServletPath()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-user-principal</td><td><xsp-request:get-user-principal/></td>
    <td>getUserPrincipal</td><td><xsp:expr>request.getUserPrincipal()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-auth-type</td><td><xsp-request:get-auth-type/></td>
    <td>getAuthType</td><td><xsp:expr>request.getAuthType()</xsp:expr></td>
      </tr>
  <tr>
    <td>is-user-in-role</td><td><xsp-request:is-user-in-role role="admin"/></td>
    <td>isUserInRole</td><td><xsp:expr>request.isUserInRole("admin")</xsp:expr></td>
      </tr>
  <tr>
    <td>get-requested-session-id</td><td><xsp-request:get-requested-session-id/></td>
    <td>getRequestedSessionId</td><td><xsp:expr>request.getRequestedSessionId()</xsp:expr></td>
      </tr>
  </table>
  
  	<h1>xsp-request logicsheet output (as xml)</h1>
  <textarea cols="100" rows="30">
  get-uri                     <xsp-request:get-uri as="xml"/>
  get-sitemap-uri             <xsp-request:get-sitemap-uri as="xml"/>
  get-scheme                  <xsp-request:get-scheme as="xml"/>
  get-character-encoding      <xsp-request:get-character-encoding as="xml"/>
  get-content-length          <xsp-request:get-content-length as="xml"/>
  get-content-type            <xsp-request:get-content-type as="xml"/>
  get-locale                  <xsp-request:get-locale as="xml"/>
  get-locales                 <xsp-request:get-locales as="xml"/>
  get-parameter               <xsp-request:get-parameter name="param" as="xml"/>
  get-parameter with default  <xsp-request:get-parameter name="param" default="default" as="xml"/>
  get-parameter-values        <xsp-request:get-parameter-values name="param" as="xml"/>
  get-parameter-names         <xsp-request:get-parameter-names as="xml"/>
  get-header accept           <xsp-request:get-header name="accept" as="xml"/>
  get-header user-agent       <xsp-request:get-header name="user-agent" as="xml"/>
  get-header-names            <xsp-request:get-header-names as="xml"/>
  get-int-header - no sample
  get-date-header - no sample
  get-headers - no sample
  get-headers                 <xsp-request:get-headers name="accept-language" as="xml"/>
  get-attribute attr          <xsp-request:get-attribute name="attr" as="xml"/>
  get-attribute-names         <xsp-request:get-attribute-names as="xml"/>
  get-requested-url           <xsp-request:get-requested-url as="xml"/>
  get-remote-address          <xsp-request:get-remote-address as="xml"/>
  get-remote-user             <xsp-request:get-remote-user as="xml"/>
  get-context-path            <xsp-request:get-context-path as="xml"/>
  get-path-info               <xsp-request:get-path-info as="xml"/>
  get-server-name             <xsp-request:get-server-name as="xml"/>
  get-server-port             <xsp-request:get-server-port as="xml"/>
  get-method                  <xsp-request:get-method as="xml"/>
  get-query-string            <xsp-request:get-query-string as="xml"/>
  get-protocol                <xsp-request:get-protocol as="xml"/>
  get-remote-host             <xsp-request:get-remote-host as="xml"/>
  is-secure                   <xsp-request:is-secure as="xml"/>
  get-servlet-path            <xsp-request:get-servlet-path as="xml"/>
  get-user-principal          <xsp-request:get-user-principal as="xml"/>
  get-auth-type               <xsp-request:get-auth-type as="xml"/>
  is-user-in-role             <xsp-request:is-user-in-role role="admin" as="xml"/>
  get-requested-session-id    <xsp-request:get-requested-session-id as="xml"/>
  </textarea>
  
  <xsp-request:remove-attribute name="attr"/>
  
  <h2>Links</h2>
  <a href="request-test?param=value&amp;a=b&amp;x=y">Get</a>
  <br/>
  <form method="post" action="request-test">
  <input name="param"/>
  <input type="submit" value="Post"/>
  </form>
  
  
  </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/javascript/response.xsp
  
  Index: response.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: response.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="javascript"
            xmlns:xsp="http://apache.org/xsp"  
            xmlns:xsp-response="http://apache.org/xsp/response/2.0">
  
  <page>
  
  <h1>xsp-response logicsheet output</h1>
  <table border="1">
  <tr>
    <th>Logicsheet tag</th><th>Output</th><th>Java method</th><th>Output</th></tr>
  <tr>
    <td>get-character-encoding</td><td><xsp-response:get-character-encoding/></td>
    <td>getCharacterEncoding</td><td><xsp:expr>response.getCharacterEncoding()</xsp:expr></td>
      </tr>
  <tr>
    <td>get-locale</td><td><xsp-response:get-locale/></td>
    <td>getLocale</td><td><xsp:expr>response.getLocale()</xsp:expr></td>
      </tr>
  <tr>
    <td>set-locale to GERMANY</td><td>
      <xsp-response:set-locale><xsp:expr>java.util.Locale.GERMANY</xsp:expr></xsp-response:set-locale>
        </td>
      </tr>
  <tr>
    <td>get-locale</td><td><xsp-response:get-locale/></td>
    <td>getLocale</td><td><xsp:expr>response.getLocale()</xsp:expr></td>
      </tr>
  
  <xsp-response:set-locale><xsp:expr>java.util.Locale.getDefault()</xsp:expr></xsp-response:set-locale>
  
  <tr>
    <td>add-date-header</td><td>
      <xsp-response:add-date-header name="X-Cocoon-Date">
        <xsp-response:date><xsp:expr>new java.util.Date()</xsp:expr></xsp-response:date>
          </xsp-response:add-date-header></td>
    <td>addDateHeader</td><td><xsp:logic>response.addDateHeader("X-Java-Date", -1);</xsp:logic></td>
      </tr>
  
  <tr>
    <td>add-header</td><td>
      <xsp-response:add-header name="X-Cocoon-Header" value="Value!"/>
        </td>
    <td>addHeader</td><td><xsp:logic>response.addHeader("X-Java-Header", "Value!");</xsp:logic></td>
      </tr>
  
  <tr>
    <td>add-int-header</td><td>
      <xsp-response:add-int-header name="X-Cocoon-Int">
        <xsp-response:value><xsp:expr>5</xsp:expr></xsp-response:value>
          </xsp-response:add-int-header></td>
    <td>addIntHeader</td><td><xsp:logic>response.addIntHeader("X-Java-Int", 5);</xsp:logic></td>
      </tr>
  
  <tr>
    <td>contains-header</td><td>
      <xsp-response:contains-header name="X-Cocoon-Header"/>
        </td>
    <td>containsHeader</td><td><xsp:expr>response.containsHeader("X-Java-Header")</xsp:expr></td>
      </tr>
  
  <tr>
    <td>encode-url</td><td>
      <xsp-response:encode-url url="http://localhost:8080/cocoon/welcome"/>
        </td>
    <td>encodeURL</td><td><xsp:expr>response.encodeURL("http://localhost:8080/cocoon/welcome")</xsp:expr></td>
      </tr>
  <!--
  xsp-response:add-cookie
  xsp-response:set-date-header
  xsp-response:set-header
  xsp-response:set-int-header
  -->
  </table>
  
  	<h1>xsp-response logicsheet output (as xml)</h1>
  <textarea cols="100" rows="12">
  get-character-encoding      <xsp-response:get-character-encoding as="xml"/>
  get-locale                  <xsp-response:get-locale as="xml"/>
  contains-header             <xsp-response:contains-header name="X-Cocoon-Header" as="xml"/>
  encode-url                  <xsp-response:encode-url url="http://localhost:8080/cocoon/welcome" as="xml"/>
  </textarea>
  
  </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/javascript/session.xsp
  
  Index: session.xsp
  ===================================================================
  <?xml version="1.0" encoding="iso-8859-1"?>
  
  <!-- CVS $Id: session.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="javascript"
            xmlns:xsp="http://apache.org/xsp"
            xmlns:xsp-session="http://apache.org/xsp/session/2.0"
            create-session="yes">
    
  <page>
  
  <p>Adding attribute attr1='Test Value!'.</p>
  <xsp-session:set-attribute name="attr1">Test value!</xsp-session:set-attribute>
  <p>Set max inactive interval to 500</p>
  <xsp-session:set-max-inactive-interval interval="500"/>
  
  <h1>xsp-session logicsheet output</h1>
  
  <table border="1">
  <tr>
    <th>Logicsheet tag</th><th>Output</th></tr>
  <tr>
    <td>get-session-id</td><td><xsp-session:get-session-id/></td></tr>
  <tr>
    <td>get-attribute</td><td><xsp-session:get-attribute name="attr1"/></td></tr>
  <tr>
    <td>get-attribute-names</td><td><xsp:expr><xsp-session:get-attribute-names as="array"/></xsp:expr></td></tr>
  <tr>
    <td>get-creation-time</td><td><xsp-session:get-creation-time/></td></tr>
  <tr>
    <td>get-creation-time (string)</td><td><xsp-session:get-creation-time as="string"/></td></tr>
  <tr>
    <td>get-id</td><td><xsp-session:get-id/></td></tr>
  <tr>
    <td>get-last-accessed-time</td><td><xsp-session:get-last-accessed-time/></td></tr>
  <tr>
    <td>get-last-accessed-time (string)</td><td><xsp-session:get-last-accessed-time as="string"/></td></tr>
  <tr>
    <td>get-max-inactive-interval</td><td><xsp-session:get-max-inactive-interval/></td></tr>
  <tr>
    <td>is-new</td><td><xsp-session:is-new/></td></tr>
  </table>
  
  <h1>xsp-session logicsheet output (as xml)</h1>
  
  <textarea cols="100" rows="20">
  get-session-id              <xsp-session:get-session-id as="xml"/>
  get-attribute               <xsp-session:get-attribute name="attr1" as="xml"/>
  get-attribute-names         <xsp-session:get-attribute-names as="xml"/>
  get-creation-time           <xsp-session:get-creation-time as="xml"/>
  get-id                      <xsp-session:get-id as="xml"/>
  get-last-accessed-time      <xsp-session:get-last-accessed-time as="xml"/>
  get-max-inactive-interval   <xsp-session:get-max-inactive-interval as="xml"/>
  is-new                      <xsp-session:is-new as="xml"/>
  encode-url                  <xsp-session:encode-url href="../" as="xml"/>
  form-encode-url             <xsp-session:form-encode-url href="../"/>
  </textarea>
  
  
  <p>Removing attribute attr1</p>
  <xsp-session:remove-attribute name="attr1"/>
  <p>Invalidating session</p>
  <xsp-session:invalidate/>
  
  </page>
  
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/javascript/simple.xsp
  
  Index: simple.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <!-- CVS $Id: simple.xsp,v 1.1 2003/09/07 06:09:10 vgritsenko Exp $ -->
  
  <xsp:page language="javascript" xmlns:xsp="http://apache.org/xsp">
    <page>
      <title>A Simple XSP Page in Javascript</title>
      <content>
        <para>Hi there! I'm a simple dynamic page generated by XSP (eXtensible Server Pages).</para>
        <para>
          Testing Javascript:
          <ul>
            <li>
              <xsp:logic>
                i = 1;
                <xsp:content>Integer in Javascript: <xsp:expr>i</xsp:expr>
                </xsp:content>
              </xsp:logic>
            </li>
            <li>
              <xsp:logic>
                s = "Test Javascript String";
                <xsp:content>String in Javascript: <xsp:expr>s</xsp:expr>
                </xsp:content>
              </xsp:logic>
            </li>
            <li>
              Java 'page' object: <xsp:expr>page</xsp:expr>
            </li>
            <li>
              Java 'request' object: <xsp:expr>request</xsp:expr>
            </li>
            <li>
              Request locale object: <xsp:expr>request.getLocale()</xsp:expr>
            </li>
            <li>
              Java Null object: <xsp:expr>request.getUserPrincipal()</xsp:expr>
            </li>
          </ul>
        </para>
      </content>
    </page>
  </xsp:page>
  
  
  
  1.1                  cocoon-2.1/src/webapp/samples/xsp/python/hello.xsp
  
  Index: hello.xsp
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <xsp:page language="python" xmlns:xsp="http://apache.org/xsp">
    <page>
      <title>Hello from XSP page in Python</title>
      <para>
        <b>This</b> is my first <b>Cocoon</b> page!
      </para>
  
      <xsp:element>
        <xsp:param name="name">para</xsp:param>
        With the help of XSP and Python!
      </xsp:element>
  
      <para>
        <xsp:logic>
          align = "center";
          <p>
            <xsp:attribute name="align"><xsp:expr>align</xsp:expr></xsp:attribute>
            <xsp:logic>
              msg = "Executed at: "
              import time
              now = time.asctime(time.localtime(time.time()))
              <xsp:content>
                Executed at:
                <xsp:expr>now</xsp:expr>
              </xsp:content>
            </xsp:logic>
          </p>
        </xsp:logic>
      </para>
    </page>
  </xsp:page>
  
  
  

Mime
View raw message