You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Yves Vindevogel <yv...@implements.be> on 2005/04/01 17:03:23 UTC

Example of Cookies

Hi,

Where can I find a newbie example on how to use cookies in cocoon ?
I need to drop a cookie on the client and read it back ...

Regards,
Yves


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Example of Cookies

Posted by Yves Vindevogel <yv...@implements.be>.
It is f..ck..ng frustrating that you find almost no documentation on 
this on the net.

First, the g..dd..mn session stuff is not working with ProxyPass.  
Suggestion is that I use cookies.
The example is not working, and there's not doc to find.

What is this ?
Cocoon falling apart ?


On 03 Apr 2005, at 15:34, Yves Vindevogel wrote:

> I can't get this to work.  The first part, setting the cookies, works. 
>  Or compiles at least.
> The second part, getting the cookies, fails with a compile error.
>
> This is part of my code
> (Setting the cookie)
>
> 											<esql:execute-query>
> 												<esql:query>select * from tblUsers where login = 
> '<xsp-request:get-parameter name="txtUsername"/>'</esql:query>
> 												
> 												<esql:results>
> 													<esql:row-results>
> 														<p>Welcome <b><esql:get-string 
> column="username"/></b>,</p>
> 														<p>You now have access to the reports on the database 
> "<b><esql:get-string column="dbase"/></b>".</p>
> 														<p>Click <a href="./reports.xsp">here</a>to go to the 
> report selection.</p>
> 													</esql:row-results>
>
> 													<xsp-cookie:create-cookies>
> 													   <xsp-cookie:cookie name="dbase">
> 													     <xsp-cookie:value>test</xsp-cookie:value>
> 													   </xsp-cookie:cookie>
> 													</xsp-cookie:create-cookies>	   												
> 												</esql:results>
> 											</esql:execute-query>
>
>
> (Reading the cookie)
>
> 			<div id="divLogo" style="position: absolute; right: 20px; top: 
> 10px; width: 200px; text-align: right">
> 				<xsp-cookie:getValue name="dbase"/>											
> 				
> 				<img src="images/logo.gif"/>
> 			</div>
>
>
> (Error message)
>
> org.apache.cocoon.ProcessingException: Language Exception: 
> org.apache.cocoon.components.language.LanguageException: Error 
> compiling reports_xsp: ERROR 1 
> (org/apache/cocoon/www/pdt/xsp/reports_xsp.java): ... 
> this.characters("\n\t\t\t\t"); XSPCookieHelper.getValue(objectModel, 
> "dbase" , -1) // start error (lines 431-431) "Syntax error on keyword 
> "this"; "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", 
> "^=", "|=", "++", "--" expected" 
> this.characters("\t\t\t\t\t\t\t\t\t\t\t"); // end error 
> this.characters("\n\t\t\t\t"); this.characters("\n\t\t\t\t"); ... Line 
> 431, column 0: Syntax error on keyword "this"; "=", "*=", "/=", "%=", 
> "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "++", "--" 
> expected
>
>
>>
>
> On 01 Apr 2005, at 17:55, gounis@osmosis.gr wrote:
>
>>
>> hi Yves
>>
>> a simple code fragment in XSP
>>
>> ...
>>         <xsp:logic>
>>                 String parent_role  = <xsp-request:get-parameter 
>> name="parent_role"/>;
>>                 String parent_id      = <xsp-request:get-parameter 
>> name="parent_id"/>;
>>
>>                  if (parent_id==null){
>>                     parent_id =
>> <xsp:expr>
>>  <xsp-cookie:getValue>											
>>   <xsp-cookie:name>												
>>  <xsp:expr>parent_role</xsp:expr>									
>>   </xsp-cookie:name>						
>>  </xsp-cookie:getValue>								
>> </xsp:expr>;
>> 										
>> <role><xsp:expr>parent_id</xsp:expr></role>
>>
>>                  }else{
>> <xsp-cookie:create-cookies>
>>    <xsp-cookie:cookie>
>>      <xsp-cookie:name>
>>        <xsp:expr>parent_role</xsp:expr>
>>      </xsp-cookie:name>
>>      <xsp-cookie:value>
>>        <xsp:expr>parent_id</xsp:expr>
>>      </xsp-cookie:value>
>>    </xsp-cookie:cookie>
>> </xsp-cookie:create-cookies>	
>>                 }
>> 		</xsp:logic>
>>
>> ...
>>
>> be carefull to declare namespaces
>> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
>> xmlns:esql="http://apache.org/cocoon/SQL/v2"
>> xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>> xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0">
>>
>> this is an 2 years old implementation in XSP i have found in my disk 
>> that
>> work
>>
>> i'll suggest you to use flow instead of XSP (but this depends of your
>> needs)
>>
>>
>> http://cocoon.apache.org/2.1/userdocs/flow/api.html
>> http://cocoon.apache.org/2.1/userdocs/flow/api.html#Cookie+Object
>>
>> regards
>>
>> stavros
>>
>>
>> On Fri, 1 Apr 2005, Yves Vindevogel wrote:
>>
>>> Hi,
>>>
>>> Where can I find a newbie example on how to use cookies in cocoon ?
>>> I need to drop a cookie on the client and read it back ...
>>>
>>> Regards,
>>> Yves
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>>
> Met vriendelijke groeten,
> Bien à vous,
> Kind regards,
>
> Yves Vindevogel
> Implements
>
> <Pasted Graphic 2.tiff>
>
> Mail: yves.vindevogel@implements.be  - Mobile: +32 (478) 80 82 91
>
> Kempische Steenweg 206 - 3500 Hasselt - Tel-Fax: +32 (11) 43 55 76
> Markt 18c  -  9700 Oudenaarde  -  Tel: +32 (55) 30 55 76
>
> Web: http://www.implements.be
>
> First they ignore you.  Then they laugh at you.  Then they fight you.  
> Then you win.
> Mahatma Ghandi.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Re: Example of Cookies

