tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Filip Hanik - Dev Lists <devli...@hanik.com>
Subject Re: Comet and multipart
Date Tue, 04 Jan 2011 17:43:50 GMT
On 1/4/2011 1:26 AM, sol myr wrote:
> Filip, thanks for your reply.
> You are correct that the server simply writes data, which we can format any way we like.
> However, we were wondering whether Tomcat has any utilities/configurations to make it
easier. E.g:
>
> 1) If we use multipart format (to separate between messages), does Tomcat/Apache have
utilities to make it easier? Or should we hand-code the appropriate headers, separators, etc?
Not in Tomcat 6. The risk of using any utilities out there, is that they will want to block
on inputstream.read until the entire request 
body has been read, and I suspect that's not what you want.
> 2) If we rely on "Content-length:" (to tell when one message ends and another begins),
this header is usually automatically managed by Tomcat, so we'd have to ask Tomcat to manage
it differently (otherwise, it might calculate one "content-length" for all messages put together,
or it might omit it altogether and use "chunked" instead - which is also be an option, but
then how do we tell tomcat to have a chunk per message).
I would not use Content-Length, by doing so, you're setting a limit to yourself on how long
the Comet request is alive

best
Filip

> Thanks again
>
> --- On Mon, 1/3/11, Filip Hanik - Dev Lists<devlists@hanik.com>  wrote:
>
> From: Filip Hanik - Dev Lists<devlists@hanik.com>
> Subject: Re: Comet and multipart
> To: "Tomcat Users List"<users@tomcat.apache.org>
> Date: Monday, January 3, 2011, 8:47 AM
>
> On 1/3/2011 7:48 AM, sol myr wrote:
>> Hi,
>>
>> We're implementing a CometServlet on top of Tomcat NIO connector, using "long polling".
>> Currently we're using the approach recommended by most tutorials: the client opens
a connection and waits for a message (for a configured timeout); if such a message arrives,
the client consumes it (e.g. presents it on screen), then *closes* the http connection, and
opens a new connection (to wait for the next message).
>>
>> Unfortunately, we have a network performance problem with opening and closing connections
(our 3rd party proxy is good at keeping connections alive, but is slow in negotiating new
connections).
>>
>> So we'd like to keep the HTTP connection alive, and pass multiple messages on the
same connection. We were hoping to tell the messages apart based on multipart format, or some
other separator, or content length.
>>
>> Could anyone please tell whether that's supported on the TomcatServlet side?
> yes, it is supported, as long as your client knows how to do it. On the server/servlet
side, all you do is read the input stream byte by byte
> you can create any type of protocol rules inside the HTTP message that it sends up
> best
> Filip
>
>
>
>
>
>
>
> -----
> No virus found in this message.
> Checked by AVG - www.avg.com
> Version: 10.0.1191 / Virus Database: 1435/3357 - Release Date: 01/03/11


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


Mime
View raw message