Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2006

Tip: Looking for answers? Try searching our database.

Problem to download a file from 2 browsers at the time

Thread view: 
prado - 19 Jun 2006 17:45 GMT
I have this JSP that download an excel file.

It works fine if I use only one browser at the same time.

The problem is when I try to do this but from 2 browsers at the same
time. From each browser I can download a part of the file but not the
complete file.
It seems the browsers are sharing the bandwidth and when it starts to
download a file the other stops.

I have look the logs, and I saw the file has downloaded to the computer

and while the the jsp is working.
I don't undestand why the file has finished to download and while the
jsp is still executing.

Can you help me please?

do anybody try this JSP and tell me if the result is the same as me?

------------------------------------------JSP
-----------------------------------------------------------------------------------

<%@page contentType="application/vnd.ms-excel"%>

<%@ page language="java" import="java.io.*"%>
<%@ page language="java" import="java.util.*"%>

<%

Date fecha = new Date();

java.sql.Date fechaSQL = new java.sql.Date(fecha.getTime());

Calendar calendario = Calendar.getInstance();
calendario.setTime(fecha); // fecha es el Date de antes.
String strHour = String.valueOf( calendario.get(Calendar.HOUR) );
String strMinute = String.valueOf( calendario.get(Calendar.MINUTE) );
String strSecond = String.valueOf( calendario.get(Calendar.SECOND) );

String nombre =  "FILE" + strHour + strMinute + strSecond + ".xls";

System.out.println(  " IN OF  " + nombre );

    response.setContentType( "application/x-download" );

    response.setHeader("Content-type","application/vnd.ms-excel");

    response.setHeader("Content-Disposition","attachment; filename=\""
+ nombre + "\"");

System.out.println( nombre + "   START"  );

for (int l=0;l<30000;l++){
System.out.println( nombre + "  " + l  );

 for (int k=0;k<250;k++){

       out.write(nombre + " : ("+ l + "," + k + ")" + "\t" );

 }
       out.write("\n");

}

System.out.println( nombre + "  END"  );

%>
prado - 20 Jun 2006 10:29 GMT
Please, I need help.

Thanks.
Timo Stamm - 20 Jun 2006 11:35 GMT
prado schrieb:
> The problem is when I try to do this but from 2 browsers at the same
> time. From each browser I can download a part of the file but not the
> complete file.

I can't see any error and suspect that your browser is broken. Try
downloading from two separate computers and with different browsers.

Timo
prado - 20 Jun 2006 13:45 GMT
I think the problem is the version of Tomcat, my actual version is
5.5.4.

I have tried in other version 5.5.9 and it work fine.

It is the version of tomcat  or perhaps it is configuration of tomcat,
I don't Know.
Timo Stamm - 20 Jun 2006 14:36 GMT
prado schrieb:
> I think the problem is the version of Tomcat, my actual version is
> 5.5.4.
[quoted text clipped - 3 lines]
> It is the version of tomcat  or perhaps it is configuration of tomcat,
> I don't Know.

I don't think this is a configuration problem. You probably found an old
bug in tomcat if updating tomcat fixes the issue. I tested your code
with Jetty and Safari, and it works fine.
prado - 20 Jun 2006 17:16 GMT
Thanks. I am going to change the version of tomcat.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.