Project

General

Profile

« Previous | Next » 

Revision 6133

Added by Chris Jones over 13 years ago

When calling SystemMetadata.getObjectFormat(), return the string value of the ObjectFormatIdentifier rather than ObjectFormat.toString() (which no longer returns the fmtid string).

View differences:

src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
231 231
     * API Resources
232 232
     */
233 233
    private static final String RESOURCE_OBJECTS = "object";
234
    private static final String RESOURCE_FORMATS = "formats";
234 235
    private static final String RESOURCE_META = "meta";
235 236
    private static final String RESOURCE_SESSION = "session";
236 237
    private static final String RESOURCE_IDENTIFIER = "identifier";
......
401 402
                        status = true;
402 403
                    }
403 404
                    
405
                } else if (resource.equals(RESOURCE_FORMATS)) {
406
                  System.out.println("Using resource 'formats'");
404 407

  
405 408
                } else if (resource.equals(RESOURCE_IDENTIFIER)) {
406 409
                    System.out.println("Using resource 'identifier'");
......
1177 1180
                    SystemMetadata sm = cs.getSystemMetadata(token, id);
1178 1181
                    
1179 1182
                    //set the content type
1180
                    if(sm.getObjectFormat().toString().trim().equals(
1183
                    if(sm.getObjectFormat().getFmtid().getValue().trim().equals(
1181 1184
                    		ObjectFormatCache.getFormat("text/csv").getFmtid().getValue()))
1182 1185
                    {
1183 1186
                        response.setContentType("text/csv");
1184 1187
                        response.setHeader("Content-Disposition", "inline; filename=" + id.getValue() + ".csv");
1185 1188
                    }
1186
                    else if(sm.getObjectFormat().toString().trim().equals(
1189
                    else if(sm.getObjectFormat().getFmtid().getValue().trim().equals(
1187 1190
                    		ObjectFormatCache.getFormat("text/plain").getFmtid().getValue()))
1188 1191
                    {
1189 1192
                        response.setContentType("text/plain");
1190 1193
                        response.setHeader("Content-Disposition", "inline; filename=" + id.getValue() + ".txt");
1191 1194
                    } 
1192
                    else if(sm.getObjectFormat().toString().trim().equals(
1195
                    else if(sm.getObjectFormat().getFmtid().getValue().trim().equals(
1193 1196
                    		ObjectFormatCache.getFormat("application/octet-stream").getFmtid().getValue()))
1194 1197
                    {
1195 1198
                        response.setContentType("application/octet-stream");

Also available in: Unified diff