how to generate session url's

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|

how to generate session url's

Merik Voswinkel
Hi,

I have a photoflow Flash component  ( http://facade.seasidehosting.st/ 
seaside/tests/facade ) that gets its information (name, picture url,  
target url, description) from a xml file.

Could somebody explain how I can generate target url's with the  
seaside session information, so the url's point back to a specific  
page in my session ?

Something like http://facade.seasidehosting.st/seaside/tests/facade?
6&_k=KeeQBcbe&_s=ToZbzxUcGyvkOyqZ ?


I could then put these strings into the method below dat generates  
the xml file http://facade.seasidehosting.st/tests/ideeen.xml:

renderContentOn: html
         self session returnResponse: (WAResponse new
      contentType: 'text/xml';
      nextPutAll: '<?xml version="1.0" encoding="utf-8"?>
<photos path="http://facade.seasidehosting.st/resources/">
<photo name="photo1" url="Linea1.png" link="http://
facade.seasidehosting.st/seaside/tests/product1">black picture</photo>
<photo name="photo2" url="Linea2.png" link="http://
facade.seasidehosting.st/seaside/tests/product2">grey picture</photo>
</photos>';
      yourself)

Any suggestions are greatly appreciated, I have searched all the  
archives and blogs for info but could not find an example.
When I have the photoflow Flash component tamed I will release it for  
Squeak, maybe as an addition to Basil/SeaFlash.

Thnx,

Merik Voswinkel
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: how to generate session url's

Lukas Renggli
> Any suggestions are greatly appreciated, I have searched all the
> archives and blogs for info but could not find an example.
> When I have the photoflow Flash component tamed I will release it for
> Squeak, maybe as an addition to Basil/SeaFlash.

Maybe you the implementation of WAAnchorTag helps here? This is
probably the most prominent place where callback URLs are generated.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

re: how to generate session url's

Merik Voswinkel
In reply to this post by Merik Voswinkel


Thank you Lukas.
However,  it will take me many days before I can start to understand  
WAAnchorTag without documentation. I was expecting some part that  
constructs the _k and _s parts.



> Maybe you the implementation of WAAnchorTag helps here? This is
> probably the most prominent place where callback URLs are generated.
>
> Lukas
>

Merik

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: re: how to generate session url's

Lukas Renggli
> However,  it will take me many days before I can start to understand
> WAAnchorTag without documentation.

There is quite some documentation in my image, at least in Seaside 2.8.

> I was expecting some part that
> constructs the _k and _s parts.

The anchor only adds the callback (the number in the URL).

The _s part is generated during the first request, when the session is
instantiated. The _k part is generated for every request in the
render-loop. The rendering context knows the current actionUrl.

    html context actionUrl

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

re: how to generate session url's

Merik Voswinkel

On Sep 21, 2007, at 7:17 AM, Lukas Renggli wrote:
>  The rendering context knows the current actionUrl.
>
>     html context actionUrl
>
> Lukas
Thank you Lukas for starting my in de right direction. However I only  
half understand, because if I do

|temp |
temp  := html context actionUrl.
Transcript show: temp.

temp gets the value http://localhost:9090/seaside/tests/facade?
_k=CaSTUFvr&_s=hgCVUtnaTqnxvuqH
and that url points to the component I put his code in (if I paste  
this url into my browser it reloads this component and of course  
prints out the exact same url on the Transcript again).

But my problem is that I need to generate a url pointing to another  
component (the component that generates the xml data that is called  
SUTest1).

So I tried lots of permutations to do that but I only get walkbalks:

temp  := html anchor callback: [SUTest2 new].
Transcript show: temp.

What is the correct syntax to generate a url (with callback) to this  
component?


Maybe I need more than the correct syntax?

