Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   problem read ServletInputStream (http://www.velocityreviews.com/forums/t389170-problem-read-servletinputstream.html)

AlexF 12-05-2006 07:39 AM

problem read ServletInputStream
 
Hi,

I didn't find the answer at group content.
May be anybody knows how to solve this problem?

I use HTTPS connection and servlet receives XML to parse.

With JDK1.4 was no problem with reading ServletInputStream:

ServletInputStream inputStream = request.getInputStream();
lw.info("After Get Input Stream.");
ByteArrayOutputStream uploadBuffer = new
ByteArrayOutputStream();

int count;
byte[] buff = new byte[2048];
lw.info("Start reading from buffer");
while ((count = inputStream.read(buff)) != -1) {
uploadBuffer.write(buff, 0, count);
}
lw.info("End reading from buffer");
inputStream.close();
uploadBuffer.close();
req = new String(uploadBuffer.toByteArray());

The same code compiled with JDK1.5 returns empty request - at first
read the return value is -1.
I've tried all read(..) methods but without unsucceed.

Please, help to solve the problem.



All times are GMT. The time now is 03:48 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.