[Jersey] Problem with binary/excel files, https and IE

From: Ralph Soika <>
Date: Thu, 14 Apr 2011 20:32:12 +0200


I have a strange problem concerning a Get Method dealing with an Excel
File via a HTTPS connection.
On the first look everything is fine and works as expected. My method
looks something like this:

    public Response getResultExcel(final @PathParam("id") String filename,
             final @Context UriInfo uriInfo) {
        byte[] excelWorkbook = excelGenerator.copyExcelWorkbook(filename);
        if (excelWorkbook!=null) {
            Response.ResponseBuilder builder = Response.ok(excelWorkbook);
                            "attachment;filename=" + filename);
         } else
           return Response.status(Response.Status.NOT_FOUND).build();

I can request the file from the browser and excel opens the file.
But on IE there is a problem when using the service via HTTPS. IE seems
to open the file twice. A request like '/data/myfile.xls' results in
excel in a filename like "myfile[1].xls". Opening the file via Firefox
the filename becomes "myfile.xls". This all should not be a problem. But
some of my excel files have embedded PivotTables. And during the
download through IE via HTTPS the datasources inside the Pivotable broke
because of an internal caching from IE.

It seems that this problem - providing binary files through IE via HTTPS
connections is well known. See:;en-us;293792

I can't figure out how to control the cache settings in a way that the
file download works on https connections. We have an older
implementation (more than 6 years old) with an simple httpServlet
without any special header params. This servlet works in our
environment. But we whant to migrate the app to JAX-RS/Jersey.

Can anybody help me with this problem?