Revision 5629
Added by berkley over 13 years ago
ResourceHandler.java | ||
---|---|---|
40 | 40 |
import org.apache.commons.httpclient.util.DateParser; |
41 | 41 |
import org.apache.commons.io.IOUtils; |
42 | 42 |
import org.apache.log4j.Logger; |
43 |
import org.apache.maven.artifact.ant.shaded.IOUtil; |
|
43 | 44 |
import org.dataone.service.exceptions.BaseException; |
44 | 45 |
import org.dataone.service.exceptions.IdentifierNotUnique; |
45 | 46 |
import org.dataone.service.exceptions.InsufficientResources; |
... | ... | |
67 | 68 |
import edu.ucsb.nceas.metacat.service.SessionService; |
68 | 69 |
import edu.ucsb.nceas.metacat.util.RequestUtil; |
69 | 70 |
import edu.ucsb.nceas.metacat.util.SessionData; |
70 |
|
|
71 |
import org.dataone.service.streaming.util.StreamUtil; |
|
71 | 72 |
/** |
72 | 73 |
* |
73 | 74 |
* Implements Earthgrid REST API to Metacat <br/><br/> |
... | ... | |
996 | 997 |
private String streamToString(InputStream is) |
997 | 998 |
throws IOException |
998 | 999 |
{ |
999 |
byte b[] = new byte[1024]; |
|
1000 |
int numread = is.read(b, 0, 1024); |
|
1001 |
String response = new String(); |
|
1002 |
while(numread != -1) |
|
1003 |
{ |
|
1004 |
response += new String(b, 0, numread); |
|
1005 |
numread = is.read(b, 0, 1024); |
|
1006 |
} |
|
1007 |
return response; |
|
1000 |
return IOUtil.toString(is); |
|
1008 | 1001 |
} |
1009 | 1002 |
|
1010 | 1003 |
private InputStream stringToStream(String s) |
... | ... | |
1063 | 1056 |
return h; |
1064 | 1057 |
} |
1065 | 1058 |
|
1059 |
/*private Hashtable processMMP(InputStream is) |
|
1060 |
throws IOException |
|
1061 |
{ |
|
1062 |
String[] searchStrings = {"boundary=", "Content-Disposition: attachment; filename=systemmetadata", |
|
1063 |
"Content-Disposition: attachment; filename=object"}; |
|
1064 |
byte[] b = new byte[1024]; |
|
1065 |
int numread = is.read(b, 0, 1024); |
|
1066 |
int ssi = 0; |
|
1067 |
while(numread != -1) |
|
1068 |
{ |
|
1069 |
String s = new String(b, 0, numread); |
|
1070 |
int[] result = StreamUtil.lookForMatch(searchStrings[ssi], s); |
|
1071 |
|
|
1072 |
} |
|
1073 |
}*/ |
|
1066 | 1074 |
|
1067 | 1075 |
/** |
1068 | 1076 |
* Earthgrid API > Put Service >Put Function : calls MetacatHandler > handleInsertOrUpdateAction |
Also available in: Unified diff
changes for dataone .5 schema updates