Revision 3076
Added by Matt Jones about 18 years ago
src/edu/ucsb/nceas/metacat/MetaCatServlet.java | ||
---|---|---|
1559 | 1559 |
// returns |
1560 | 1560 |
// response.setContentType("application/octet-stream"); |
1561 | 1561 |
|
1562 |
// Set the name of the data file to the entity name plus docid, |
|
1563 |
// or if that is unavailable, use the docid alone |
|
1564 |
String docname = doc.getDocname(); |
|
1565 |
if (docname == null || docname.equals("")) { |
|
1566 |
docname = docid; |
|
1567 |
} else { |
|
1568 |
docname = docid + "-" + docname; |
|
1569 |
} |
|
1570 |
response.setHeader("Content-Disposition", |
|
1571 |
"attachment; filename=" + docname); |
|
1572 |
|
|
1562 | 1573 |
try { |
1563 |
|
|
1564 | 1574 |
ServletOutputStream out = response.getOutputStream(); |
1565 | 1575 |
byte[] buf = new byte[4 * 1024]; // 4K buffer |
1566 | 1576 |
int b = fin.read(buf); |
... | ... | |
1579 | 1589 |
// by default the document should be returned in xml format |
1580 | 1590 |
// set content type first |
1581 | 1591 |
response.setContentType("text/xml"); //MIME type |
1592 |
response.setHeader("Content-Disposition", |
|
1593 |
"attachment; filename=" + docid + ".xml"); |
|
1582 | 1594 |
PrintWriter out = response.getWriter(); |
1583 | 1595 |
doc.toXml(out, user, groups, withInlineData); |
1584 | 1596 |
} else { |
Also available in: Unified diff
Changed the filename that is used when data files are downloaded and when XML files are downloaded in XML format. Now, data files use the format "docid-docname". See bug #2566.