problem read ServletInputStream


A

AlexF

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.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top