[jetty-users] Servlet-Response: How to let the servlet decide about chunking / process pre-chunked content?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jetty-users] Servlet-Response: How to let the servlet decide about chunking / process pre-chunked content?

Wenig, Michael (IT/I4Z)
Servlet-Response: How to let the servlet decide about chunking / process pre-chunked content?

Hi all,

I have a system which reads data from a log-file on the file system which is created and appended during reading. (I do a java implemented 'tail -f' on that file and writes it to the outputstream of the servlet).

I set the "transfer-encoding: chunked"-header and after each line (could be also from time to time) I do a flush in the stream in order to send it to the client.

This worked in older versions of jetty. Now we did an upgrade to 6.1.26 (the highest stable version available via Maven-Repo) and found out that this is not working any more.

According to https://bugs.eclipse.org/bugs/show_bug.cgi?id=364174 chunking is now completely handled inside jetty. The developers recomend to get all data first, "de-chunk" them and then give it to jetty. I disagree about the interpretation of the servlet spec that this is only the responsibility of the container (and indeed other containers like tomcat, websphere etc. do allow pre-chunked-responses). And also I do see some cases where this is really in need - another example would be proxying some remote resources which are slow on connection...

This leads to the fact, that the log is not delivered before the process has ended (or perhaps a bigger amount was created - our logs are very small). As this servlet is used to monitor the process this breaks completely the usability.

So the question is:

Is there any possibility to tell jetty that the servlet is responsible for chunking and jetty should not buffer or anything like that?

Or - if this would work - to "disbale" the internal chunking by setting the chunk-size to a very small value (that would not be a real problem at our case as the only other accesses are some small soap-requests)

As far as I see the only other option would be to replace jetty by something else in this case (ugh)

Thanks for your help!


Diese E-Mail enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtuemlich erhalten
haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht

This email may contain confidential and/or privileged information.
If you are not the intended recipient (or have received this email
in error) please notify the sender immediately and destroy this email.
Any unauthorized copying, disclosure or distribution of the material
in this email is strictly forbidden.

jetty-users mailing list
[hidden email]