Project

General

Profile

« Previous | Next » 

Revision 7019

handle both listing and getting checksums using the GET endpoint -- depends whether or not a pid is included in the URL
https://redmine.dataone.org/issues/2089

View differences:

src/edu/ucsb/nceas/metacat/restservice/MNResourceHandler.java
74 74
import org.dataone.service.types.v1.Permission;
75 75
import org.dataone.service.types.v1.Subject;
76 76
import org.dataone.service.types.v1.SystemMetadata;
77
import org.dataone.service.util.Constants;
77 78
import org.dataone.service.util.DateTimeMarshaller;
78 79
import org.dataone.service.util.ExceptionHandler;
79 80
import org.dataone.service.util.TypeMarshaller;
......
246 247
                        getLog();
247 248
                        status = true;
248 249
                    }
249
                } else if (resource.startsWith(RESOURCE_CHECKSUM)) {
250
                } else if (resource.startsWith(Constants.RESOURCE_CHECKSUM)) {
250 251
                    logMetacat.debug("Using resource 'checksum'");
251 252
                    // handle checksum requests
252 253
                    if (httpVerb == GET) {
253 254
                    	// after the command
254
                        extra = parseTrailing(resource, RESOURCE_CHECKSUM);
255
                        extra = parseTrailing(resource, Constants.RESOURCE_CHECKSUM);
255 256
                        checksum(extra);
256 257
                        status = true;
257 258
                    }
src/edu/ucsb/nceas/metacat/restservice/CNResourceHandler.java
276 276
                        status = true;
277 277
                    }
278 278

  
279
                } else if (resource.startsWith(RESOURCE_CHECKSUM)) {
280
                    logMetacat.debug("Using resource: " + RESOURCE_CHECKSUM);
279
                } else if (resource.startsWith(Constants.RESOURCE_CHECKSUM)) {
280
                    logMetacat.debug("Using resource: " + Constants.RESOURCE_CHECKSUM);
281 281

  
282 282
                    // after the command
283
                    extra = parseTrailing(resource, RESOURCE_CHECKSUM);
283
                    extra = parseTrailing(resource, Constants.RESOURCE_CHECKSUM);
284 284

  
285 285
                    // handle checksum requests
286 286
                    if (httpVerb == GET) {
287 287

  
288
                        checksum(extra);
289
                        status = true;
288
                    	if (extra != null && extra.length() > 0) {
289
	                        checksum(extra);
290
	                        status = true;
291
                    	} else {
292
                    		listChecksumAlgorithms();
293
                    		status = true;
294
                    	}
290 295

  
291 296
                    }
292 297

  
......
341 346
                        // TODO: send to output	
342 347
                        status = true;
343 348
                    }
344
                } else if (resource.startsWith(Constants.RESOURCE_CHECKSUM)) {
345
                    if (httpVerb == GET) {
346
                        listChecksumAlgorithms();
347
                        status = true;
348
                    }
349 349
                } else if (resource.startsWith(Constants.RESOURCE_META_OBSOLETEDBY)
350 350
                        && httpVerb == PUT) {
351 351

  
src/edu/ucsb/nceas/metacat/restservice/D1ResourceHandler.java
90 90
    protected static final String RESOURCE_OBJECTS = "object";
91 91
    protected static final String RESOURCE_META = "meta";
92 92
    protected static final String RESOURCE_LOG = "log";
93
    protected static final String RESOURCE_CHECKSUM = "checksum";
94 93
    
95 94
    protected static final String RESOURCE_IS_AUTHORIZED = "isAuthorized";
96 95
    protected static final String RESOURCE_ACCESS_RULES = "accessRules";

Also available in: Unified diff