Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 22nd, 2005, 04:22 AM
Registered User
 
Join Date: Aug 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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




 
Old September 22nd, 2005, 12:04 PM
Registered User
 
Join Date: Sep 2005
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

progress bar is the classic thread test.
you need to have a LOW_PRIORITY thread running in your server which is responsible on image retrieving, while the main thread which is the servlet is returning the results, the servlet should keep sending the current result until the low priority thread finishs retrieving.
firas






Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable Active Content in Browser setting taraprasad Pro JSP 0 February 1st, 2008 05:41 AM
Setting Content Name amitchopra8 J2EE 0 July 25th, 2005 02:11 AM
setting content type of asp generated xml whyulil Classic ASP XML 0 July 15th, 2005 04:50 AM
Setting Response encoding in ASP.Net jaswantsinghrana VS.NET 2002/2003 0 July 22nd, 2003 04:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.