Posted by Yves Vindevogel <yv...@implements.be>.
No,
Does not work.

This is the full stack trace

Original Exception:  
org.apache.cocoon.components.language.LanguageException: Error  
compiling reports_xsp:
ERROR 1 (org/apache/cocoon/www/pdt/xsp/reports_xsp.java):
...
         this.characters("\n\t\t\t\t");

			XSPCookieHelper.getValue(objectModel, "dbase" , -1)
		

// start error (lines 433-433) "Syntax error on keyword "this"; "=",  
"*=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=",  
"++", "--" expected"
         this.characters("\n\t\t\t\t--");

// end error

         this.characters("\n\t\t\t\t");

         this.characters("\n\t\t\t\t");

...
Line 433, column 0: Syntax error on keyword "this"; "=", "*=", "/=",  
"%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "++", "--"  
expected
	at  
org.apache.cocoon.components.language.programming.java.JavaLanguage.comp 
ile(JavaLanguage.java:204)
	at  
org.apache.cocoon.components.language.programming.CompiledProgrammingLan 
guage.load(CompiledProgrammingLanguage.java:173)
	at  
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.loa 
dProgram(ProgramGeneratorImpl.java:399)
	at  
org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.loa 
d(ProgramGeneratorImpl.java:280)
	at  
org.apache.cocoon.generation.ServerPagesGenerator.setup(ServerPagesGener 
ator.java:170)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPi 
peline(AbstractProcessingPipeline.java:362)
	at  
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe 
line.setupPipeline(AbstractCachingProcessingPipeline.java:646)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.prepare 
Pipeline(AbstractProcessingPipeline.java:506)
	at  
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process 
(AbstractProcessingPipeline.java:464)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke( 
SerializeNode.java:120)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:49)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:130)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:126)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:101)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:336)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:277)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun 
tNode.java:103)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:49)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i 
nvoke(PreparableMatchNode.java:130)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P 
ipelineNode.java:126)
	at  
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode. 
invokeNodes(AbstractParentProcessingNode.java:72)
	at  
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke( 
PipelinesNode.java:101)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:336)
	at  
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro 
cessor.java:277)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
	at  
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java: 
1098)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at  
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica 
tionFilterChain.java:237)
	at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:157)
	at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:214)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:104)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
520)
	at  
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon 
textValve.java:198)
	at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:152)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:104)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
