You can use the following code:
byte[] content = getRequestBufferAsBytes(request);
...then do whatever you want
public static byte[] getRequestBufferAsBytes(HttpServletRequest request) throws IOException, ServletException
{
//
// get the RequestBuffer
//
ServletInputStream oInput = request.getInputStream();
long nContentLength = request.getContentLength();
String contentType = request.getContentType();
if (nContentLength <= 0)
return null;
byte[] cContent = new byte[(int)nContentLength];
//
// read the content in 512 bytes chunks
// a single read does not get all the characters
//
int nRead = 0;
int nToRead = (int)nContentLength;
int nBlkSize = 512;
byte[] cTemp = new byte[512];
do {
int n = 0;
int i = 0;
if (nToRead - nRead < 512)
nBlkSize = nToRead - nRead;
n = oInput.read( cTemp,0,nBlkSize);
for (i = 0; i < n; i++)
cContent[i+nRead] = cTemp[i];
nRead += i;
} while (nRead < nToRead);
//cContent[nRead] = (byte)'\0';
Long nBytesRead = new Long( nRead );
return cContent;
}
Jasmin