You say "It's possible the content is not text" but then you post some code which converts the content into a String. Obviously a bad idea for something which might not be text; but then you post some other code which doesn't do that.
However your other code has several problems:
First, you call the read() method, reading into a buffer, and you assume that it fills the buffer. This isn't a good assumption. The read() method returns the number of bytes it actually put into the buffer, but you disregarded that.
Second, you take the buffer, which supposedly is the bytes of the request, and you wrap it in a ByteArrayInputStream (why?) and then call the toString() method of the ByteArrayInputStream (why?) and then you do something with that nonsense string which has nothing to do with the request data.
However I'm at a loss to suggest what you should do instead, because you didn't say what you wanted to do. You just said that some things didn't happen and posted some weird code which didn't seem to be related to those things.
Joined: Sep 17, 2010
Sorry for the weird code. I am trying to get the request content body and convert it in InputStream.