520)
	at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:137)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:104)
	at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:117)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:102)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
520)
	at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:109)
	at  
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo 
ntext.java:104)
	at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
520)
	at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
	at  
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
	at  
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java: 
799)
	at  
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC 
onnection(Http11Protocol.java:705)
	at  
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java: 
577)
	at  
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool 
.java:683)
	at java.lang.Thread.run(Thread.java:552)







On 04 Apr 2005, at 08:59, gounis@osmosis.gr wrote:

>
>
> hi Yves
>
> try to write your xml without change lines between elements
>
> <xsp-cookie:getValue><xsp-cookie:name><xsp:expr>parent_role</xsp: 
> expr></xsp-cookie:name></xsp-cookie:getValue>
>
>
>
>
>
> On Sun, 3 Apr 2005, Yves Vindevogel wrote:
>
>> I can't get this to work.  The first part, setting the cookies, works.
>> Or compiles at least.
>> The second part, getting the cookies, fails with a compile error.
>>
>> This is part of my code
>> (Setting the cookie)
>>
>> 											<esql:execute-query>
>> 												<esql:query>select * from tblUsers where login =
>> '<xsp-request:get-parameter name="txtUsername"/>'</esql:query>
>> 												
>> 												<esql:results>
>> 													<esql:row-results>
>> 														<p>Welcome <b><esql:get-string
>> column="username"/></b>,</p>
>> 														<p>You now have access to the reports on the database
>> "<b><esql:get-string column="dbase"/></b>".</p>
>> 														<p>Click <a href="./reports.xsp">here</a>to go to the
>> report selection.</p>
>> 													</esql:row-results>
>>
>> 													<xsp-cookie:create-cookies>
>> 													   <xsp-cookie:cookie name="dbase">
>> 													     <xsp-cookie:value>test</xsp-cookie:value>
>> 													   </xsp-cookie:cookie>
>> 													</xsp-cookie:create-cookies>	   												
>> 												</esql:results>
>> 											</esql:execute-query>
>>
>>
>> (Reading the cookie)
>>
>> 			<div id="divLogo" style="position: absolute; right: 20px; top:  
>> 10px;
>> width: 200px; text-align: right">
>> 				<xsp-cookie:getValue name="dbase"/>											
>> 				
>> 				<img src="images/logo.gif"/>
>> 			</div>
>>
>>
>> (Error message)
>>
>> org.apache.cocoon.ProcessingException: Language Exception:
>> org.apache.cocoon.components.language.LanguageException: Error
>> compiling reports_xsp: ERROR 1
>> (org/apache/cocoon/www/pdt/xsp/reports_xsp.java): ...
>> this.characters("\n\t\t\t\t"); XSPCookieHelper.getValue(objectModel,
>> "dbase" , -1) // start error (lines 431-431) "Syntax error on keyword
>> "this"; "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=",
>> "^=", "|=", "++", "--" expected"
>> this.characters("\t\t\t\t\t\t\t\t\t\t\t"); // end error
>> this.characters("\n\t\t\t\t"); this.characters("\n\t\t\t\t"); ... Line
>> 431, column 0: Syntax error on keyword "this"; "=", "*=", "/=", "%=",
>> "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "++", "--"  
>> expected
>>
>>
>>>
>>
>> On 01 Apr 2005, at 17:55, gounis@osmosis.gr wrote:
>>
>>>
>>> hi Yves
>>>
>>> a simple code fragment in XSP
>>>
>>> ...
>>>         <xsp:logic>
>>>                 String parent_role  = <xsp-request:get-parameter
>>> name="parent_role"/>;
>>>                 String parent_id      = <xsp-request:get-parameter
>>> name="parent_id"/>;
>>>
>>>                  if (parent_id==null){
>>>                     parent_id =
>>> <xsp:expr>
>>>  <xsp-cookie:getValue>											
>>>   <xsp-cookie:name>												
>>>  <xsp:expr>parent_role</xsp:expr>									
>>>   </xsp-cookie:name>						
>>>  </xsp-cookie:getValue>								
>>> </xsp:expr>;
>>> 										
>>> <role><xsp:expr>parent_id</xsp:expr></role>
>>>
>>>                  }else{
>>> <xsp-cookie:create-cookies>
>>>    <xsp-cookie:cookie>
>>>      <xsp-cookie:name>
>>>        <xsp:expr>parent_role</xsp:expr>
>>>      </xsp-cookie:name>
>>>      <xsp-cookie:value>
>>>        <xsp:expr>parent_id</xsp:expr>
>>>      </xsp-cookie:value>
>>>    </xsp-cookie:cookie>
>>> </xsp-cookie:create-cookies>	
>>>                 }
>>> 		</xsp:logic>
>>>
>>> ...
>>>
>>> be carefull to declare namespaces
>>> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
>>> xmlns:esql="http://apache.org/cocoon/SQL/v2"
>>> xmlns:xsp-request="http://apache.org/xsp/request/2.0"
>>> xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0">
>>>
>>> this is an 2 years old implementation in XSP i have found in my disk
>>> that
>>> work
>>>
>>> i'll suggest you to use flow instead of XSP (but this depends of your
>>> needs)
>>>
>>>
>>> http://cocoon.apache.org/2.1/userdocs/flow/api.html
>>> http://cocoon.apache.org/2.1/userdocs/flow/api.html#Cookie+Object
>>>
>>> regards
>>>
>>> stavros
>>>
>>>
>>> On Fri, 1 Apr 2005, Yves Vindevogel wrote:
>>>
>>>> Hi,
>>>>
>>>> Where can I find a newbie example on how to use cookies in cocoon ?
>>>> I need to drop a cookie on the client and read it back ...
>>>>
>>>> Regards,
>>>> Yves
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>>> For additional commands, e-mail: users-help@cocoon.apache.org
>>>
>>>
>>>
>> Met vriendelijke groeten,
>> Bien ΰ vous,
>> Kind regards,
>>
>> Yves Vindevogel
>> Implements
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Re: Example of Cookies

