You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-user@tcl.apache.org by Laprévote Arnaud <ar...@mandriva.com> on 2007/12/28 18:16:27 UTC
websh - I need a cookie !!!
Dear websh users,
I need a cookie. I know there are very nice sessions. But I really need
a cookie. I have a cross-technology web application. It works on cgi
(with cgi.tcl), on tclhttpd, on rivet, and I am porting it to websh. As
it is such an application, I have my own session environment. And I need
to create it again. And I do not catch how cookies are implemented in websh.
My code is attached for managing the cookies and for the final output.
Please, could you give me some hints ?
Best regards,
Arnaud LAPREVOTE
--
Arnaud LAPREVOTE - Directeur R&D Mandriva/Linbox FAS
152, rue de Grigy Technopôle Metz 2000 57070 METZ
43, rue d'Aboukir 75002 PARIS
tel : 03 87 50 87 90 - 06 11 36 15 30 fax : 03 87 75 19 26
E-mail : arnaud.laprevote@mandriva.com Web: http://mandriva.com
Re: websh - I need a cookie !!!
Posted by Laprévote Arnaud <ar...@mandriva.com>.
Thanks, this time it seems to work (I mean, it does not crash, but I
have to look in more details). Thanks a lot for your help.
Friendly yours,
Arnaud LAPREVOTE
Aleksandar Nikov a écrit :
> Hi Arnaud,
>
>
>>
>> Thank you very much for your answer. However, it does not work. I have
>> tried in many ways with initialisation at very start or just before my
>> function, but nothing work.
>
> You should also do fas_context::init $cookie_name before using the cset
> function.
> (I forgot to mention this, in the cookie.ws3 example it is in the
> web::command default part).
>
> More info you can get from:
> http://tcl.apache.org/websh/quickref/context_handling.html#web::cookiecontext
>
>
>
> Regards,
> Alex
>
>
>
>
--
Arnaud LAPREVOTE - Directeur R&D Mandriva/Linbox FAS
152, rue de Grigy Technopôle Metz 2000 57070 METZ
43, rue d'Aboukir 75002 PARIS
tel : 03 87 50 87 90 - 06 11 36 15 30 fax : 03 87 75 19 26
E-mail : arnaud.laprevote@mandriva.com Web: http://mandriva.com
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org
Re: websh - I need a cookie !!!
Posted by Aleksandar Nikov <an...@netcetera.com.mk>.
Hi Arnaud,
>
> Thank you very much for your answer. However, it does not work. I have
> tried in many ways with initialisation at very start or just before my
> function, but nothing work.
You should also do fas_context::init $cookie_name before using the cset
function.
(I forgot to mention this, in the cookie.ws3 example it is in the
web::command default part).
More info you can get from:
http://tcl.apache.org/websh/quickref/context_handling.html#web::cookiecontext
Regards,
Alex
--
Aleksandar Nikov | aleksandar.nikov@netcetera.com.mk
phone +389 -2- 30 64 532 | fax +389 -2- 30 79 495
Netcetera | 1000 Skopje | Macedonia | http://netcetera.com.mk
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org
Re: websh - I need a cookie !!!
Posted by Laprévote Arnaud <ar...@mandriva.com>.
Dear Aleksandar,
Thank you very much for your answer. However, it does not work. I have
tried in many ways with initialisation at very start or just before my
function, but nothing work.
At the end I just put the code as you propose it in my cookie functions.
The error I keep having is :
[error] [client 127.0.0.1] no context to commit.\n
while executing\n"error "no context to commit.""\n (procedure
"fas_context::
commit" line 7)\n invoked from within\n"fas_context::commit"\n
(procedure
"fas_set_cookie" line 25)\n invoked from within\n"fas_set_cookie
fas_session
$session_name"\n (procedure "fas_session::export_session" line 8)\n
invoke
d from within\n"fas_session::export_session"\n (procedure
"not_binary::conten
t_display" line 41)\n invoked from
within\n"not_binary::content_display fasht
ml "<center><h1>An error just occured</h1></center><pre>$error<br
/>$::errorInfo
</pre>""\n invoked from within\n"if { ![check_root $file] }
{\n\t\tnot_binary
::content_display fashtml "<html><head><title>[translate "Error in "]
${FAS_VIEW
_CGI}</title><body>[translate..."\n invoked from within\n"web::dispatch"
I checked a little in cookie.ws3, and I see the error generation, but I
do not understand why I (always) have it.
Friendly yours,
Arnaud LAPREVOTE
PS : I was pleased to have a message from somebody in Skopje. It gave me
the occasion to look where it is.
Aleksandar Nikov a écrit :
> Hello Arnaud,
>
>>
>> I need a cookie. I know there are very nice sessions. But I really
>> need a cookie. I have a cross-technology web application. It works on
>> cgi (with cgi.tcl), on tclhttpd, on rivet, and I am porting it to
>> websh. As it is such an application, I have my own session
>> environment. And I need to create it again. And I do not catch how
>> cookies are implemented in websh.
> You can see the cookie example at
> http://tcl.apache.org/websh/examples/cookie.html
>
> Basically for setting a cookie in your code would be:
>
> web::cookiecontext fas_context
> fas_context::cset $cookie_name $cookie_value
> fas_context::commit
>
> Reading a cookie would be:
>
> web::cookiecontext fas_context
> set cookie_value [fas_context::cget $cookie_name]
> fas_context::commit
>
>
> Of course, the initialization of the fas_context can be moved to a
> separate initialization part thus preventing multiple initialization parts.
>
> Also be careful that cookie context need to be committed before any
> web:puts as it must be sent in the http headers (before sending any part
> of a page body).
>
> Regards,
> Alex
>
--
Arnaud LAPREVOTE - Directeur R&D Mandriva/Linbox FAS
152, rue de Grigy Technopôle Metz 2000 57070 METZ
43, rue d'Aboukir 75002 PARIS
tel : 03 87 50 87 90 - 06 11 36 15 30 fax : 03 87 75 19 26
E-mail : arnaud.laprevote@mandriva.com Web: http://mandriva.com
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org
Re: websh - I need a cookie !!!
Posted by Aleksandar Nikov <an...@netcetera.com.mk>.
Hello Arnaud,
>
> I need a cookie. I know there are very nice sessions. But I really
> need a cookie. I have a cross-technology web application. It works on
> cgi (with cgi.tcl), on tclhttpd, on rivet, and I am porting it to
> websh. As it is such an application, I have my own session
> environment. And I need to create it again. And I do not catch how
> cookies are implemented in websh.
You can see the cookie example at
http://tcl.apache.org/websh/examples/cookie.html
Basically for setting a cookie in your code would be:
web::cookiecontext fas_context
fas_context::cset $cookie_name $cookie_value
fas_context::commit
Reading a cookie would be:
web::cookiecontext fas_context
set cookie_value [fas_context::cget $cookie_name]
fas_context::commit
Of course, the initialization of the fas_context can be moved to a
separate initialization part thus preventing multiple initialization parts.
Also be careful that cookie context need to be committed before any
web:puts as it must be sent in the http headers (before sending any part
of a page body).
Regards,
Alex
--
Aleksandar Nikov | aleksandar.nikov@netcetera.com.mk
phone +389 -2- 30 64 532 | fax +389 -2- 30 79 495
Netcetera | 1000 Skopje | Macedonia | http://netcetera.com.mk
---------------------------------------------------------------------
To unsubscribe, e-mail: websh-user-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-user-help@tcl.apache.org