Class UploadChunkServlet

All Implemented Interfaces:
Servlet, ServletConfig, Serializable

public final class UploadChunkServlet extends HttpServlet
The chunk endpoint of the upload service: POST /iizi-upload/<rid>/<fid> with the per-file secret in the X-iizi-upload header, the protocol fields in the query string (o offset, u plain length, c chunk index, last, q) and the chunk as the raw body.

The request identifies nothing about the session: the reservation ID resolves in the server-global registry, which holds the application session. No cookie, no session ID, no remote-address binding. Strictly one chunk in flight per reservation (409 busy otherwise). The body is streamed to the part in 64 KiB buffers and never materialized whole. The secret is never logged.

Status codes: 404 unknown reservation or file (a reservation cancelled as a whole leaves the registry at once and is therefore 404, not 410); 401 wrong secret; 410 a cancelled, failed or refused file of a live reservation; 409 offset mismatch ({"o":hwm}), busy, or already complete; 423 a file the App holds paused ("paused":true, never a failure: the client waits for the App's resume); 413 chunk or file over its cap (the file fails); 400 malformed query; 200 {"o":newHwm,"done":bool}. A chunk for a file only the client had paused is that client's resume and is accepted.

Author:
Christopher Mindus
See Also: