You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Magne Skjeret <ma...@broadpark.no> on 2004/03/29 11:47:38 UTC

flush of outputstream

Hi

I have a question I cant seem to find the answer to on the net.

I have had some problems with my application running out of memory. Now 
I have traced the problem to my gzip filter, which stored every bytes in 
memory before flushing it.
I have no implemented it so that the filer sends the bytes chunkeced, 
when the bytes are written to the output stream.
That seems to work fine, but to be 100% sure that I have dealt with the 
problem I need to know if velocity flush its output to the response, 
when it is finsihed with a part.
Or does it wait untill the entire template is finished?

Is there anyone that can shed some light on that?


Magne











---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: flush of outputstream

Posted by Magne Skjeret <ma...@broadpark.no>.
Geir Magnusson Jr wrote:

>
> On Mar 30, 2004, at 12:46 PM, Magne Skjeret wrote:
>
>> Geir Magnusson Jr wrote:
>>
>>>
>>> On Mar 29, 2004, at 4:47 AM, Magne Skjeret wrote:
>>>
>>>> Hi
>>>>
>>>> I have a question I cant seem to find the answer to on the net.
>>>>
>>>> I have had some problems with my application running out of memory. 
>>>> Now I have traced the problem to my gzip filter, which stored every 
>>>> bytes in memory before flushing it.
>>>> I have no implemented it so that the filer sends the bytes 
>>>> chunkeced, when the bytes are written to the output stream.
>>>> That seems to work fine, but to be 100% sure that I have dealt with 
>>>> the problem I need to know if velocity flush its output to the 
>>>> response, when it is finsihed with a part.
>>>> Or does it wait untill the entire template is finished?
>>>>
>>>
>>> Velocity doesn't ever flush - it leaves that up to the containing 
>>> application (i.e. a servlet, the servlet container, your app...)
>>
>>
>> Well, I understand that, but still velocity could e.g buffer 
>> everything in a StringBuffer, and when the template is finshed 
>> parsing everything is written to the outputstream in one chunck.
>> Or do it write directly to the output stream as parts of the template 
>> is finished.
>
>
> Ah - it's writing to the writer that you give it.  Each element in the 
> template are rendered independently of the others.
>
>>
>> Maybe I am way of here. I havent studied the velocity internals, 
>> maybe I should.
>>
>> A equivalient would be to look at a jsp.
>> out.println("Test1");
>> out.println("Test2");
>> This is then written to the response stream in chunck and it is up to 
>> the container when to flush, but at least it is given to the 
>> container to deal with it.
>>
>> out.println("Test1\nTest2");
>> Would not be printed untill both strings are written to the stream.
>>
>> So maybe if I reprashe my question. Does velocity give the content to 
>> the container when everything is done, or as parts is finished?
>
>
> in parts as each part is finished.
>
> So if you have
>
>    $foo   $bar
>
> the rendering of $foo will be written to the writer independently of 
> $bar being written to the writer.

Wonderful :-)

Thanks
Magne

>
> geir
>
>>
>> Magne
>>
>>>
>>>> Is there anyone that can shed some light on that?
>>>>
>>>>
>>>> Magne
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>>>
>>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: .vsl task with Anakia velocity and Ant task

Posted by jules djilo <ju...@yahoo.fr>.
yes, i want to generate a velocity template from anakia


Geir Magnusson Jr <ge...@4quarters.com> wrote:

On Mar 31, 2004, at 9:20 AM, jules djilo wrote:

> I habe a .xml data, and i want to build a .vsl data using anakia 
> velocity and Ant.
> I have allready install in Windows xp, j2sdk 1.4, velocity 1.3

Does this mean you want generate Velocity templates from anakia?

>
> Geir Magnusson Jr wrote:
>
> On Mar 31, 2004, at 6:18 AM, jules djilo wrote:
>
>> Hello
>> How cann I build a .vsl file using anakia velocity and and ant task ?
>> thank you
>
> What kind of data is driving the process?
>
>>
>>
>>
>> ---------------------------------
>> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout 
>> !
>> Créez votre Yahoo! Mail
>>
>> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
>>
> -- 
> Geir Magnusson Jr 203-247-1713(m)
> geir@4quarters.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> 
> ---------------------------------
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
> Créez votre Yahoo! Mail
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
>
-- 
Geir Magnusson Jr 203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org

		
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !

Re: .vsl task with Anakia velocity and Ant task

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Mar 31, 2004, at 9:20 AM, jules djilo wrote:

> I habe a .xml data, and i want to build a .vsl data using anakia 
> velocity and Ant.
> I have allready install in Windows xp, j2sdk 1.4, velocity 1.3

Does this mean you want generate Velocity templates from anakia?

>
> Geir Magnusson Jr <ge...@4quarters.com> wrote:
>
> On Mar 31, 2004, at 6:18 AM, jules djilo wrote:
>
>> Hello
>> How cann I build a .vsl file using anakia velocity and and ant task ?
>> thank you
>
> What kind of data is driving the process?
>
>>
>>
>>
>> ---------------------------------
>> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout 
>> !
>> Créez votre Yahoo! Mail
>>
>> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
>>
> -- 
> Geir Magnusson Jr 203-247-1713(m)
> geir@4quarters.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
> 		
> ---------------------------------
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
> Créez votre Yahoo! Mail
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: .vsl task with Anakia velocity and Ant task

Posted by jules djilo <ju...@yahoo.fr>.
I habe a .xml data, and i want to build a .vsl data using anakia velocity and Ant. 
I have allready install in Windows xp, j2sdk 1.4, velocity 1.3  

Geir Magnusson Jr <ge...@4quarters.com> wrote:

On Mar 31, 2004, at 6:18 AM, jules djilo wrote:

