Project

General

Profile

Revision 7454

Do not set headers until response is ready to send (5756)

View differences:

src/edu/ucsb/nceas/metacat/MetacatHandler.java
582 582
                return;
583 583
            }
584 584
            // Get output stream
585
            out = response.getOutputStream();
585
            out = response.getOutputStream();            
586
            zOut = new ZipOutputStream(out);
587
            zOut = queryObj
588
                    .getZippedPackage(docId, out, user, groups, passWord);
589
            zOut.finish(); //terminate the zip file
590

  
586 591
            response.setContentType("application/zip"); //MIME type
587 592
            response.setHeader("Content-Disposition",
588 593
                    "attachment; filename="
589 594
                    + docId + ".zip"); // Set the name of the zip file
590
            
591
            zOut = new ZipOutputStream(out);
592
            zOut = queryObj
593
                    .getZippedPackage(docId, out, user, groups, passWord);
594
            zOut.finish(); //terminate the zip file
595 595
            zOut.close(); //close the zip stream
596 596
            
597 597
        } catch (Exception e) {

Also available in: Unified diff