java 代码
- public String getPostContent(HttpServletRequest request){
- ServletInputStream is = request.getInputStream();
- ByteArrayOutputStream baos = null;
- baos = new ByteArrayOutputStream();
- int iLength = 1024;
- int bytesRead = 0;
- byte[] buff = new byte[iLength];
- while (true)
- {
- bytesRead = is.read(buff);
- if (bytesRead < 1)
- break;
- baos.write(buff, 0, bytesRead);
- }
- return new String(baos.toByteArray(),"utf-8");
- }