To recap:  I have a component that needs to generate a xml file per  
user session (with urls pointing to several objects in the user  
session) and then generate a url with the same session info pointing  
to that xml, pass this xml url  to an external Flash object. The  
Flash object fetches the xml file and inside it the Flash object  
finds the url's pointing to different seaside components inside the  
same user session. Preferably this all will work so that when I call  
this component it will start the Flash object that will call a  
different component and when that answers it will return to the first  
component like a normal callback: answer:.

Merik
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: re: how to generate session url's

Ramon Leon-5
> Thank you Lukas for starting my in de right direction.
> However I only half understand, because if I do
>
> |temp |
> temp  := html context actionUrl.
> Transcript show: temp.
>
> temp gets the value http://localhost:9090/seaside/tests/facade?
> _k=CaSTUFvr&_s=hgCVUtnaTqnxvuqH
> and that url points to the component I put his code in (if I
> paste this url into my browser it reloads this component and
> of course prints out the exact same url on the Transcript again).
>
> But my problem is that I need to generate a url pointing to
> another component (the component that generates the xml data
> that is called SUTest1).
>
> So I tried lots of permutations to do that but I only get walkbalks:
>
> temp  := html anchor callback: [SUTest2 new].
> Transcript show: temp.
>
> What is the correct syntax to generate a url (with callback)
> to this component?

html context urlForAction: [self call: SUTest2 new]

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

re: how to generate session url's

Merik Voswinkel

>>
>> But my problem is that I need to generate a url pointing to
>> another component (the component that generates the xml data
>> that is called SUTest1).
>>
>> So I tried lots of permutations to do that but I only get walkbalks:
>>
>> temp  := html anchor callback: [SUTest2 new].
>> Transcript show: temp.
>>
>> What is the correct syntax to generate a url (with callback)
>> to this component?
>
> html context urlForAction: [self call: SUTest2 new]
>
> Ramon Leon


|temp  |
temp  := html context urlForAction: [self call: SUTest2 new].
Transcript show: temp.

That looks logical but it still gives me this walkback:

MessageNotUnderstood: WARenderingContext>>urlForAction:

Debug Proceed Full Stack

Possible Causes

you sent a message this type of object doesn't understand
Stack Trace

thisContext WARenderingContext(Object)>>doesNotUnderstand:  
#urlForAction:
self a WARenderingContext
aMessage urlForAction: [] in SUProductenses>>renderContentOn: {[self  
call: SUTest2 new]}
thisContext SUProductenses>>renderContentOn:
self a SUProductenses
html a WARenderCanvas
temp nil

Merik Voswinkel
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: re: how to generate session url's

Ramon Leon-5
> >>
> |temp  |
> temp  := html context urlForAction: [self call: SUTest2 new].
> Transcript show: temp.
>
> That looks logical but it still gives me this walkback:
>
> MessageNotUnderstood: WARenderingContext>>urlForAction:

You must be using Seaside 2.7, here, add this to your WARenderingContext

urlForAction: aBlock
        ^ self context actionUrl withParameter: (self callbacks
registerActionCallback: aBlock)

In 2.7 that was in WAHtmlRenderer, which was removed completely in 2.8.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: re: how to generate session url's

Michel Bany

On Sep 28, 2007, at 4:38 AM, Ramon Leon wrote:

>
> You must be using Seaside 2.7, here, add this to your  
> WARenderingContext
>
> urlForAction: aBlock
> ^ self context actionUrl withParameter: (self callbacks
> registerActionCallback: aBlock)
>
> In 2.7 that was in WAHtmlRenderer, which was removed completely in  
> 2.8.

FWIW, 2.7b1 has that method, 2.7a1 is behind and does not have it.
If you are still on 2.7, you should use 2.7b1 rather than 2.7a1.
Michel.
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

re: how to generate session url's

Merik Voswinkel

On Sep 28, 2007, at 9:21 PM, Michel Bany wrote:

