1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
|
ServletOutputStream outStream = response.getOutputStream();
InputStream image=post.getResponseBodyAsStream();
InputStream in = new BufferedInputStream(image);
String type = post.getResponseHeader("Content-Type").getValue();
String length = post.getResponseHeader("Content-Length").getValue();
response.setContentType(type);
byte[] buf = new byte[Integer.parseInt(length)];
int bytesRead;
while ((bytesRead = in.read(buf)) != -1) {
outStream.write(buf, 0, bytesRead);
}
outStream.flush();
response.setContentType("text/html");
outStream.println("BLalalLALAllal ");
outStream.close(); |
Partager