Chunked File Upload SupportPage edited by Shashank GuptaChanges (16)
Full ContentChunked File UploadStatus: DRAFT Use Cases:1. Large file upload - With high speed internet connections, advent of cloud and HD going mainstream, Sling support large files (> 2GB) upload. ApproachSling provides an extension to SlingPostServlet which accepts file chunks in accordance with a specified protocol. Sling client slices the file in chunks, and upload the chunks in serial manner to server. Each chunk is numbered serially and the last chunk has additional identifier to distinguish from the rest chunks. Sling SlingPostServletupon receiving the last chunk, stitches all chunks into a single file and creates node tree in repository. In case of upload failures, sling provides support to query the last chunk uploaded till failure point. Client resumes chunk upload from last failure point. Protocol SpecificationUpload chunk using POSTFirst chunk uploadClient uses POST method to parent path to upload binary chunk of file. Client passes ":chunkNumber" and "fileName" as multipart request parameters. First chunk upload request
POST /content/dam
--ULPTM_fXARgFjsvsyvaO_W-2loSNQw
Content-Disposition: form-data; name=":chunkNumber"
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit1 --ULPTM_fXARgFjsvsyvaO_W-2loSNQw Content-Disposition: form-data; name="*"; filename="$fileName" Content-Type: application/octet-stream Content-Transfer-Encoding: binary $binarydata [response] First chunk upload response
HTTP/1.1 200 OK
<html>
<head>
<title>Content modified /tmp/sling/chunks</title>
</head>
<body>
<h1>Content modified /tmp/sling/chunks</h1>
<table>
<tbody>
<tr>
<td>Status</td>
<td><div id="Status">200</div></td>
</tr>
<tr>
<td>Message</td>
<td><div id="Message">OK</div></td>
</tr>
<tr>
<td>Location</td>
<td><a href="" class="code-quote">"/tmp/sling/chunks/e622fd2ebaa14b69b5a5b51a32084a6c" id="Location">/tmp/sling/chunks/e622fd2ebaa14b69b5a5b51a32084a6c</a></td>
</tr>
<tr>
<td>Parent Location</td>
<td><a href="" class="code-quote">"/tmp/sling/chunks" id="ParentLocation">/tmp/sling/chunks</a></td>
</tr>
<tr>
<td>Path</td>
<td><div id="Path">/tmp/sling/chunks</div></td>
</tr>
<tr>
<td>Referer</td>
<td><a href="" class="code-quote">"" id="Referer"></a></td>
</tr>
<tr>
<td>ChangeLog</td>
<td><div id="ChangeLog"><pre></pre></div></td>
</tr>
</tbody>
</table>
<p><a href="">Go Back</a></p>
<p><a href="" class="code-quote">"/tmp/sling/chunks/e622fd2ebaa14b69b5a5b51a32084a6c">Modified Resource</a></p>
<p><a href="" class="code-quote">"/tmp/sling/chunks">Parent of Modified Resource</a></p>
</body>
</html>
The location tag contains unique chunk upload which need to be passed on subsequent request. Upload of last chunkClient appends "/last" to upload url to signify that it would be last that needs to be uploaded. The last chunk upload request can optionally be multipart request if client requires to send additional parameters to sling. [request] Upload last chunk request POST /content/dam/dam-folder/catalog.pdf.chunk.<chunk_number>.res/last HTTP/1.1 Host: localhost:4502 Date: <date> Content-type: multipart/form-data, boundary=AaB03x --AaB03x content-disposition: form-data; name="fileSize" 210000000 --AaB03x content-disposition: form-data; name="file"; fileName="catalog.pdf" Content-Type: application/pdf Content-Transfer-Encoding: binary $binarydata --AaB03x-- [response] Upload last chunk response HTTP/1.1 201/CREATED Content-Length: 0 Location: /content/dam/dam-folder/catalog.pdf Content-MD5: $md5_hash Connection: close The location header provides location of fully uploaded asset.The response contains the $md5_hash of merged binary. Upload chunk using PATCHSling support three patch formats to upload chunks on sling. All other semantics remain same as Upload chunk using POST
Query to retrieve last successful chunk uploadReturns the number of last chunk upload and bytes uploaded successfully on sling. Get last successful chunk upload request GET /content/dam/dam-folder/catalog.pdf.chunk.json HTTP/1.1 Host: localhost:4502 Date: <date> Content-Length: 0 [response] Get last successful upload chunk response
HTTP/1.1 200/OK
Connection: close
{
"chunkNumber": 8
"bytesuploaded": 19872
}
If no broken/discontinued upload sling returns 404 not found response. Chunked upload not found response HTTP/1.1 404/Not Found Abort chunked upload[request] Abort chunked upload Request DELETE /content/dam/dam-folder/catalog.pdf.chunk.res HTTP/1.1 Host: localhost:4502 Date: <date> [response] Abort chunked upload response HTTP/1.1 200/OK Connection: close
Change Notification Preferences
View Online
|
View Changes
|
Add Comment
|
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
- [CONF] Apache Sling > Chunked File Upload Support confluence