Posted by go...@osmosis.gr.

hi Yves

try to write your xml without change lines between elements

<xsp-cookie:getValue><xsp-cookie:name><xsp:expr>parent_role</xsp:expr></xsp-cookie:name></xsp-cookie:getValue>

 



On Sun, 3 Apr 2005, Yves Vindevogel wrote:

> I can't get this to work.  The first part, setting the cookies, works.  
> Or compiles at least.
> The second part, getting the cookies, fails with a compile error.
> 
> This is part of my code
> (Setting the cookie)
> 
> 											<esql:execute-query>
> 												<esql:query>select * from tblUsers where login = 
> '<xsp-request:get-parameter name="txtUsername"/>'</esql:query>
> 												
> 												<esql:results>
> 													<esql:row-results>
> 														<p>Welcome <b><esql:get-string 
> column="username"/></b>,</p>
> 														<p>You now have access to the reports on the database 
> "<b><esql:get-string column="dbase"/></b>".</p>
> 														<p>Click <a href="./reports.xsp">here</a>to go to the 
> report selection.</p>
> 													</esql:row-results>
> 
> 													<xsp-cookie:create-cookies>
> 													   <xsp-cookie:cookie name="dbase">
> 													     <xsp-cookie:value>test</xsp-cookie:value>
> 													   </xsp-cookie:cookie>
> 													</xsp-cookie:create-cookies>	   												
> 												</esql:results>
> 											</esql:execute-query>
> 
> 
> (Reading the cookie)
> 
> 			<div id="divLogo" style="position: absolute; right: 20px; top: 10px; 
> width: 200px; text-align: right">
> 				<xsp-cookie:getValue name="dbase"/>											
> 				
> 				<img src="images/logo.gif"/>
> 			</div>
> 
> 
> (Error message)
> 
> org.apache.cocoon.ProcessingException: Language Exception: 
> org.apache.cocoon.components.language.LanguageException: Error 
> compiling reports_xsp: ERROR 1 
> (org/apache/cocoon/www/pdt/xsp/reports_xsp.java): ... 
> this.characters("\n\t\t\t\t"); XSPCookieHelper.getValue(objectModel, 
> "dbase" , -1) // start error (lines 431-431) "Syntax error on keyword 
> "this"; "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", 
> "^=", "|=", "++", "--" expected" 
> this.characters("\t\t\t\t\t\t\t\t\t\t\t"); // end error 
> this.characters("\n\t\t\t\t"); this.characters("\n\t\t\t\t"); ... Line 
> 431, column 0: Syntax error on keyword "this"; "=", "*=", "/=", "%=", 
> "+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "++", "--" expected
> 
> 
> >
> 
> On 01 Apr 2005, at 17:55, gounis@osmosis.gr wrote:
> 
> >
> > hi Yves
> >
> > a simple code fragment in XSP
> >
> > ...
> >         <xsp:logic>
> >                 String parent_role  = <xsp-request:get-parameter 
> > name="parent_role"/>;
> >                 String parent_id      = <xsp-request:get-parameter 
> > name="parent_id"/>;
> >
> >                  if (parent_id==null){
> >                     parent_id =
> > <xsp:expr>
> >  <xsp-cookie:getValue>											
> >   <xsp-cookie:name>												
> >  <xsp:expr>parent_role</xsp:expr>									
> >   </xsp-cookie:name>						
> >  </xsp-cookie:getValue>								
> > </xsp:expr>;
> > 										
> > <role><xsp:expr>parent_id</xsp:expr></role>
> >
> >                  }else{
> > <xsp-cookie:create-cookies>
> >    <xsp-cookie:cookie>
> >      <xsp-cookie:name>
> >        <xsp:expr>parent_role</xsp:expr>
> >      </xsp-cookie:name>
> >      <xsp-cookie:value>
> >        <xsp:expr>parent_id</xsp:expr>
> >      </xsp-cookie:value>
> >    </xsp-cookie:cookie>
> > </xsp-cookie:create-cookies>	
> >                 }
> > 		</xsp:logic>
> >
> > ...
> >
> > be carefull to declare namespaces
> > <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
> > xmlns:esql="http://apache.org/cocoon/SQL/v2"
> > xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> > xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0">
> >
> > this is an 2 years old implementation in XSP i have found in my disk 
> > that
> > work
> >
> > i'll suggest you to use flow instead of XSP (but this depends of your
> > needs)
> >
> >
> > http://cocoon.apache.org/2.1/userdocs/flow/api.html
> > http://cocoon.apache.org/2.1/userdocs/flow/api.html#Cookie+Object
> >
> > regards
> >
> > stavros
> >
> >
> > On Fri, 1 Apr 2005, Yves Vindevogel wrote:
> >
> >> Hi,
> >>
> >> Where can I find a newbie example on how to use cookies in cocoon ?
> >> I need to drop a cookie on the client and read it back ...
> >>
> >> Regards,
> >> Yves
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> >> For additional commands, e-mail: users-help@cocoon.apache.org
> >>
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> > For additional commands, e-mail: users-help@cocoon.apache.org
> >
> >
> >
> Met vriendelijke groeten,
> Bien ΰ vous,
> Kind regards,
> 
> Yves Vindevogel
> Implements
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Example of Cookies

