How can I get an image too big from a server?

Posted by Daniel Calderon Mori on Stack Overflow See other posts from Stack Overflow or by Daniel Calderon Mori
Published on 2012-08-28T22:23:52Z Indexed on 2012/09/01 3:38 UTC
Read the original article Hit count: 197

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.

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets