Grabbing the current render stream (to save the current page)

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

Grabbing the current render stream (to save the current page)

Marco Primi-2
Hi!,
i'm trying to save the content of the current web page on server side.

example, somewhere in one of my components i have:

AComponent>>renderContentOn: html
html anchor
  callback: [self saveCurrentPage ];
  with: 'Save snapshot'.

what saveCurrentPage should do is just putting the current page in a FileLibrary
for example, however i see no clean way of doing that.

I tried to look up the stack during a render, found what i want in
WARender>>buildResponse
  [...]
  self writeOnLoadOn: stream.
  stream close.
  [...]

if i inspect that stream before the call to close, i find exactly what i want (a
byte array '<!DOCTYPE ....page... </html>')
but i found no way to access it AFTER the render has completed or access it from
a component

Any idea/hack?
Ciao
Marco

(P.S. Using seaside 2.6 on VW, but that shouldn't matter much)

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

Re: Grabbing the current render stream (to save the current page)

Philippe Marschall
2007/5/15, Marco Primi <[hidden email]>:

> Hi!,
> i'm trying to save the content of the current web page on server side.
>
> example, somewhere in one of my components i have:
>
> AComponent>>renderContentOn: html
> html anchor
>  callback: [self saveCurrentPage ];
>  with: 'Save snapshot'.
>
> what saveCurrentPage should do is just putting the current page in a FileLibrary
> for example, however i see no clean way of doing that.
>
> I tried to look up the stack during a render, found what i want in
> WARender>>buildResponse
>  [...]
>  self writeOnLoadOn: stream.
>  stream close.
>  [...]
>
> if i inspect that stream before the call to close, i find exactly what i want (a
> byte array '<!DOCTYPE ....page... </html>')
> but i found no way to access it AFTER the render has completed or access it from
> a component
>
> Any idea/hack?

What about subclassing WASession and overriding #returnResponse:?

Cheers
Philippe

> Ciao
> Marco
>
> (P.S. Using seaside 2.6 on VW, but that shouldn't matter much)
>
> _______________________________________________
> 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
|

Re: Grabbing the current render stream (to save the current page)

Marco Primi-2


Philippe Marschall <philippe.marschall <at> gmail.com> writes:

>
> What about subclassing WASession and overriding #returnResponse:?
>
> Cheers
> Philippe
>

Sweet! Thanks a lot
Ciao
Marco



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