Revision 6973
Added by ben leinfelder almost 13 years ago
src/edu/ucsb/nceas/metacat/restservice/CNResourceHandler.java | ||
---|---|---|
236 | 236 |
} |
237 | 237 |
status = true; |
238 | 238 |
} else if (httpVerb == POST) { |
239 |
putObject(extra, FUNCTION_NAME_INSERT);
|
|
239 |
putObject(FUNCTION_NAME_INSERT); |
|
240 | 240 |
status = true; |
241 | 241 |
} else if (httpVerb == HEAD) { |
242 | 242 |
describeObject(extra); |
... | ... | |
605 | 605 |
* @throws IllegalAccessException |
606 | 606 |
* @throws InstantiationException |
607 | 607 |
*/ |
608 |
protected void putObject(String pid, String action) throws ServiceFailure,
|
|
608 |
protected void putObject(String action) throws ServiceFailure, |
|
609 | 609 |
InvalidRequest, IdentifierNotUnique, JiBXException, InvalidToken, |
610 | 610 |
NotAuthorized, UnsupportedType, InsufficientResources, |
611 | 611 |
InvalidSystemMetadata, NotImplemented, IOException, |
612 | 612 |
InstantiationException, IllegalAccessException { |
613 |
logMetacat.debug("Entering putObject: " + pid + "/" + action); |
|
614 |
|
|
613 |
|
|
615 | 614 |
// Read the incoming data from its Mime Multipart encoding |
616 | 615 |
Map<String, File> files = collectMultipartFiles(); |
616 |
|
|
617 |
// get the encoded pid string from the body and make the object |
|
618 |
String pidContent = multipartparams.get("pid").get(0); |
|
619 |
Identifier pid = TypeMarshaller.unmarshalTypeFromStream(Identifier.class, IOUtils.toInputStream(pidContent, "UTF-8")); |
|
620 |
|
|
621 |
logMetacat.debug("putObject: " + pid.getValue() + "/" + action); |
|
622 |
|
|
617 | 623 |
InputStream object = null; |
618 | 624 |
InputStream sysmeta = null; |
619 | 625 |
|
... | ... | |
628 | 634 |
SystemMetadata smd = TypeMarshaller.unmarshalTypeFromStream( |
629 | 635 |
SystemMetadata.class, sysmeta); |
630 | 636 |
|
631 |
Identifier id = new Identifier(); |
|
632 |
id.setValue(pid); |
|
633 |
logMetacat.debug("creating object with pid " + id.getValue()); |
|
634 |
Identifier rId = CNodeService.getInstance(request).create(session, |
|
635 |
id, object, smd); |
|
637 |
|
|
638 |
logMetacat.debug("creating object with pid " + pid.getValue()); |
|
639 |
Identifier rId = CNodeService.getInstance(request).create(session, pid, object, smd); |
|
636 | 640 |
|
637 | 641 |
OutputStream out = response.getOutputStream(); |
638 | 642 |
response.setStatus(200); |
Also available in: Unified diff
remove {pid} from POST URL on CN.create()
https://redmine.dataone.org/issues/2284