Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

request.getInputStream always empty (tomcat)

843841Nov 24 2004 — edited Sep 7 2007
Hi,
I'm trying to read the POST data from a HttpServletRequest in tomcat 5.x. request.getContentLength() returns 15, but request.getInputStream is always empty!
ServletInputStream cont = request.getInputStream();
sb.append("\nContent available:");
sb.append(cont.available());
sb.append("\nContent:");
BufferedReader br = new BufferedReader(new InputStreamReader(cont));
sb.append(br.readLine());
i have tested this with requests from an html form and requests programatically generated.

what am i doing wrong?
Is this because the servlet has already read the post data and used it's content to populate request.getParameters?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 5 2007
Added on Nov 24 2004
5 comments
1,518 views