>
> On Sep 28, 2007, at 4:38 AM, Ramon Leon wrote:
>
>>
>> You must be using Seaside 2.7, here, add this to your  
>> WARenderingContext
>>
>> urlForAction: aBlock
>> ^ self context actionUrl withParameter: (self callbacks
>> registerActionCallback: aBlock)
>>
>> In 2.7 that was in WAHtmlRenderer, which was removed completely in  
>> 2.8.
>
> FWIW, 2.7b1 has that method, 2.7a1 is behind and does not have it.
> If you are still on 2.7, you should use 2.7b1 rather than 2.7a1.
> Michel.

I am confused. I am on Seaside 2.8a1-lr.428 in a 3.10 beta image from  
damien.cassou.free.fr/
There was no urlForAction: in WARenderingContext so I added it as  
Ramon suggested.

The next message #context is also not implemented in  
WARenderingContext so it does not help:


Stack Trace
thisContext
WARenderingContext(Object)>>doesNotUnderstand: #context
self
a WARenderingContext
aMessage
context



Merik
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: re: how to generate session url's

Ramon Leon-5
> >> You must be using Seaside 2.7, here, add this to your
> >> WARenderingContext
> >>
> >> urlForAction: aBlock
> >> ^ self context actionUrl withParameter: (self callbacks
> >> registerActionCallback: aBlock)
> >>
> >> In 2.7 that was in WAHtmlRenderer, which was removed completely in
> >> 2.8.
> >
> > FWIW, 2.7b1 has that method, 2.7a1 is behind and does not have it.
> > If you are still on 2.7, you should use 2.7b1 rather than 2.7a1.
> > Michel.
>
> I am confused. I am on Seaside 2.8a1-lr.428 in a 3.10 beta
> image from damien.cassou.free.fr/ There was no urlForAction:
> in WARenderingContext so I added it as Ramon suggested.
>
> The next message #context is also not implemented in
> WARenderingContext so it does not help:

If context is an instance variable, you won't need self.  I don't know why
that wouldn't already be in your 2.8 image, it should be.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: re: how to generate session url's

Merik Voswinkel

On Sep 28, 2007, at 11:33 PM, Ramon Leon wrote:

You must be using Seaside 2.7, here, add this to your 
WARenderingContext

urlForAction: aBlock
^ self context actionUrl withParameter: (self callbacks
registerActionCallback: aBlock)

In 2.7 that was in WAHtmlRenderer, which was removed completely in 
2.8.

FWIW, 2.7b1 has that method, 2.7a1 is behind and does not have it.
If you are still on 2.7, you should use 2.7b1 rather than 2.7a1.
Michel.

I am confused. I am on Seaside 2.8a1-lr.428 in a 3.10 beta 
image from damien.cassou.free.fr/ There was no urlForAction: 
in WARenderingContext so I added it as Ramon suggested.

The next message #context is also not implemented in 
WARenderingContext so it does not help:

If context is an instance variable, you won't need self.  I don't know why
that wouldn't already be in your 2.8 image, it should be.


context is not an instance variable.
urlForAction: was not present

So what to do, use another way to geberate the url, downgrade to 2.7 (what version)?


Merik

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: re: how to generate session url's

Philippe Marschall
2007/9/29, Merik Voswinkel <[hidden email]>:

>
>
> On Sep 28, 2007, at 11:33 PM, Ramon Leon wrote:
>
>
> You must be using Seaside 2.7, here, add this to your
> WARenderingContext
>
> urlForAction: aBlock
>  ^ self context actionUrl withParameter: (self callbacks
> registerActionCallback: aBlock)
>
> In 2.7 that was in WAHtmlRenderer, which was removed completely in
> 2.8.
>
> FWIW, 2.7b1 has that method, 2.7a1 is behind and does not have it.
> If you are still on 2.7, you should use 2.7b1 rather than 2.7a1.
> Michel.
>
> I am confused. I am on Seaside 2.8a1-lr.428 in a 3.10 beta
> image from damien.cassou.free.fr/ There was no urlForAction:
> in WARenderingContext so I added it as Ramon suggested.
>
> The next message #context is also not implemented in
> WARenderingContext so it does not help:
>
> If context is an instance variable, you won't need self.  I don't know why
> that wouldn't already be in your 2.8 image, it should be.
>
>
> context is not an instance variable.
> urlForAction: was not present

