Hello,
I am trying to port an older system to Seaside. The code is in Smalltalk and it uses explicit HTTP POST and GET variables. Is there a way in Seaside to receive a variable in the url (ie http://abc/xyz?var1=123) and of course extract it within the Smalltalk code. Searching this forum, the closest I found was the following in 2007, but I cannot figure out how to make this work. --------------------------------------------- 2007/10/16, Randal L. Schwartz <[hidden email]>: > > I'm replacing a badly-written (that is, not *mine*) Perl application with a > seaside application. Let's say I've installed my application at > /seaside/booking. How do I intercept, say, > /seaside/booking?legacy=app&does=this and turn that into an initial > hit into my app with a couple of instance vars set, so that > all the remaining /seaside/booking?_s=...&_c=... still work? Implement #initialRequest (don't forget to send super). WABrowser has an example. If you want the parameters (legacy and does) to stay you'll also have to implement #updateUrl: Cheers Philippe ---------------------------------------------- Thanks, Thierry _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thierry,
Have you tried implementing the following on your root component and if so, what happened? initialRequest: aRequest super initialRequest: aRequest. aRequest at: 'var1' ifPresent: [:v | Transcript show: v]. Regards, -Boris -- +1.604.689.0322 DeepCove Labs Ltd. 4th floor 595 Howe Street Vancouver, Canada V6C 2T5 http://tinyurl.com/r7uw4 -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Thierry Thelliez Sent: Wednesday, September 09, 2009 8:34 AM To: Seaside - general discussion Subject: [Seaside] Legacy system and Seaside Hello, I am trying to port an older system to Seaside. The code is in Smalltalk and it uses explicit HTTP POST and GET variables. Is there a way in Seaside to receive a variable in the url (ie http://abc/xyz?var1=123) and of course extract it within the Smalltalk code. Searching this forum, the closest I found was the following in 2007, but I cannot figure out how to make this work. --------------------------------------------- 2007/10/16, Randal L. Schwartz <[hidden email]>: > > I'm replacing a badly-written (that is, not *mine*) Perl application with a > seaside application. Let's say I've installed my application at > /seaside/booking. How do I intercept, say, > /seaside/booking?legacy=app&does=this and turn that into an initial > hit into my app with a couple of instance vars set, so that > all the remaining /seaside/booking?_s=...&_c=... still work? Implement #initialRequest (don't forget to send super). WABrowser has an example. If you want the parameters (legacy and does) to stay you'll also have to implement #updateUrl: Cheers Philippe ---------------------------------------------- Thanks, Thierry _______________________________________________ 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 |
In reply to this post by Thelliez
>>>>> "Thierry" == Thierry Thelliez <[hidden email]> writes:
Thierry> Is there a way in Seaside to receive a variable in the url (ie Thierry> http://abc/xyz?var1=123) and of course extract it within the Smalltalk Thierry> code. Thierry> Searching this forum, the closest I found was the following in 2007, Thierry> but I cannot figure out how to make this work. It actually does work... I took that advice and launched an app that took a legacy URL as its entry point. What part of that are you having trouble with? -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[hidden email]> <URL:http://www.stonehenge.com/merlyn/> Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc. See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
In reply to this post by Boris Popov, DeepCove Labs (SNN)
Thanks Boris, the example helps.
One more question. Can you pass a parameter within Seaside from one page to another? I am not asking about the regular Seaside way. This is in the context of an older application ported to Seaside. Assuming that I have a regular Seaside page pointing to another page: canvas anchor callback: [ self show: LegacyPage new ]; with: 'LegacyApp'. I would like to pass a variable to 'LegacyPage'. I implemented 'updateURL:' and 'initialRequest:' for LegacyPage (subclass of WABrowser). updateUrl: aUrl super updateUrl: aUrl. aUrl addParameter: 'v1' value: 'xyz'. initialRequest: aRequest super initialRequest: aRequest. self halt: 'initialQuest'. I never get to the halt above. What am I missing? Thierry On Wed, Sep 9, 2009 at 9:36 AM, Boris Popov<[hidden email]> wrote: > Thierry, > > Have you tried implementing the following on your root component and if > so, what happened? > > initialRequest: aRequest > super initialRequest: aRequest. > aRequest > at: 'var1' > ifPresent: [:v | Transcript show: v]. > > Regards, > > -Boris > > -- > +1.604.689.0322 > DeepCove Labs Ltd. > 4th floor 595 Howe Street > Vancouver, Canada V6C 2T5 > http://tinyurl.com/r7uw4 > > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Thierry > Thelliez > Sent: Wednesday, September 09, 2009 8:34 AM > To: Seaside - general discussion > Subject: [Seaside] Legacy system and Seaside > > Hello, > > I am trying to port an older system to Seaside. The code is in > Smalltalk and it uses explicit HTTP POST and GET variables. > > Is there a way in Seaside to receive a variable in the url (ie > http://abc/xyz?var1=123) and of course extract it within the Smalltalk > code. > > Searching this forum, the closest I found was the following in 2007, > but I cannot figure out how to make this work. > > --------------------------------------------- > 2007/10/16, Randal L. Schwartz <[hidden email]>: >> >> I'm replacing a badly-written (that is, not *mine*) Perl application > with a >> seaside application. Let's say I've installed my application at >> /seaside/booking. How do I intercept, say, >> /seaside/booking?legacy=app&does=this and turn that into an initial >> hit into my app with a couple of instance vars set, so that >> all the remaining /seaside/booking?_s=...&_c=... still work? > > Implement #initialRequest (don't forget to send super). WABrowser has > an example. If you want the parameters (legacy and does) to stay > you'll also have to implement #updateUrl: > > Cheers > Philippe > ---------------------------------------------- > > > Thanks, > Thierry > _______________________________________________ > 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 > seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
On 9-Sep-09, at 4:05 PM, Thierry Thelliez wrote: > Thanks Boris, the example helps. > > One more question. Can you pass a parameter within Seaside from one > page to another? I am not asking about the regular Seaside way. This > is in the context of an older application ported to Seaside. > > Assuming that I have a regular Seaside page pointing to another page: > > canvas anchor > callback: [ self show: LegacyPage new ]; > with: 'LegacyApp'. > > I would like to pass a variable to 'LegacyPage'. I implemented > 'updateURL:' and 'initialRequest:' for LegacyPa Why go through the browser to pass the variable? Just do something like this: canvas anchor callback: [ self show: (LegacyPage withV1: 'xyz') ]; with: 'LegacyApp'. Colin _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Thanks for the suggestion. Unfortunately I have a lot of old code
relying on such variable passing. Thierry On Wed, Sep 9, 2009 at 10:53 PM, Colin Putney <[hidden email]> wrote: > > On 9-Sep-09, at 4:05 PM, Thierry Thelliez wrote: > >> Thanks Boris, the example helps. >> >> One more question. Can you pass a parameter within Seaside from one >> page to another? I am not asking about the regular Seaside way. This >> is in the context of an older application ported to Seaside. >> >> Assuming that I have a regular Seaside page pointing to another page: >> >> canvas anchor >> callback: [ self show: LegacyPage new ]; >> with: 'LegacyApp'. >> >> I would like to pass a variable to 'LegacyPage'. I implemented >> 'updateURL:' and 'initialRequest:' for LegacyPa > > Why go through the browser to pass the variable? Just do something like > this: > > canvas anchor > callback: [ self show: (LegacyPage withV1: 'xyz') ]; > with: 'LegacyApp'. > > Colin > _______________________________________________ > 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 |
In reply to this post by Thelliez
On Thu, Sep 10, 2009 at 1:05 AM, Thierry Thelliez
<[hidden email]> wrote: > Thanks Boris, the example helps. > > One more question. Can you pass a parameter within Seaside from one > page to another? I am not asking about the regular Seaside way. This > is in the context of an older application ported to Seaside. > > Assuming that I have a regular Seaside page pointing to another page: > > canvas anchor > callback: [ self show: LegacyPage new ]; > with: 'LegacyApp'. > > I would like to pass a variable to 'LegacyPage'. I implemented > 'updateURL:' and 'initialRequest:' for LegacyPage (subclass of > WABrowser). > > updateUrl: aUrl > super updateUrl: aUrl. > aUrl addParameter: 'v1' value: 'xyz'. > > initialRequest: aRequest > super initialRequest: aRequest. > self halt: 'initialQuest'. > > > I never get to the halt above. What am I missing? #initialRequest: and #updateUrl: are called automatically before rendering on all the #children of a component. You are creating a new component in the middle of your rendering method, which is after the hooks would have been called. You also aren't storing it anywhere to return in the #children method, so it won't have those hooks called on the next request either. Also, keep in mind that #initialRequest: is only called on the first request of a session. I'm not sure what to suggest because I'm not totally clear what you're trying to accomplish with LegacyPage. Why not just make it a component with an iframe in it or something? How is your legacy app going to interact with the render/callback loop inherent in a Seaside application/session? _______________________________________________ seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |