tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fabio Rossi <paranoid_fa...@yahoo.it>
Subject Re: Unable to disable output buffering
Date Mon, 02 Jul 2007 11:02:39 GMT
Hi, thank you for the answer, but my problem in different.
When I send the data, I specify the content lenght and the client knows if the "download"
is completed or not.

The problem is that, with output buffering, if the client crashes, for example, after it has
downloaded 1MB of a 4MB file, the servlet noticed the crash (an exception is raised).

The problem is that, if the client crash when it has downloaded almost all the data, the servlet
doesn't notice the crash beacuse it has written correctly in the buffer, even if the real
write to the client cannot succed. It' s not easy for me to explain that very well in english,
but my problem is the same as the one posted here:

http://mail-archives.apache.org/mod_mbox/tomcat-users/200401.mbox/%3C3FFD4EF2.2070401@digitro.com.br%3E

So i tried using socketBuffer=-1 in the connector properties (server.xml) but it doesn't work
anyway.

Thank you.

Johnny Kewl <john@kewlstuff.co.za> ha scritto: 
Fabio, it just sounds all wrong....
I have a sneaky suspicion that if you made the buffer very large, your 
problems will fix themselves, but thats still not the solution.
I actually think you are not telling the client the size of the data.... do 
you set
        response.setContentLength("How Big");
anywhere?

I forget all the details, but its something like this...
If you dont set the size.... TC will drop the connection when the data is 
sent, the old HTTP spec.
If the data is massive with no size, TC will start chunking, and the client 
has to wait for that last special char, to know its done.
If it all fits into the buffer, TC will create the headers, because it can 
see all the data.... and that will probably fix it, but its just luck.

But if you give it the size.... the client will know how much data is 
coming, and wait for it.... so if the browser sits there waiting forever, 
you know theres something wrong, like the servlet isnt sending all the data, 
ie header size is greater than actual data sent.

I just think you should give the client enuf info to decide for itself.... 
theres alot of internet between server and client, if something crashes, 
client should still be able to say, hey user you need to refresh.... I think 
its the only way.

Why wont the above work?... maybe you should post your code...

----- Original Message ----- 
From: "Fabio Rossi" 

To: 
Sent: Monday, July 02, 2007 10:49 AM
Subject: Unable to disable output buffering


> Hello.
>
> I need to disable output stream buffering. I tried with 
> response.setBufferSize but i noticed that Tomcat does not permit to set a 
> level lower than the standard 8k.
> Then I read that the solution is to specify the connector property 
> socketBuffer="-1" in server.xml but again, it does not work for me. If I 
> print the current buffer size during the execution of the servlet I get 
> again the same 8192.
>
> How can I do do disable output buffering? I need that an exception is 
> raised even if the client fails to read the last byte of the stream...and 
> with output buffering it's not possibile.
>
> Please help. Thank you.
>
> ---------------------------------
>
> ---------------------------------
> L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




       
---------------------------------

---------------------------------
L'email della prossima generazione? Puoi averla con la nuova Yahoo! Mail
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message