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 listserv@java.sun.com 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