Posted by Yves Vindevogel <yv...@implements.be>.
I can't get this to work.  The first part, setting the cookies, works.  
Or compiles at least.
The second part, getting the cookies, fails with a compile error.

This is part of my code
(Setting the cookie)

											<esql:execute-query>
												<esql:query>select * from tblUsers where login = 
'<xsp-request:get-parameter name="txtUsername"/>'</esql:query>
												
												<esql:results>
													<esql:row-results>
														<p>Welcome <b><esql:get-string 
column="username"/></b>,</p>
														<p>You now have access to the reports on the database 
"<b><esql:get-string column="dbase"/></b>".</p>
														<p>Click <a href="./reports.xsp">here</a>to go to the 
report selection.</p>
													</esql:row-results>

													<xsp-cookie:create-cookies>
													   <xsp-cookie:cookie name="dbase">
													     <xsp-cookie:value>test</xsp-cookie:value>
													   </xsp-cookie:cookie>
													</xsp-cookie:create-cookies>	   												
												</esql:results>
											</esql:execute-query>


(Reading the cookie)

			<div id="divLogo" style="position: absolute; right: 20px; top: 10px; 
width: 200px; text-align: right">
				<xsp-cookie:getValue name="dbase"/>											
				
				<img src="images/logo.gif"/>
			</div>


