Project

General

Profile

« Previous | Next » 

Revision 10050

Added by Jing Tao about 8 years ago

To set the content-deposition header, the cn will look the file name in the system metadata first.

View differences:

src/edu/ucsb/nceas/metacat/restservice/v2/CNResourceHandler.java
600 600
        if (mimeType == null) {
601 601
        	mimeType = "application/octet-stream";
602 602
        }
603
        String extension = ObjectFormatInfo.instance().getExtension(sm.getFormatId().getValue());
604
        String filename = id.getValue();
605
        if (extension != null) {
606
        	filename = id.getValue() + extension;
603
       
604
        String filename = sm.getFileName();
605
        if(filename == null || filename.trim().equals("")) {
606
            filename = id.getValue();
607
            String extension = ObjectFormatInfo.instance().getExtension(sm.getFormatId().getValue());
608
            if (extension != null) {
609
                filename = id.getValue() + extension;
610
            }
607 611
        }
612
        
608 613
        response.setContentType(mimeType);
609 614
        response.setHeader("Content-Disposition", "inline; filename=" + filename);
610 615

  

Also available in: Unified diff