Re: response.setHeader() ignored in IE for pdf formats

"Zutshi, Rahul" <[email protected]> Mon, 30 Aug 2004 09:50:00 -0500
Newsgroups gmane.comp.java.sun.servlet
Message-ID <[email protected]>
I might be way off but had a similar situation ...particularly when it's a
POST request.

Looks like your IE is not viewing this as a different request and therefore
pulling it out of the cache. To tackle that(since I have no control of the
user's browser settings) I tried tagging an extra parameter/value pair of
Timestamp=<currentTimeStamp> to the URL where currentTimeStamp is calculated
in a javascript function.

Hope this helps...


-----Original Message-----
From: Sandeep Kachalia [mailto:[email protected]]
Sent: Saturday, August 28, 2004 4:54 AM
To: [email protected]
Subject: response.setHeader() ignored in IE for pdf formats


Hi,
I have a typical problem.My application is meant to view excel/pdf files as
inline content of browser. If I view an Excel file through my application on
a browser and then send request to view pdf file in different(or same)
instance of  browser. Even though the request is for pdf It opens the same
excel file, which was downloaded at client side before. Although application
has generated a pdf file only  but the browser could not recognized it. This
is the problem with IE only, Netscape works properly.
I have read somewhere that IE has some problem with response.setHeader()..it
ignores this. Is there something we need to do in the generator servlet in
order to handle this problem?

Here is a snippet of  code I have written in my serlvet to get stream of
output.
////////////////////////
public class IntellicaController extends HttpServlet
{
    ByteArrayOutputStream data; // containing data to  write
     . . .
     . . .

    if(strFormat.equalsIgnoreCase("xls"))
     {
            res.setContentType("application/vnd.ms-excel");
            res.setHeader("Content-Disposition","inline;
filename=xlsFile.xls");
     }
      else if(strFormat.equalsIgnoreCase("pdf"))
      {
                res.setContentType("application/pdf");
                res.setHeader("Content-Disposition","inline;
filename=pdfFile.pdf");
      }
    out = new DataOutputStream(res.getOutputStream());
    out.write(data.toByteArray());
    out.flush();
     . . .
     . . .
}
////////////////////////

Can anybody help me out..

Thanks,
Sandeep
___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html





___________________________________________________________________________
To unsubscribe, send email to [email protected] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html