(Error message)

org.apache.cocoon.ProcessingException: Language Exception: 
org.apache.cocoon.components.language.LanguageException: Error 
compiling reports_xsp: ERROR 1 
(org/apache/cocoon/www/pdt/xsp/reports_xsp.java): ... 
this.characters("\n\t\t\t\t"); XSPCookieHelper.getValue(objectModel, 
"dbase" , -1) // start error (lines 431-431) "Syntax error on keyword 
"this"; "=", "*=", "/=", "%=", "+=", "-=", "<<=", ">>=", ">>>=", "&=", 
"^=", "|=", "++", "--" expected" 
this.characters("\t\t\t\t\t\t\t\t\t\t\t"); // end error 
this.characters("\n\t\t\t\t"); this.characters("\n\t\t\t\t"); ... Line 
431, column 0: Syntax error on keyword "this"; "=", "*=", "/=", "%=", 
"+=", "-=", "<<=", ">>=", ">>>=", "&=", "^=", "|=", "++", "--" expected


>

On 01 Apr 2005, at 17:55, gounis@osmosis.gr wrote:

>
> hi Yves
>
> a simple code fragment in XSP
>
> ...
>         <xsp:logic>
>                 String parent_role  = <xsp-request:get-parameter 
> name="parent_role"/>;
>                 String parent_id      = <xsp-request:get-parameter 
> name="parent_id"/>;
>
>                  if (parent_id==null){
>                     parent_id =
> <xsp:expr>
>  <xsp-cookie:getValue>											
>   <xsp-cookie:name>												
>  <xsp:expr>parent_role</xsp:expr>									
>   </xsp-cookie:name>						
>  </xsp-cookie:getValue>								
> </xsp:expr>;
> 										
> <role><xsp:expr>parent_id</xsp:expr></role>
>
>                  }else{
> <xsp-cookie:create-cookies>
>    <xsp-cookie:cookie>
>      <xsp-cookie:name>
>        <xsp:expr>parent_role</xsp:expr>
>      </xsp-cookie:name>
>      <xsp-cookie:value>
>        <xsp:expr>parent_id</xsp:expr>
>      </xsp-cookie:value>
>    </xsp-cookie:cookie>
> </xsp-cookie:create-cookies>	
>                 }
> 		</xsp:logic>
>
> ...
>
> be carefull to declare namespaces
> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
> xmlns:esql="http://apache.org/cocoon/SQL/v2"
> xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0">
>
> this is an 2 years old implementation in XSP i have found in my disk 
> that
> work
>
> i'll suggest you to use flow instead of XSP (but this depends of your
> needs)
>
>
> http://cocoon.apache.org/2.1/userdocs/flow/api.html
> http://cocoon.apache.org/2.1/userdocs/flow/api.html#Cookie+Object
>
> regards
>
> stavros
>
>
> On Fri, 1 Apr 2005, Yves Vindevogel wrote:
>
>> Hi,
>>
>> Where can I find a newbie example on how to use cookies in cocoon ?
>> I need to drop a cookie on the client and read it back ...
>>
>> Regards,
>> Yves
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>
>
Met vriendelijke groeten,
Bien à vous,
Kind regards,

Yves Vindevogel
Implements


Re: Example of Cookies

Posted by Aurélien DEHAY <ad...@zorel.org>.
Hi.

Here is a flowscript sample:

var c_ident = cocoon.response.createCookie("myotis_ident",cookie_ident);
c_ident.maxAge = 365*24*60*60;
c_ident.path = "/";
cocoon.response.addCookie(c_ident);

For reading the cookie, I use the input module:

{request:cookies[name='myotis_ident']/@value}

Rgds.



Re: Example of Cookies

Posted by Yves Vindevogel <yv...@implements.be>.
Tnxalot

On 01 Apr 2005, at 17:55, gounis@osmosis.gr wrote:

