Revision 984
Added by berkley over 22 years ago
datafiles.html | ||
---|---|---|
58 | 58 |
i.e. currently for file download HTTP protocol is only supported.</p> |
59 | 59 |
|
60 | 60 |
<p><b>Data Upload (PUT)</b> |
61 |
<p>Due to a Java limitation on the HTTP PUT comand, the data upload portion |
|
62 |
of Metacat deviates from the standard HTTP interface. A standard bidirectional |
|
63 |
TCP/IP socket is used for tranfering the data. The procedure for uploading a |
|
64 |
file is as follows.</p> |
|
65 |
<ol> |
|
66 |
<li>The client must login to Metacat and get a session_id</li> |
|
67 |
<li>The client sends a request to the servlet with an action of 'getdataport'.</li> |
|
68 |
<li>The server responds with an xml message that includes a port number. The |
|
69 |
message looks like: <pre><xml version="1.0"?><port>xxxx</port></pre> |
|
70 |
where xxxx is an open port between 0 and 65000.</li> |
|
71 |
<li>The client then can create a socket connection to the returned port. |
|
72 |
Note that the client must make this connection within 30 seconds or the |
|
73 |
port will close.</li> |
|
74 |
<li>The data can now be sent but first, some extra information must be |
|
75 |
appended onto the beginning of the data stream. The extra information looks |
|
76 |
like: <pre> [filename]0[sessionID]0[filelength]0[DATA] </pre> The filename, |
|
77 |
sessionID and filelength must be converted into a byte string, terminated |
|
78 |
with a 0 (zero) byte and inserted into the stream in the order shown. The |
|
79 |
filelength is in bytes. The DATA stream does not need to be terminated with |
|
80 |
a 0 byte.</li> |
|
81 |
<li>After the upload the server will return either an error message or |
|
82 |
a success message which will include the docid of the new data file. Both |
|
83 |
messages are encoded in xml (like the port message). The success message |
|
84 |
looks like: |
|
85 |
<pre><?xml version="1.0"?><docid>yyyy</docid></pre> |
|
86 |
where yyyy is the new docid.</li> |
|
87 |
</ul> |
|
88 |
<p>The file DataStreamTest.java is a test class that shows how a client |
|
89 |
must operate to successfully upload a data file to Metacat.</p> |
|
61 |
The insertion and update process for a data file is the same as the |
|
62 |
insertion process for an XML file. |
|
63 |
</p> |
|
90 | 64 |
|
91 | 65 |
<br> |
92 | 66 |
<a href="./replication.html">Back</a> | <a href="./metacattour.html">Home</a> | |
Also available in: Unified diff
fixed some things for release 1.1