It's there it's just in WARendererCanvas do:

html urlForAction: [self call: SUTest2 new]

Cheers
Philippe

> So what to do, use another way to geberate the url, downgrade to 2.7 (what
> version)?
>
>
> Merik
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Upcoming Podcasts about Seaside

Michael Lucas-Smith-3
Hi Everyone,

Just a heads up that Industry Misinterpretations, our Smalltalk podcast,
has three podcasts specifically about Seaside coming out over the next week.

Podcast #1: Myself, James Robertson, Tamara Kogan, Martin Kobetic, Arden
Thomas
Podcast #2: Myself, James Robertson, Michel Bany, Alan Knight, Arden Thomas
Podcast #3: Myself, James Robertson, The entire Gemstone GLASS team

The podcasts will be appearing here:
http://www.cincomsmalltalk.com/userblogs/cincom/blogView?content=podcasts
You can subscribe to the podcast in iTunes (just search for smalltalk)
or with: http://www.cincomsmalltalk.com/rssBlog/blog_podcast.xml
They'll also be announced on James's blog:
http://www.cincomsmalltalk.com/blog/blogView

Cheers,
Michael
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

re: how to generate session url's

Merik Voswinkel
In reply to this post by Philippe Marschall

It's there it's just in WARendererCanvas do:

html urlForAction: [self call: SUTest2 new]

Philippe

Bingo!

That is it, that is how you generate a session url pointing to the any component (here SUtest2) in Seaside 2.8 into the html page.

And for newbies like me:

temp := html urlForAction: [self call: SUTest2 new] is how you put the value into a variable and not into the html page.


Thank you all for helping me out here! 
Now I have to figure out why I could not solve this myself. Do you all have superior insight in how Seaside works, are you better at browsing (and finding!) examples and then rewriting them, is the problem that we do not have enough Seaside documentation for a programmer of my skill level, etc ?
To answer this question I have volunteered to help maintain the FAQ, hoping to find out how to flatten the learning curve on Seaside.

Much obliged to uou all,

Merik Voswinkel

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: re: how to generate session url's

Philippe Marschall
2007/9/29, Merik Voswinkel <[hidden email]>:

>
>
>
> It's there it's just in WARendererCanvas do:
>
> html urlForAction: [self call: SUTest2 new]
>
> Philippe
> Bingo!
>
> That is it, that is how you generate a session url pointing to the any
> component (here SUtest2) in Seaside 2.8 into the html page.
>
> And for newbies like me:
>
> temp := html urlForAction: [self call: SUTest2 new] is how you put the value
> into a variable and not into the html page.
>
>
> Thank you all for helping me out here!
> Now I have to figure out why I could not solve this myself. Do you all have
> superior insight in how Seaside works, are you better at browsing (and
> finding!) examples and then rewriting them, is the problem that we do not
> have enough Seaside documentation for a programmer of my skill level, etc ?

This is how I did it:
- I was pretty sure #urlForAction: was in there (I remember it was
added after some issues)
- open 'Message Names'
- enter urlForAction: -> done

Cheers
Philippe

> To answer this question I have volunteered to help maintain the FAQ, hoping
> to find out how to flatten the learning curve on Seaside.
>
> Much obliged to uou all,
>
> Merik Voswinkel
> _______________________________________________
> Seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

is there url encoding in Seaside or Squeak?

Merik Voswinkel
In reply to this post by Philippe Marschall
Hello listmembers,

