On Thu, 23 Aug 2001, Larry Isaacs wrote:
> > length, not no
> > content. It should be a simple change, we just must make sure
> > we check all
> > places where ContentLength is used and fix it everywhere.
>
> To make sure I am in sync, exactly which spec are you refering to.
> Thanks.
ServletRequest.getContentLength(), in javadoc it says "returns -1 if the
content length is unknown". ServletInputStream treats -1 as "no content".
It's not a big deal, as most 'common' requests with a body will have a
content length header, but it is legal to have a request with body but
without content-lenght.
That becomes interesting for SOAP with attachments, where the body starts
to be 'interesting'. In many cases, if you have (many) large attachments,
you'll not be able to buffer all of them to get the total count - or guess
how big the result will be ( since MimeMultipart relys on separators that
are random and hard to predict the size, etC).
The fix in ServletInputStreamFacade is reasonably simple - if
Content-Length is -1, rely on the adapter to signal the end of the request
( by returning -1 on doRead ). Every case that works today will still work
( since now it doesn't work without Content-Length anyway, we'll just make
this other case to work too ).
Costin