How can I get an image too big from a server?
- by Daniel Calderon Mori
I'm currenty developing for blackberry and just bumped into this problem as i was trying to download an image from a server. The servlet which the device communicates with is working correctly, as I have made a number of tests for it. But it gives me the
413 HTTP error ("Request entity too large").
I figure i will just get the bytes, uhm, portion by portion. How can i accomplish this?
This is the code of the servlet (the doGet() method):
try {
ImageIcon imageIcon = new ImageIcon("c:\\Users\\dcalderon\\prueba.png");
Image image = imageIcon.getImage();
PngEncoder pngEncoder = new PngEncoder(image, true);
output.write(pngEncoder.pngEncode());
} finally {
output.close();
}
Thanks. It's worth mentioning that I am developing both the client-side and the server-side.