I have a string that I need to 'url encode' as specified in RFC 1738  
(see http://www.rfc-editor.org/rfc/rfc1738.txt )

Does anybody know of an existing method that already does that?
There is code in WAUrlEncoder and WAUrl but if I am correct that has  
nothing to do with 'url encoding' as meant in RFC 1738.
Maybe there is some code that does a simple parse of a string and  
replaces it with values from a table that I can use as a model?


An example of url encoding:

The url:   'xmlPath=http://localhost:9090/seaside/tests/facade?
24&_k=QfTdFUeY&_s=FSxTGyuBNcNckyjq'

can be encoded as:  'xmlPath%3Dhttp%3A%2F%2Flocalhost%3A9090%2Fseaside
%2Ftests%2Ffacade%3F24%26%5Fk%3DQfTdFUeY%26%5Fs%3DFSxTGyuBNcNckyjq'


For more info on url encoding see:

The table for encoding:
http://i-technica.com/whitestuff/urlencodechart.html

A tool for encoding:
http://www.dommermuth-1.com/protosite/experiments/encode/index.html

FlashVars explanation:
http://kb.adobe.com/selfservice/viewContent.do?
externalId=tn_16417&sliceId=1

Adobes explanation of url encoding:
http://kb.adobe.com/selfservice/viewContent.do?
externalId=tn_14143&sliceId=2


Merik Voswinkel
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: re: how to generate session url's

Ramon Leon-5
In reply to this post by Philippe Marschall

> > The next message #context is also not implemented in
> > WARenderingContext so it does not help:
> >
> > If context is an instance variable, you won't need self.  I
> don't know
> > why that wouldn't already be in your 2.8 image, it should be.
> >
> >
> > context is not an instance variable.
> > urlForAction: was not present
>
> It's there it's just in WARendererCanvas do:
>
> html urlForAction: [self call: SUTest2 new]
>
> Cheers
> Philippe

Doh!  I never even noticed he was saying Context and not Canvas, my bad,
sorry Merik.

Ramon Leon
http://onsmalltalk.com 

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: re: how to generate session url's

Merik Voswinkel
> Doh!  I never even noticed he was saying Context and not Canvas, my  
> bad,
> sorry Merik.

How polite!  No need to apologise.

You allready made my week with helping me out at all!
Since 12 weeks I make a living writing Seaside websites.
I was stuck with this session problem for 6 weeks, which means I was  
losing money fast.
As a way to thank you all for the help I get, I of course will put  
all my work back into Seaside and Pier and started maintainig the FAQ.
But still, I hope that one day, when I succeed in earning a living  
this way, I can offer to pay for advice like Lukas, Philippe, you and  
many others are giving on the list. Not today I am afraid, but one day.

Thanks again,

Merik Voswinkel


_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

is there url encoding in Seaside or Squeak?

Merik Voswinkel
In reply to this post by Philippe Marschall
Hello,

I have a string that I need to 'url encode' as specified in RFC 1738  
(see http://www.rfc-editor.org/rfc/rfc1738.txt )

Does anybody know of an existing method that already does that?
There is code in WAUrlEncoder and WAUrl but if I am correct that has  
nothing to do with 'url encoding' as meant in RFC 1738.
Maybe there is some code that does a simple parse of a string and  
replaces it with values from a table that I can use as a model?


An example of url encoding:

The url:   'xmlPath=http://localhost:9090/seaside/tests/facade?
24&_k=QfTdFUeY&_s=FSxTGyuBNcNckyjq'

can be encoded as:  'xmlPath%3Dhttp%3A%2F%2Flocalhost%3A9090%2Fseaside
%2Ftests%2Ffacade%3F24%26%5Fk%3DQfTdFUeY%26%5Fs%3DFSxTGyuBNcNckyjq'


For more info on url encoding see:

The table for encoding:
http://i-technica.com/whitestuff/urlencodechart.html

A tool for encoding:
http://www.dommermuth-1.com/protosite/experiments/encode/index.html

FlashVars explanation:
http://kb.adobe.com/selfservice/viewContent.do?
externalId=tn_16417&sliceId=1

Adobes explanation of url encoding:
http://kb.adobe.com/selfservice/viewContent.do?
externalId=tn_14143&sliceId=2


Merik Voswinkel
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
12