Project

General

Profile

« Previous | Next » 

Revision 6975

use plain String parameter for {pid} instead of XML serialization of it.

View differences:

src/edu/ucsb/nceas/metacat/restservice/MNResourceHandler.java
991 991
    	// Read the incoming data from its Mime Multipart encoding
992 992
    	Map<String, File> files = collectMultipartFiles();
993 993
               
994
    	Identifier pid = null;
994
    	Identifier pid = new Identifier();
995 995
        if (trailingPid == null) {
996
	        // get the encoded pid string from the body and make the object
997
	        String pidContent = multipartparams.get("pid").get(0);
998
	        pid = TypeMarshaller.unmarshalTypeFromStream(Identifier.class, IOUtils.toInputStream(pidContent, "UTF-8"));
996
	        // get the pid string from the body and set the value
997
	        String pidString = multipartparams.get("pid").get(0);
998
	        pid.setValue(pidString);
999 999
        } else {
1000 1000
        	// use the pid included in the URL
1001
        	pid = new Identifier();
1002 1001
        	pid.setValue(trailingPid);
1003 1002
        }
1004 1003
        logMetacat.debug("putObject with pid " + pid.getValue());
......
1043 1042
            Identifier newPid = null;
1044 1043
            try {
1045 1044
            	String newPidString = multipartparams.get("newPid").get(0);
1046
            	newPid = TypeMarshaller.unmarshalTypeFromStream(Identifier.class, IOUtils.toInputStream(newPidString, "UTF-8"));
1045
            	newPid = new Identifier();
1046
            	newPid.setValue(newPidString);
1047 1047
            } catch (Exception e) {
1048 1048
				logMetacat.error("Could not get newPid from request");
1049 1049
			}
src/edu/ucsb/nceas/metacat/restservice/CNResourceHandler.java
615 615
        Map<String, File> files = collectMultipartFiles();
616 616
        
617 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"));
618
        String pidString = multipartparams.get("pid").get(0);
619
        Identifier pid = new Identifier();
620
        pid.setValue(pidString);
620 621
        
621 622
        logMetacat.debug("putObject: " + pid.getValue() + "/" + action);
622 623
        
......
944 945
        Map<String, File> files = collectMultipartFiles();
945 946
        
946 947
    	// get the encoded pid string from the body and make the object
947
        String pidContent = multipartparams.get("pid").get(0);
948
        Identifier pid = TypeMarshaller.unmarshalTypeFromStream(Identifier.class, IOUtils.toInputStream(pidContent, "UTF-8"));
948
        String pidString = multipartparams.get("pid").get(0);
949
        Identifier pid = new Identifier();
950
        pid.setValue(pidString);
949 951
        
950 952
        logMetacat.debug("registerSystemMetadata: " + pid);
951 953

  

Also available in: Unified diff