Re: IE6 and download problem using tomcat java servlet

2004-09-16 Thread Terry Orechia
Thanks for your help.   Your suggestions did not seem to make any 
difference.   However,  I got the application to work when making the 
request from the http  request a HREF=http://.../download?fileid=353;. 
This same request did not work when putting the http request in the address 
field of explorer and hitting go (except after the initial login).   I 
suspect it is due to security restraints configured in tomcat server, but 
not exactly sure.

Thanks,
Terry

- Original Message - 
From: Brantley Hobbs [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, September 14, 2004 10:47 AM
Subject: RE: IE6 and download problem using tomcat java servlet

I should also have pointed out that at that point, you can keep your
.jpeg extension or whatever.  The browser could care less what the file
name is.  It simply looks at the MIME type.
B.
-Original Message-
From: Brantley Hobbs
Sent: Tuesday, September 14, 2004 10:44 AM
To: Tomcat Users List
Subject: RE: IE6 and download problem using tomcat java servlet
 I am having a problem downloading a jpeg file from a tomcat java
servlet
 to Internet Explorer 6.0.  I have changed the file extension to
zzz
to
 force the download prompt. If I restart tomcat(version 4.1.x),
the
While this is a working solution, it's not ideal.  To do this
seamlessly, you should set your output headers to a different mime
type.
application/octet-stream works well for provoking a download dialog.
Here's an example:
response.setContentType(application/octet-stream);
B.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


IE6 and download problem using tomcat java servlet

2004-09-14 Thread Terry Orechia
I am having a problem downloading a jpeg file from a tomcat java servlet to Internet 
Explorer 6.0.  I have changed the file extension to zzz to force the download 
prompt. If I restart tomcat(version 4.1.x), the download works fine the first 
time.  The correct filename video.zzz appears on the prompt and I can hit save and 
it will prompt me as ti where I want to save the file.   However, after the first time 
I get a download prompt with an incorrect filename (the filename is the http query 
request).  If I select save,then  it does not prompt for a location to save and I 
immediately get error Internet explorer was not able to open the requested site. 
Is there something else that needs to be set in the http header?


Here is the piece of the java servlet that is issueing the download:

response.setContentType(APPLICATION/OCTET-STREAM);

response.setHeader(Content-Disposition, 
Attachment;Filename=\video+videoid+.zzz\);

String size=Integer.toString((int)file.length());

response.setHeader(Content-Length,Integer.toString((int)file.length()));


try {

out = response.getWriter();

// transfer the file byte-by-byte to the response object

File fileToDownload = new File(c:\video.zzz);

FileInputStream fileInputStream = newFileInputStream(fileToDownload);

int i;

while ((i=fileInputStream.read())!=-1)

{

out.write(i);

}

fileInputStream.close();

out.close();

}catch(Exception e) // file IO errors

{

e.printStackTrace();

}



Thanks,

Terry


Re: IE6 and download problem using tomcat java servlet

2004-09-14 Thread Jon Wingfield
IE feels the need to cache the content before saving it to the desired 
location. You probably have some headers in the response designed to 
stop caching. You could comment in the RequestDumperValve to confirm this.

Add to your code:
response.setHeader(Pragma, public);
We saw similar problems for downloads from urls within our 
security-constraint. They went away when we added this header.

HTH,
Jon
Terry Orechia wrote:
I am having a problem downloading a jpeg file from a tomcat java servlet to Internet Explorer 6.0.  I have changed the file 
extension to zzz to force the download prompt. If I restart tomcat(version 4.1.x), the download works fine the 
first time.  The correct filename video.zzz appears on the prompt and I can hit save and it will prompt me as ti 
where I want to save the file.   However, after the first time I get a download prompt with an incorrect filename (the 
filename is the http query request).  If I select save,then  it does not prompt for a location to save and I 
immediately get error Internet explorer was not able to open the requested site. Is there something else that 
needs to be set in the http header?
Here is the piece of the java servlet that is issueing the download:
response.setContentType(APPLICATION/OCTET-STREAM);
response.setHeader(Content-Disposition, 
Attachment;Filename=\video+videoid+.zzz\);
String size=Integer.toString((int)file.length());
response.setHeader(Content-Length,Integer.toString((int)file.length()));
try {
out = response.getWriter();
// transfer the file byte-by-byte to the response object
File fileToDownload = new File(c:\video.zzz);
FileInputStream fileInputStream = newFileInputStream(fileToDownload);
int i;
while ((i=fileInputStream.read())!=-1)
{
out.write(i);
}
fileInputStream.close();
out.close();
}catch(Exception e) // file IO errors
{
e.printStackTrace();
}

Thanks,
Terry

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: IE6 and download problem using tomcat java servlet

2004-09-14 Thread Brantley Hobbs
 I am having a problem downloading a jpeg file from a tomcat java
servlet
 to Internet Explorer 6.0.  I have changed the file extension to zzz
to
 force the download prompt. If I restart tomcat(version 4.1.x), the

While this is a working solution, it's not ideal.  To do this
seamlessly, you should set your output headers to a different mime type.
application/octet-stream works well for provoking a download dialog.

Here's an example:
response.setContentType(application/octet-stream);


B.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: IE6 and download problem using tomcat java servlet

2004-09-14 Thread Brantley Hobbs
I should also have pointed out that at that point, you can keep your
.jpeg extension or whatever.  The browser could care less what the file
name is.  It simply looks at the MIME type.

B.

 -Original Message-
 From: Brantley Hobbs
 Sent: Tuesday, September 14, 2004 10:44 AM
 To: Tomcat Users List
 Subject: RE: IE6 and download problem using tomcat java servlet
 
  I am having a problem downloading a jpeg file from a tomcat java
 servlet
  to Internet Explorer 6.0.  I have changed the file extension to
zzz
 to
  force the download prompt. If I restart tomcat(version 4.1.x),
the
 
 While this is a working solution, it's not ideal.  To do this
 seamlessly, you should set your output headers to a different mime
type.
 application/octet-stream works well for provoking a download dialog.
 
 Here's an example:
 response.setContentType(application/octet-stream);
 
 
 B.
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]