tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remy Maucherat" <r...@apache.org>
Subject Re: cvs commit: jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat4 CoyoteResponse.java
Date Tue, 09 Apr 2002 19:40:12 GMT
> On Tue, 9 Apr 2002, Remy Maucherat wrote:
>
> > > Can you add a small comment in Response and clearly indicate who
should
> > > call it - I'm fine with any, but we should do it consistenlty in the 2
> > > adapters and in the 2 protocols.
> >
> > The class which is implementing the Adapter interface is calling it in
the
> > TC 4 code.
>
> Ok. I'll change  tomcat3 and revert the change on 4.0 ( and add a comment
> on adapter ). But first let's clarify how it's supposed to work, the
> current Tomcat4Adapter doesn't seem to call it - it calls
> Tomcat4Response.finish() but that didn't call Response.finish() before my
> patch.
>
>
> > outputBuffer.close();
> > should COMMIT
>
> There's no outputBuffer.close in the API - only in 4.0.
>
> Who should send the commit ?

The OutputBuffer there is the class in the same package, so it's not the one
you're thinking about (yes, I know).

> > coyoteResponse.finish();
> > should CLOSE
>
> Yes, but Tomcat4 Response finish() method didn't call
> coyoteResponse.finish().

It is called by CoyoteAdapter now (or CoyoteProcessor in the old connector).

> > For the HTTP/1.1 protocol:
> > - Committing twice is not ok.
> > - Closing twice is not ok.
>
> Of course, same for ajp or any other protocol. We should definitely commit
> only once and close only once - the question is who is responsible for
> that.

It would be reasonable to be more robust. I added a flag for finish.

> Coyote Response has a sendHeaders() method, which sets commited to true.
> I think it should also call the COMMIT hook - if not the caller of
> sendHeaders() ( Tomcat4 or Tomcat3 Response ) must do it. ( before my
> fix it wasn't true - the COMMIt was sent by http11 before the first write
> ).

That one looks ok.
It's not mandatory to call sendHeader, though (just writing something will
commit and send the headers).

> Also, Response has a finish() that calls CLOSE - but finish wasn't called
> by tomcat4's Response, neither by the adapter ( which called
> response.finishResponse() - but on the tomcat4 response, which didn't
> propagate to the coyote.Response ).

Ok. However, in the processor, endRequest is called, which does the same as
a finish. So that would have done some bad stuff with the filters without
the flag I added (not good).

Remy


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message