blob: cefef3f2e5c0236caee94bf05cb34342624fd0dd [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!-- CVS $Id$ -->
<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>