Chunked File Upload SupportPage edited by Shashank GuptaChanges (13)
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 endpoint 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 endpoint upon receiving the last chunk, stitches all chunks into a single file. The file inputstream is passed to inner layers for further processing. 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 of first and intermediate chunksUpload the first/intermediate chunk request Request: PATCH /content/dam/dam-folder/catalog.pdf.chunk.<chunk_number>.res HTTP/1.1 Host: localhost:4502 Content-Type: Date: <date> Content-Length: 5242880 First/Intermediate chunk upload response Response: HTTP/1.1 201 CREATED Content-Length: 0 Location: /content/dam/dam-folder/catalog.pdf.chunk Connection: close Server: localhost:4502 The location header provides path to retrieve chunk upload attributes. 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. Upload last chunk request Request: PATCH /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-- Upload last chunk response Response: HTTP/1.1 201/CREATED Content-Length: 0 Location: /content/dam/dam-folder/catalog.pdf Content-MD5: <md5 checksum of the merged file> Connection: close The location header provides location of fully uploaded asset. 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 Request GET /content/dam/dam-folder/catalog.pdf.chunk.json HTTP/1.1 Host: localhost:4502 Date: <date> Content-Length: 0 Get last successful upload chunk response
Response:
HTTP/1.1 200/OK
Connection: close
{
"chunkNumber": 8
"bytesuploaded": 19872
}
If no broken/discontinued upload sling returns 404 not found response. Get erroneous last successful upload chunk response Response: HTTP/1.1 404/Not Found Abort chunked uploadAbort chunked upload Request Request DELETE /content/dam/dam-folder/catalog.pdf.chunk.res HTTP/1.1 Host: localhost:4502 Date: <date> Abort chunked upload response Response HTTP/1.1 200/OK Connection: close Query sling's capability to support chunked uploadClient can use option method to query Sling's capability to support chunked upload. In response, the Allow header contains PATCH method, indicating that Sling supports chunked upload on the url. Options chunked upload request Request OPTIONS /content/dam/dam-folder/catalog.pdf.chunk.res HTTP/1.1 Host: localhost:4502 Date: <date> Options chunked upload response Response HTTP/1.1 200 OK Connection: Keep-Alive Allow: OPTIONS, GET, PATCH
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
