Setting the response Content
Hi ,
I am doing the image retrieval from the server. here i need a progress bar which will show the progress information of the image retrieval.
i feel that if i set the contentlength in the HttpServletResponse object , the i can get total object which is coming over the network.
i kept the code like this
res.setContentLength(image.getSize());
here image is my own object. which is having some size. so at the client side
URL url=new URL("http://localhost/servlet/ServerServlet");
URLConnection con=url.openConnection();
long length=con.getContentLength();
System.out.println("The content length is"+length);
so here i am getting the contentlength is -1, though i specified the content length as image size.
please tell me how to get the progressbar while retriving the image from the server. and the contentlength which i specified.
Regards
laxman
|