Re: Accessing the Post body/content from an, expired/cached page before initialRequest

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

Re: Accessing the Post body/content from an, expired/cached page before initialRequest

Ramshreyas
"Are you using Comache or KomLight? Do you really need the whole body
or would the fields (WARequest>>  #fields / #queryFields /
#postFields) work as well?"

I am using Comanche. I just need the fields - the data the user entered before hitting submit.

One solution I'm working on is making the cached page contain a 'plain' html form (page originally served statically by apache) with a GET method and capturing the incoming data with initialRequest.

I'd much rather solve it entirely through seaside, though...



On Tuesday 13 March 2012 05:30 PM, [hidden email] wrote:

> Send seaside mailing list submissions to
> [hidden email]
> On Tuesday 13 March 2012 05:30 PM, [hidden email] wrote:
>
>> Send seaside mailing list submissions to
>> [hidden email]
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> or, via email, send a message with subject or body 'help' to
>> [hidden email]
>>
>> You can reach the person managing the list at
>> [hidden email]
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of seaside digest..."
>>
>>
>> Today's Topics:
>>
>>     1. Accessing the Post body/content from an expired/cached page
>>        before initialRequest (Ramshreyas)
>>     2. Re: Accessing the Post body/content from an expired/cached
>>        page before initialRequest (Philippe Marschall)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Tue, 13 Mar 2012 11:29:44 +0530
>> From: Ramshreyas<[hidden email]>
>> Subject: [Seaside] Accessing the Post body/content from an
>> expired/cached page before initialRequest
>> To: [hidden email]
>> Message-ID:<[hidden email]>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Dear all,
>>
>> I am developing a (non-commercial) web application for mobiles on
>> Phar1.0/seaside30 (hosted on seaside-hosting for now, cheers to this
>> brilliant service).
>>
>> I would like the user to bookmark a transaction page on her phone, add
>> it to her home screen and use it like any other app. She will enter data
>> for submission before any callbacks/page-loads are performed.
>>
>> This means that she will almost always enter data into a form on an
>> expired page and submit.
>>
>> I find that the WARequest object available to me from
>> RootTask>>initialRequest has its Post body stripped and is converted to
>> a 'Get' request at that stage.
>>
>> Is this true? I am a newb, ( to web-development itself, seaside is my
>> first framework! Avoided programming in general until I found, and fell
>> in love with, smalltalk) so perhaps I simply don't understand how the
>> information is encoded into the WARequest object, or in the Post method
>> in general.
>>
>> I tried something like:
>>
>> RootTask>>initialRequest: aRequest
>>
>>       | expiredFormData |
>>
>>       expiredFormData := aRequest bodyDecoded (or aRequest postFields..,
>> aRequest rawBody etc )
>>
>> The body is nil, as confirmed upon putting a halt here and inspecting
>> the WARequest object. It also seems to have converted the original Post
>> method into a Get. This would make sense given the instructions for
>> 'recovering from an expired session' that use updateUrl (and hence Get)....
>>
>> When I (tentatively) examined the full stack, I found something that
>> seemed to indicate the HTTPRequest is 'converted' to a 'native' request
>> way before RootTask>>initialRequest is called - I'm out of my depth
>> here, and am wary of monkeypatching the innards without some guidance.
>>
>> How would one capture Post data from an expired page and decode it?
>> Where is the best place to intercept the incoming request?
>>
>> Thanks, and sorry if I am posting below the level of this forum!
>>
>> ram
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Tue, 13 Mar 2012 09:09:41 +0100
>> From: Philippe Marschall<[hidden email]>
>> Subject: Re: [Seaside] Accessing the Post body/content from an
>> expired/cached page before initialRequest
>> To: Seaside - general discussion<[hidden email]>
>> Message-ID:
>> <CA+LFMPgUMV0=d1_hbwdHkgWY9yAibX_0Nkg5OypE=[hidden email]>
>> Content-Type: text/plain; charset=UTF-8
>>
>> Am 13. März 2012 06:59 schrieb Ramshreyas<[hidden email]>:
>>> Dear all,
>>>
>>> I am developing a (non-commercial) web application for mobiles on
>>> Phar1.0/seaside30 (hosted on seaside-hosting for now, cheers to this
>>> brilliant service).
>>>
>>> I would like the user to bookmark a transaction page on her phone, add it to
>>> her home screen and use it like any other app. She will enter data for
>>> submission before any callbacks/page-loads are performed.
>>>
>>> This means that she will almost always enter data into a form on an expired
>>> page and submit.
>>>
>>> I find that the WARequest object available to me from
>>> RootTask>>initialRequest has its Post body stripped and is converted to a
>>> 'Get' request at that stage.
>>>
>>> Is this true? I am a newb, ( to web-development itself, seaside is my first
>>> framework! Avoided programming in general until I found, and fell in love
>>> with, smalltalk) so perhaps I simply don't understand how the information is
>>> encoded into the WARequest object, or in the Post method in general.
>>>
>>> I tried something like:
>>>
>>> RootTask>>initialRequest: aRequest
>>>
>>> Â  Â | expiredFormData |
>>>
>>> Â  Â expiredFormData := aRequest bodyDecoded (or aRequest postFields..,
>>> aRequest rawBody etc )
>>>
>>> The body is nil, as confirmed upon putting a halt here and inspecting the
>>> WARequest object. It also seems to have converted the original Post method
>>> into a Get. This would make sense given the instructions for 'recovering
>>> from an expired session' that use updateUrl (and hence Get)....
>> Are you using Comache or KomLight? Do you really need the whole body
>> or would the fields (WARequest>>  #fields / #queryFields /
>> #postFields) work as well?
>>
>>> When I (tentatively) examined the full stack, I found something that seemed
>>> to indicate the HTTPRequest is 'converted' to a 'native' request way before
>>> RootTask>>initialRequest is called - I'm out of my depth here, and am wary
>>> of monkeypatching the innards without some guidance.
>>>
>>> How would one capture Post data from an expired page and decode it? Where is
>>> the best place to intercept the incoming request?
>>>
>>> Thanks, and sorry if I am posting below the level of this forum!
>> Don't worry.
>>
>> Cheers
>> Philippe
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> End of seaside Digest, Vol 111, Issue 14
>> ****************************************
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> or, via email, send a message with subject or body 'help' to
> [hidden email]
>
> You can reach the person managing the list at
> [hidden email]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of seaside digest..."
>
>
> Today's Topics:
>
>     1. Accessing the Post body/content from an expired/cached page
>        before initialRequest (Ramshreyas)
>     2. Re: Accessing the Post body/content from an expired/cached
>        page before initialRequest (Philippe Marschall)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 13 Mar 2012 11:29:44 +0530
> From: Ramshreyas<[hidden email]>
> Subject: [Seaside] Accessing the Post body/content from an
> expired/cached page before initialRequest
> To: [hidden email]
> Message-ID:<[hidden email]>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Dear all,
>
> I am developing a (non-commercial) web application for mobiles on
> Phar1.0/seaside30 (hosted on seaside-hosting for now, cheers to this
> brilliant service).
>
> I would like the user to bookmark a transaction page on her phone, add
> it to her home screen and use it like any other app. She will enter data
> for submission before any callbacks/page-loads are performed.
>
> This means that she will almost always enter data into a form on an
> expired page and submit.
>
> I find that the WARequest object available to me from
> RootTask>>initialRequest has its Post body stripped and is converted to
> a 'Get' request at that stage.
>
> Is this true? I am a newb, ( to web-development itself, seaside is my
> first framework! Avoided programming in general until I found, and fell
> in love with, smalltalk) so perhaps I simply don't understand how the
> information is encoded into the WARequest object, or in the Post method
> in general.
>
> I tried something like:
>
> RootTask>>initialRequest: aRequest
>
>       | expiredFormData |
>
>       expiredFormData := aRequest bodyDecoded (or aRequest postFields..,
> aRequest rawBody etc )
>
> The body is nil, as confirmed upon putting a halt here and inspecting
> the WARequest object. It also seems to have converted the original Post
> method into a Get. This would make sense given the instructions for
> 'recovering from an expired session' that use updateUrl (and hence Get)....
>
> When I (tentatively) examined the full stack, I found something that
> seemed to indicate the HTTPRequest is 'converted' to a 'native' request
> way before RootTask>>initialRequest is called - I'm out of my depth
> here, and am wary of monkeypatching the innards without some guidance.
>
> How would one capture Post data from an expired page and decode it?
> Where is the best place to intercept the incoming request?
>
> Thanks, and sorry if I am posting below the level of this forum!
>
> ram
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 13 Mar 2012 09:09:41 +0100
> From: Philippe Marschall<[hidden email]>
> Subject: Re: [Seaside] Accessing the Post body/content from an
> expired/cached page before initialRequest
> To: Seaside - general discussion<[hidden email]>
> Message-ID:
> <CA+LFMPgUMV0=d1_hbwdHkgWY9yAibX_0Nkg5OypE=[hidden email]>
> Content-Type: text/plain; charset=UTF-8
>
> Am 13. März 2012 06:59 schrieb Ramshreyas<[hidden email]>:
>> Dear all,
>>
>> I am developing a (non-commercial) web application for mobiles on
>> Phar1.0/seaside30 (hosted on seaside-hosting for now, cheers to this
>> brilliant service).
>>
>> I would like the user to bookmark a transaction page on her phone, add it to
>> her home screen and use it like any other app. She will enter data for
>> submission before any callbacks/page-loads are performed.
>>
>> This means that she will almost always enter data into a form on an expired
>> page and submit.
>>
>> I find that the WARequest object available to me from
>> RootTask>>initialRequest has its Post body stripped and is converted to a
>> 'Get' request at that stage.
>>
>> Is this true? I am a newb, ( to web-development itself, seaside is my first
>> framework! Avoided programming in general until I found, and fell in love
>> with, smalltalk) so perhaps I simply don't understand how the information is
>> encoded into the WARequest object, or in the Post method in general.
>>
>> I tried something like:
>>
>> RootTask>>initialRequest: aRequest
>>
>> Â  Â | expiredFormData |
>>
>> Â  Â expiredFormData := aRequest bodyDecoded (or aRequest postFields..,
>> aRequest rawBody etc )
>>
>> The body is nil, as confirmed upon putting a halt here and inspecting the
>> WARequest object. It also seems to have converted the original Post method
>> into a Get. This would make sense given the instructions for 'recovering
>> from an expired session' that use updateUrl (and hence Get)....
> Are you using Comache or KomLight? Do you really need the whole body
> or would the fields (WARequest>>  #fields / #queryFields /
> #postFields) work as well?
>
>> When I (tentatively) examined the full stack, I found something that seemed
>> to indicate the HTTPRequest is 'converted' to a 'native' request way before
>> RootTask>>initialRequest is called - I'm out of my depth here, and am wary
>> of monkeypatching the innards without some guidance.
>>
>> How would one capture Post data from an expired page and decode it? Where is
>> the best place to intercept the incoming request?
>>
>> Thanks, and sorry if I am posting below the level of this forum!
> Don't worry.
>
> Cheers
> Philippe
>
>
> ------------------------------
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
> End of seaside Digest, Vol 111, Issue 14
> ****************************************

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

Re: Accessing the Post body/content from an, expired/cached page before initialRequest

Philippe Marschall
Am 13. März 2012 16:08 schrieb Ramshreyas <[hidden email]>:
> "Are you using Comache or KomLight? Do you really need the whole body
> or would the fields (WARequest>>  #fields / #queryFields /
> #postFields) work as well?"
>
> I am using Comanche. I just need the fields - the data the user entered
> before hitting submit.

In that case  one of #fields / #queryFields / #postFields should work
depending on your exact needs.

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

Re: Accessing the Post body/content from an, expired/cached page before initialRequest

Ramshreyas
In reply to this post by Ramshreyas
"WARequest>>  #fields / #queryFields / #postFields should work if you're using Comanche.."

Have succesfully made it work with a plain (non-seaside-served) html page using a Get method: (I could've used updateUrl but it serves my purpose to deliver that menu page statically anyway).

Will get to work on the post method as you suggest soon.

But in the current scenario (statically served page with Get method), new question: 

each incoming get request from my static page is treated as a new session - so if a user performs multiple transactions, each is traeated as a new session, requiring multiple logins, etc. 

Is it possible to 'pass' control back to the initial session? 

I can get the user's IP address with:

nativeRequest := self session currentRequest nativeRequest
ipAddress := nativeRequest remoteAddress.

Do you think I should use the announcements framework which I dimly grok...

Only want direction, will do the leg work myself...



On Tuesday 13 March 2012 08:23 PM, Ramshreyas wrote:
"Are you using Comache or KomLight? Do you really need the whole body
or would the fields (WARequest >> #fields / #queryFields /
#postFields) work as well?"






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

Re: Accessing the Post body/content from an, expired/cached page before initialRequest

Philippe Marschall
Am 19. März 2012 08:36 schrieb Ramshreyas <[hidden email]>:

> "WARequest>>  #fields / #queryFields / #postFields should work if you're
> using Comanche.."
>
> Have succesfully made it work with a plain (non-seaside-served) html page
> using a Get method: (I could've used updateUrl but it serves my purpose to
> deliver that menu page statically anyway).
>
> Will get to work on the post method as you suggest soon.
>
> But in the current scenario (statically served page with Get method), new
> question:
>
> each incoming get request from my static page is treated as a new session -
> so if a user performs multiple transactions, each is traeated as a new
> session, requiring multiple logins, etc.

Right if the session information is lost. If you just want to serve
some PDFs and don't need session information then the easiest way is
to just implement a WARequestHandler or add a WARequestFilter to you
application. Then no new session will be created.

> Is it possible to 'pass' control back to the initial session?

If you know the session and continuation key.

> I can get the user's IP address with:
>
> nativeRequest := self session currentRequest nativeRequest
> ipAddress := nativeRequest remoteAddress.

That's Seaside 2.8 code, in 3.0 you can use
self requestContest request remoteAddress

> Do you think I should use the announcements framework which I dimly grok...
>
> Only want direction, will do the leg work myself...

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside