Revision 5923
Added by berkley almost 14 years ago
src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java | ||
---|---|---|
1137 | 1137 |
try { |
1138 | 1138 |
out = response.getOutputStream(); |
1139 | 1139 |
response.setStatus(200); |
1140 |
response.setContentType("text/xml"); |
|
1140 |
|
|
1141 | 1141 |
if(guid != null) |
1142 | 1142 |
{ //get a specific document |
1143 | 1143 |
Identifier id = new Identifier(); |
... | ... | |
1148 | 1148 |
{ |
1149 | 1149 |
token = new AuthToken("Public"); |
1150 | 1150 |
} |
1151 |
SystemMetadata sm = cs.getSystemMetadata(token, id); |
|
1152 |
|
|
1153 |
//set the content type |
|
1154 |
if(sm.getObjectFormat().toString().trim().equals(ObjectFormat.TEXT_CSV.toString())) |
|
1155 |
{ |
|
1156 |
response.setContentType("text/csv"); |
|
1157 |
} |
|
1158 |
else if(sm.getObjectFormat().toString().trim().equals(ObjectFormat.TEXT_PLAIN.toString())) |
|
1159 |
{ |
|
1160 |
response.setContentType("text/plain"); |
|
1161 |
} |
|
1162 |
else if(sm.getObjectFormat().toString().trim().equals(ObjectFormat.OCTET_STREAM.toString())) |
|
1163 |
{ |
|
1164 |
response.setContentType("application/octet-stream"); |
|
1165 |
} |
|
1166 |
else |
|
1167 |
{ |
|
1168 |
response.setContentType("text/xml"); |
|
1169 |
} |
|
1170 |
|
|
1151 | 1171 |
InputStream data = cs.get(token, id); |
1152 | 1172 |
IOUtils.copyLarge(data, response.getOutputStream()); |
1153 | 1173 |
} |
Also available in: Unified diff
fixed content type problem where csv files were set as text/xml