2013-07-02 42 views

回答

2

您將有類似這樣的東西你sevlet

byte[] imageBytes = ... 
response.setHeader("Content-Type", "image/jpg");// or png or gif, etc 
response.setHeader("Content-Length", imageBytes.lenght); 
response.getOutputStream().write(imageBytes); 
1

此代碼工作中。感謝「大衛霍夫曼」。

//data is the content of the image in binary 
response.setContentType("image/jpg");// or png or gif, etc 
response.setContentLength(data.length); 
response.getOutputStream().write(data); 
相關問題