On 05.03.2009 20:08, Mahesh Seshan wrote:
Rainer,
Thank you very much for the prompt response.
To be more specific, Apache CXF is the consumer of HTTP request. Are
you indicating that Apache CXF is the one reading from Socket input
stream ? And that Tomcat HTTP Connector simply hands over the
Inputstream to CXF to consume the chunked contents ?
Tomcat does the chunk decoding when the application consumes the data
via reading from the input stream. So the application will not be able
to see the real chunks, but Tomcat doesn't buffer the full POST body
before the application consumes it. It is important for chunked encoding
to support a streaming architecture.
Think about uploading a DVD ISO image, and the web server buffering the
whole image im memory before handing it over to an aplication. That
wouldn't be nice.
Regards,
Rainer
-mahesh
On Thu, Mar 5, 2009 at 10:39 AM, Rainer Jung<rainer.j...@kippdata.de> wrote:
On 05.03.2009 16:16, Mahesh Seshan wrote:
Hello,
I can obtain the content-length of a HTTP Servlet Request when the
Content-Length header is added by the client. However, when the
Transfer-encoding is chunked, how do I programatically obtain the
content length ?
You can't without consuming the body.
The task at hand for me is to prevent a HTTP client from issuing a
request that has a huge payload that could pose a resource risk on the
HTTP server.
Exactly that's the reason, why there is no easy way to get the length.
Whatever component that could provide you with that information would need
to read all of the body (and buffer it for your later use) in order to
measure its length.
Chunked encoding works with chunks, individual chunks usually are small and
the protocol tells us, how big the next chunk is, but we never know how big
the size of all chunks together is.
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org