You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jaroslav Záruba <ja...@gmail.com> on 2015/02/28 21:54:35 UTC

How to disable chunking? [Tomcat 7]

Hello

I'm trying to set-up an EventSource servlet, yet Tomcat seems to be adding
"Transfer-Encoding: chunked" header to my responses, so they trigger the
onerror handler on my EventSource object.

According to some, setting org.apache.coyote.http11.Http11NioProtocol as
the protocol on my http <Connector/> should help with that, but it just
does not seem to make any difference, the header is still there.
There used to be attribute "allowChunking" on <Connector/>, but that's
history.

Tested with 7.0.30 and now 7.0.59, Win7 64 bit.

Would anyone know please...?

JZ

Re: How to disable chunking? [Tomcat 7]

Posted by Jaroslav Záruba <ja...@gmail.com>.
Hello

I still have no clue. I tend to think EventSource simply "works" like that,
that is triggering the onerror handler (if you have set-up one) after a
response gets delivered. (Even a 200-status response.) And one simply has
to decide how to deal with such pseudo-error. If the readyState of your
eventSource is 0 (CONNECTING) you have to believe all is OK. (This is where
I am now.)

Weird thing is the error-event never bears any message that would give you
a hint on what's happening or why was the handler triggered. This is not my
code/browser malfuncioning, this is a known fact. I find it unfortunate to
say the least. :P

If you got bored enough, here's a stripped-down Maven project:
https://bitbucket.org/jaromor/serversentevents
...a single servlet class and 15 lines of JS.

Jarda

On Sun, Mar 1, 2015 at 2:56 AM, Gregory Gerard <gg...@gmail.com> wrote:

> Root cause?
>
>
> > On Feb 28, 2015, at 15:20, Jaroslav Záruba <ja...@gmail.com>
> wrote:
> >
> > Hello again :)
> >
> > Apparently adding Connection: close" header to my response prevents the
> > "evil" heaqder to be added.
> > And it turns out the header isn't the reason why EventSource receives the
> > message-less error.
> >
> > Cheers
> >  Jarda
> >
> > On Sat, Feb 28, 2015 at 9:54 PM, Jaroslav Záruba <
> jaroslav.zaruba@gmail.com>
> > wrote:
> >
> >> Hello
> >>
> >> I'm trying to set-up an EventSource servlet, yet Tomcat seems to be
> adding
> >> "Transfer-Encoding: chunked" header to my responses, so they trigger the
> >> onerror handler on my EventSource object.
> >>
> >> According to some, setting org.apache.coyote.http11.Http11NioProtocol as
> >> the protocol on my http <Connector/> should help with that, but it just
> >> does not seem to make any difference, the header is still there.
> >> There used to be attribute "allowChunking" on <Connector/>, but that's
> >> history.
> >>
> >> Tested with 7.0.30 and now 7.0.59, Win7 64 bit.
> >>
> >> Would anyone know please...?
> >>
> >> JZ
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: How to disable chunking? [Tomcat 7]

Posted by Gregory Gerard <gg...@gmail.com>.
Root cause?


> On Feb 28, 2015, at 15:20, Jaroslav Záruba <ja...@gmail.com> wrote:
> 
> Hello again :)
> 
> Apparently adding Connection: close" header to my response prevents the
> "evil" heaqder to be added.
> And it turns out the header isn't the reason why EventSource receives the
> message-less error.
> 
> Cheers
>  Jarda
> 
> On Sat, Feb 28, 2015 at 9:54 PM, Jaroslav Záruba <ja...@gmail.com>
> wrote:
> 
>> Hello
>> 
>> I'm trying to set-up an EventSource servlet, yet Tomcat seems to be adding
>> "Transfer-Encoding: chunked" header to my responses, so they trigger the
>> onerror handler on my EventSource object.
>> 
>> According to some, setting org.apache.coyote.http11.Http11NioProtocol as
>> the protocol on my http <Connector/> should help with that, but it just
>> does not seem to make any difference, the header is still there.
>> There used to be attribute "allowChunking" on <Connector/>, but that's
>> history.
>> 
>> Tested with 7.0.30 and now 7.0.59, Win7 64 bit.
>> 
>> Would anyone know please...?
>> 
>> JZ
>> 

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


Re: How to disable chunking? [Tomcat 7]

Posted by Jaroslav Záruba <ja...@gmail.com>.
Hello again :)

Apparently adding Connection: close" header to my response prevents the
"evil" heaqder to be added.
And it turns out the header isn't the reason why EventSource receives the
message-less error.

Cheers
  Jarda

On Sat, Feb 28, 2015 at 9:54 PM, Jaroslav Záruba <ja...@gmail.com>
wrote:

> Hello
>
> I'm trying to set-up an EventSource servlet, yet Tomcat seems to be adding
> "Transfer-Encoding: chunked" header to my responses, so they trigger the
> onerror handler on my EventSource object.
>
> According to some, setting org.apache.coyote.http11.Http11NioProtocol as
> the protocol on my http <Connector/> should help with that, but it just
> does not seem to make any difference, the header is still there.
> There used to be attribute "allowChunking" on <Connector/>, but that's
> history.
>
> Tested with 7.0.30 and now 7.0.59, Win7 64 bit.
>
> Would anyone know please...?
>
> JZ
>