Rendering on an external stream

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

Rendering on an external stream

Marco D'Ambros
Hi,

I need to write a seaside component which understands  
#renderContentOn: on an external file.
Let's say that the component is called componentToPrint, what I want  
to do is to redirect the output (what gets written on the html  
document) of

html render: componentToPrint

on an external stream.

How can I do it?

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

Re: Rendering on an external stream

Julian Fitzell-2
You can get a string with

string := html class builder render: componentToPrint

Does that help?

It would get more complex if you actually want to stream it. You'd
probably want to make a new WAHtmlStreamDocument and configure it with
"html context document:" (putting the old document back afterwards) or
even create a new rendering context altogether (see
WARenderContinuation>>processRendering: for an example) . My memory of
how this works in 2.8 is a bit fuzzy at the moment; you'd have to play
to get it right.

Julian

On Thu, May 14, 2009 at 1:39 AM, Marco D'Ambros
<[hidden email]> wrote:

> Hi,
>
> I need to write a seaside component which understands #renderContentOn: on
> an external file.
> Let's say that the component is called componentToPrint, what I want to do
> is to redirect the output (what gets written on the html document) of
>
> html render: componentToPrint
>
> on an external stream.
>
> How can I do it?
>
> cheers
> Marco
> _______________________________________________
> 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: Rendering on an external stream

Marco D'Ambros
In reply to this post by Marco D'Ambros
I found it myself :-)

What I needed was something like this:

WARenderCanvas builder render: componentToPrint

cheers
Marco


On May 14, 2009, at 10:39 AM, Marco D'Ambros wrote:

> Hi,
>
> I need to write a seaside component which understands
> #renderContentOn: on an external file.
> Let's say that the component is called componentToPrint, what I want
> to do is to redirect the output (what gets written on the html
> document) of
>
> html render: componentToPrint
>
> on an external stream.
>
> How can I do it?
>
> cheers
> Marco
> _______________________________________________
> 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: Rendering on an external stream

Marco D'Ambros
In reply to this post by Julian Fitzell-2
Thanks! The string is enough for me :-)

cheers
Marco


On May 14, 2009, at 11:03 AM, Julian Fitzell wrote:

> You can get a string with
>
> string := html class builder render: componentToPrint
>
> Does that help?
>
> It would get more complex if you actually want to stream it. You'd
> probably want to make a new WAHtmlStreamDocument and configure it with
> "html context document:" (putting the old document back afterwards) or
> even create a new rendering context altogether (see
> WARenderContinuation>>processRendering: for an example) . My memory of
> how this works in 2.8 is a bit fuzzy at the moment; you'd have to play
> to get it right.
>
> Julian
>
> On Thu, May 14, 2009 at 1:39 AM, Marco D'Ambros
> <[hidden email]> wrote:
>> Hi,
>>
>> I need to write a seaside component which understands  
>> #renderContentOn: on
>> an external file.
>> Let's say that the component is called componentToPrint, what I  
>> want to do
>> is to redirect the output (what gets written on the html document) of
>>
>> html render: componentToPrint
>>
>> on an external stream.
>>
>> How can I do it?
>>
>> cheers
>> Marco
>> _______________________________________________
>> 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
Reply | Threaded
Open this post in threaded view
|

Re: Rendering on an external stream

Lukas Renggli
In reply to this post by Marco D'Ambros
Hi Marco,

have a look at WAHtmlBuilder. It can be used to write html to an
arbitrary stream.

Cheers,
Lukas


On Thu, May 14, 2009 at 10:39 AM, Marco D'Ambros
<[hidden email]> wrote:

> Hi,
>
> I need to write a seaside component which understands #renderContentOn: on
> an external file.
> Let's say that the component is called componentToPrint, what I want to do
> is to redirect the output (what gets written on the html document) of
>
> html render: componentToPrint
>
> on an external stream.
>
> How can I do it?
>
> cheers
> Marco
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>

--
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: Rendering on an external stream

Denis Kudriashov
In reply to this post by Marco D'Ambros
Hi,

I do something like that:

contents := (WARenderCanvas builder)
        fullDocument: true;
        rootBlock:
                [:root |
                    root meta
                        contentType: self session contentType
                        charset: self session charSet];
        render: [:html | componentToPrint renderContentOn: html].


Denis

2009/5/14 Marco D'Ambros <[hidden email]>
Hi,

I need to write a seaside component which understands #renderContentOn: on an external file.
Let's say that the component is called componentToPrint, what I want to do is to redirect the output (what gets written on the html document) of

html render: componentToPrint

on an external stream.

How can I do it?

cheers
Marco
_______________________________________________
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