> Hello
> How cann I build a .vsl file using anakia velocity and and ant task ?
> thank you

What kind of data is driving the process?

>
>
> 
> ---------------------------------
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
> Créez votre Yahoo! Mail
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
>
-- 
Geir Magnusson Jr 203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org

		
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !

Re: .vsl task with Anakia velocity and Ant task

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Mar 31, 2004, at 6:18 AM, jules djilo wrote:

> Hello
> How cann I build a .vsl file using anakia velocity and  and ant task ?
> thank you

What kind of data is driving the process?

>
>
> 		
> ---------------------------------
> Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
> Créez votre Yahoo! Mail
>
> Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


.vsl task with Anakia velocity and Ant task

Posted by jules djilo <ju...@yahoo.fr>.
Hello
How cann I build a .vsl file using anakia velocity and  and ant task ?
thank you
 

		
---------------------------------
Yahoo! Mail : votre e-mail personnel et gratuit qui vous suit partout !
Créez votre Yahoo! Mail

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !

Re: flush of outputstream

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Mar 30, 2004, at 12:46 PM, Magne Skjeret wrote:

> Geir Magnusson Jr wrote:
>
>>
>> On Mar 29, 2004, at 4:47 AM, Magne Skjeret wrote:
>>
>>> Hi
>>>
>>> I have a question I cant seem to find the answer to on the net.
>>>
>>> I have had some problems with my application running out of memory. 
>>> Now I have traced the problem to my gzip filter, which stored every 
>>> bytes in memory before flushing it.
>>> I have no implemented it so that the filer sends the bytes 
>>> chunkeced, when the bytes are written to the output stream.
>>> That seems to work fine, but to be 100% sure that I have dealt with 
>>> the problem I need to know if velocity flush its output to the 
>>> response, when it is finsihed with a part.
>>> Or does it wait untill the entire template is finished?
>>>
>>
>> Velocity doesn't ever flush - it leaves that up to the containing 
>> application (i.e. a servlet, the servlet container, your app...)
>
> Well, I understand that, but still velocity could e.g buffer 
> everything in a StringBuffer, and when the template is finshed parsing 
> everything is written to the outputstream in one chunck.
> Or do it write directly to the output stream as parts of the template 
> is finished.

Ah - it's writing to the writer that you give it.  Each element in the 
template are rendered independently of the others.

>
> Maybe I am way of here. I havent studied the velocity internals, maybe 
> I should.
>
> A equivalient would be to look at a jsp.
> out.println("Test1");
> out.println("Test2");
> This is then written to the response stream in chunck and it is up to 
> the container when to flush, but at least it is given to the container 
> to deal with it.
>
> out.println("Test1\nTest2");
> Would not be printed untill both strings are written to the stream.
>
> So maybe if I reprashe my question. Does velocity give the content to 
> the container when everything is done, or as parts is finished?

in parts as each part is finished.

So if you have

    $foo   $bar

the rendering of $foo will be written to the writer independently of 
$bar being written to the writer.

geir

>
> Magne
>
>>
>>> Is there anyone that can shed some light on that?
>>>
>>>
>>> Magne
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: 
>>> velocity-user-help@jakarta.apache.org
>>>
>>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: flush of outputstream

Posted by Magne Skjeret <ma...@broadpark.no>.
Geir Magnusson Jr wrote:

>
> On Mar 29, 2004, at 4:47 AM, Magne Skjeret wrote:
>
>> Hi
>>
>> I have a question I cant seem to find the answer to on the net.
>>
>> I have had some problems with my application running out of memory. 
>> Now I have traced the problem to my gzip filter, which stored every 
>> bytes in memory before flushing it.
>> I have no implemented it so that the filer sends the bytes chunkeced, 
>> when the bytes are written to the output stream.
>> That seems to work fine, but to be 100% sure that I have dealt with 
>> the problem I need to know if velocity flush its output to the 
>> response, when it is finsihed with a part.
>> Or does it wait untill the entire template is finished?
>>
>
> Velocity doesn't ever flush - it leaves that up to the containing 
> application (i.e. a servlet, the servlet container, your app...)

Well, I understand that, but still velocity could e.g buffer everything 
in a StringBuffer, and when the template is finshed parsing everything 
is written to the outputstream in one chunck.
Or do it write directly to the output stream as parts of the template is 
finished.

Maybe I am way of here. I havent studied the velocity internals, maybe I 
should.

A equivalient would be to look at a jsp.
out.println("Test1");
out.println("Test2");
This is then written to the response stream in chunck and it is up to 
the container when to flush, but at least it is given to the container 
to deal with it.

out.println("Test1\nTest2");
Would not be printed untill both strings are written to the stream.

So maybe if I reprashe my question. Does velocity give the content to 
the container when everything is done, or as parts is finished?

Magne

>
>> Is there anyone that can shed some light on that?
>>
>>
>> Magne
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>>
>>



---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: flush of outputstream

Posted by Geir Magnusson Jr <ge...@4quarters.com>.
On Mar 29, 2004, at 4:47 AM, Magne Skjeret wrote:

> Hi
>
> I have a question I cant seem to find the answer to on the net.
>
> I have had some problems with my application running out of memory. 
> Now I have traced the problem to my gzip filter, which stored every 
> bytes in memory before flushing it.
> I have no implemented it so that the filer sends the bytes chunkeced, 
> when the bytes are written to the output stream.
> That seems to work fine, but to be 100% sure that I have dealt with 
> the problem I need to know if velocity flush its output to the 
> response, when it is finsihed with a part.
> Or does it wait untill the entire template is finished?
>

Velocity doesn't ever flush - it leaves that up to the containing 
application (i.e. a servlet, the servlet container, your app...)

> Is there anyone that can shed some light on that?
>
>
> Magne
>
>
>
>
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geir@4quarters.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org