File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes getContentLength() clarification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "getContentLength() clarification" Watch "getContentLength() clarification" New topic

getContentLength() clarification

dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
I'm working on fixing Slide bug "can't handle files > 2GB". The problem issued that content length is bigger than MAX_INT. Spec for getContentLength() states:

Returns the length, in bytes, of the request body and made available by the input stream, or -1 if the length is not known. For HTTP servlets, same as the value of the CGI variable CONTENT_LENGTH.

an integer containing the length of the request body or -1 if the length is not known

What should I expect from this method for content length > 2GB? -1 ? Wrong, because content length is known. If there is somebody from servlet API group, then please clarify.

Tough in space?, <a href="" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="" target="_blank" rel="nofollow">Check it here.</a><br /><a href="" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
I agree. Here's the link:
subject: getContentLength() clarification
It's not a secret anymore!