On 23/03/2013 16:46, igaz wrote:
> OK, did a quick check of the servlet spec - and I could find nothing that
> proscribes the kind of thing I was thinking about (in fact it has nothing to
> say even about the semantics of using the javax.servlet.ServletInputStream)

Take a closer look. ServletInputStream (up to Servlet 3.0) is clearly
blocking.

> Here is some pseudocode for what I had in mind (I'm eliding quite a bit:

<snip/>

> Note requestIncomplete() returns true only when the *entire* http request
> (headers and body) has been read.
> Now, this is idiomatic java nio and I have used this pattern in implementing
> my own nio server (not for http requests)
> I see nothing in the servlet spec that would proscribe this and it scales
> wonderfully.

No, it doesn't. Think about what happens if someone wants to upload a
5Gb file.

> Yet it seems that Tomcats NIO connector does not do this.  Hence, my
> confusion/curiosity

Tomcat reads the headers (and does so in a non-blocking mode for NIO)
but reading request bodies is an application concern and is performed
with blocking IO (as required by the Servlet specification). Likewise,
writing the response is done with blocking IO as that is also a
requirement of the specification.

All of this changes with Servlet 3.1.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to