>
> hi Yves
>
> a simple code fragment in XSP
>
> ...
>         <xsp:logic>
>                 String parent_role  = <xsp-request:get-parameter 
> name="parent_role"/>;
>                 String parent_id      = <xsp-request:get-parameter 
> name="parent_id"/>;
>
>                  if (parent_id==null){
>                     parent_id =
> <xsp:expr>
>  <xsp-cookie:getValue>											
>   <xsp-cookie:name>												
>  <xsp:expr>parent_role</xsp:expr>									
>   </xsp-cookie:name>						
>  </xsp-cookie:getValue>								
> </xsp:expr>;
> 										
> <role><xsp:expr>parent_id</xsp:expr></role>
>
>                  }else{
> <xsp-cookie:create-cookies>
>    <xsp-cookie:cookie>
>      <xsp-cookie:name>
>        <xsp:expr>parent_role</xsp:expr>
>      </xsp-cookie:name>
>      <xsp-cookie:value>
>        <xsp:expr>parent_id</xsp:expr>
>      </xsp-cookie:value>
>    </xsp-cookie:cookie>
> </xsp-cookie:create-cookies>	
>                 }
> 		</xsp:logic>
>
> ...
>
> be carefull to declare namespaces
> <xsp:page language="java" xmlns:xsp="http://apache.org/xsp"
> xmlns:esql="http://apache.org/cocoon/SQL/v2"
> xmlns:xsp-request="http://apache.org/xsp/request/2.0"
> xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0">
>
> this is an 2 years old implementation in XSP i have found in my disk 
> that
> work
>
> i'll suggest you to use flow instead of XSP (but this depends of your
> needs)
>
>
> http://cocoon.apache.org/2.1/userdocs/flow/api.html
> http://cocoon.apache.org/2.1/userdocs/flow/api.html#Cookie+Object
>
> regards
>
> stavros
>
>
> On Fri, 1 Apr 2005, Yves Vindevogel wrote:
>
>> Hi,
>>
>> Where can I find a newbie example on how to use cookies in cocoon ?
>> I need to drop a cookie on the client and read it back ...
>>
>> Regards,
>> Yves
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
>> For additional commands, e-mail: users-help@cocoon.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Example of Cookies

Posted by go...@osmosis.gr.
hi Yves

a simple code fragment in XSP

...
        <xsp:logic>
                String parent_role  = <xsp-request:get-parameter name="parent_role"/>;
                String parent_id      = <xsp-request:get-parameter name="parent_id"/>;
                
                 if (parent_id==null){                
                    parent_id = 
<xsp:expr>
 <xsp-cookie:getValue>											
  <xsp-cookie:name>												
 <xsp:expr>parent_role</xsp:expr>									
  </xsp-cookie:name>						
 </xsp-cookie:getValue>								
</xsp:expr>;  
										
<role><xsp:expr>parent_id</xsp:expr></role>
                
                 }else{
<xsp-cookie:create-cookies>
   <xsp-cookie:cookie>
     <xsp-cookie:name>
       <xsp:expr>parent_role</xsp:expr>
     </xsp-cookie:name>
     <xsp-cookie:value>
       <xsp:expr>parent_id</xsp:expr>
     </xsp-cookie:value>
   </xsp-cookie:cookie>                
</xsp-cookie:create-cookies>	   
                }
		</xsp:logic>

...

be carefull to declare namespaces 
<xsp:page language="java" xmlns:xsp="http://apache.org/xsp" 
xmlns:esql="http://apache.org/cocoon/SQL/v2" 
xmlns:xsp-request="http://apache.org/xsp/request/2.0" 
xmlns:xsp-cookie="http://apache.org/xsp/cookie/2.0">

this is an 2 years old implementation in XSP i have found in my disk that 
work

i'll suggest you to use flow instead of XSP (but this depends of your 
needs)


http://cocoon.apache.org/2.1/userdocs/flow/api.html
http://cocoon.apache.org/2.1/userdocs/flow/api.html#Cookie+Object

regards 

stavros 


On Fri, 1 Apr 2005, Yves Vindevogel wrote:

> Hi,
> 
> Where can I find a newbie example on how to use cookies in cocoon ?
> I need to drop a cookie on the client and read it back ...
> 
> Regards,
> Yves
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
> For additional commands, e-mail: users-help@cocoon.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org